Etdiyiniz dəyişikliklərin yayımlanandan sonra effekt verməsi üçün brauzerinizin keşini təmizləməyə ehtiyacınız ola bilər. Bunun üçün Chrome, Firefox, Edge, yaxud Safari istifadəçisisinizsə, klaviaturanızın Shift düyməsini sıxaraq brauzerin ⟳ səhifə yeniləmək düyməsini klik edə bilərsiniz.
$(document.getElementsByClassName("fileInfo")).ready(function(){// Filenamespace onlyif(mw.config.get("wgNamespaceNumber")!==6)return;// Get file information: height and widthvarfileInfo=document.getElementsByClassName("fileInfo")[0];if(!fileInfo)return;varheight_width=fileInfo.innerHTML.match(/([\d\.]+) × ([\d\.]+)/);// With the height and width, calculate the total pixel countvarwidth=parseInt(height_width[1].replace(/\./g,''));varheight=parseInt(height_width[2].replace(/\./g,''));vartotal_pixels=height*width;// Maximum pixel count per IMAGERESvarmax_pixels=100000;// Calculate the new width, height, dimensions and total pixel count with the// formula from IMAGERES, and confirm the new total pixel count is within rangevarnew_width=Math.floor(Math.sqrt(max_pixels*width/height));varnew_height=Math.round(height*new_width/width);varnew_total_pixels=new_width*new_height;while(new_total_pixels>max_pixels){new_width--;new_height=Math.round(height*new_width/width);new_total_pixels=new_width*new_height;}varnew_dimensions=new_width+" × "+new_height;// Colour coding the results; green = good, red = badvarcolour_start="";varcolour_end="";if(total_pixels>max_pixels){colour_start="<span style='color:red'><b>";colour_end="</b></span>";}else{colour_start="<span style='color:green'>";colour_end="</span>";}// Add the total pixel count after the initial dimensionsfileInfo.innerHTML=fileInfo.innerHTML.replace("piksel,","piksel, cəmi "+colour_start+number_format(total_pixels)+colour_end+" piksel, ");// If the image exceeds 0.1MP, then report the errorif(total_pixels>max_pixels){// Create a image link with the maximum reduced sizevarimage_link=document.getElementsByClassName('internal')[0].href;varnew_image_link=image_link.replace("/az/","/az/thumb/")+"/"+new_width+"px-"+image_link.substr(image_link.lastIndexOf("/")+1);varreuploadReason="[[VP:ÖLÇÜ]] qaydasına əsasən [[İstifadəçi:Gadir/script-imageres.js|skript]] ilə şəklin ölçüsü 0.1MB-dan aşağı salınır.";varreplaceLink=document.getElementById('mw-imagepage-reupload-link');if(!replaceLink||!replaceLink.children)return;varreuploadLink=replaceLink.children[0];varreuploadLinkNew=reuploadLink.href+"&wpUploadDescription="+reuploadReason;// Add the maximum size of the image that's less than 0.1MP, the total pixel count, the new image link, and the reupload link summaryfileInfo.innerHTML=fileInfo.innerHTML+"<br>(maksimal ölçü: "+colour_start+new_dimensions+colour_end+" piksel, cəmi "+number_format(new_total_pixels)+" piksel, <a href='"+new_image_link+"'>ölçüsü düzəldilmiş fayl</a>, <a href='"+reuploadLinkNew+"'>faylı düzgün ölçülərlə yenidən yükləyin</a>)";}// Add commas to values over 1,000functionnumber_format(x){returnx.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");}});