User:Delta 51/common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
$(function(){$('.mw-gallery-traditional li').each(function()
{var $this=$(this),child=$this.children('div'),child2=child.children('div'),img=child2.find('img');if(img[0].width*3<img.data('file-width'))
{$this.width($this.width()*2);child.width(child.width()*2);child2.width(child2.width()*2);img[0].srcset='';img[0].src=img[0].src.replace(/\d+(px-[^\/]*$)/,(img[0].width*2)+'$1');img[0].width*=2;img[0].height*=2}})});