User:Sturm/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.
window.AjaxDeleteExtraButtons = [
                   {
                    'label': 'Speedy Selfie/F10',
                    'tag': '{'+'{SD|F10}}',
                    'img_summary': 'Requesting speedy deletion: [[COM:CSD#F10|CSD F10]] (personal photos by non-contributors)',
                    'talk_tag': '{'+'{subst:speedynote|1=%FILE%|2=[[COM:CSD#F10|CSD F10]] (personal photos by non-contributors)}}',
                    'talk_summary': 'Notification of possible speedy deletion for %FILE% due to [[COM:CSD#F10|CSD F10]] (personal photos by non-contributors)',
                }, {
                    'label': 'Speedy Advert/G10',
                    'tag': '{'+'{SD|G10}}',
                    'img_summary': 'Requesting speedy deletion: [[COM:CSD#G10|CSD G10]] (files and pages created as advertisements)',
                    'talk_tag': '{'+'{subst:speedynote|1=%FILE%|2=[[COM:CSD#G10|CSD G10]] (files and pages created as advertisements)}}',
                    'talk_summary': 'Notification of possible speedy deletion for %FILE% due to [[COM:CSD#G10|CSD G10]] (files and pages created as advertisements)',
                },
];
//<nowiki>

//catALot///////////////////////////////////////
////////// Cat-a-lot user preferences //////////
window.catALotPrefs = {"disambig_category":"Disambiguation","redir_category":"Category redirects","watchlist":"preferences","minor":false,"editpages":false,"docleanup":true,"subcatcount":50,"uncat":true,"button":true};
////////////////////////////////////catALotEnd//
//</nowiki>

mw.loader.load( '//commons.wikimedia.org/w/index.php?title=User:Perhelion/massrename.js&action=raw&ctype=text/javascript' );
importScript('User:Rillke/bigChunkedUpload.js');

/**
 * Add a link on sidebar to reload images due to T266155
 */
function reloadImag() {
	const imag = document.querySelectorAll('img');
	imag.forEach(img => {
	    if (img.naturalWidth === 0) {
	        setTimeout(() => {
	        	const newImg = new Image();
		        newImg.onload = () => {
		            img.parentNode.replaceChild(newImg, img);
		        };
		        newImg.src = img.src;
	        }, 200);
	    }
	});
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 14) {
    mw.util.addPortletLink(
        'p-tb', 
        'javascript:reloadImag();', 
        'Reload images'
    );
}