User:OsamaK/badjpg.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.
// {{BadJPG}} tagger
function BadJPG() {
if (document.editform) {
document.editform.wpTextbox1.value += "\n{{BadJPG}}";
document.editform.wpSummary.value = "{{[[Template:BadJPG|BadJPG]]}}";
document.editform.wpWatchthis.checked = false;
document.editform.submit();
} else
document.location = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + wgPageName + "&action=edit&BadJPG=1";
}
function addBadJPG(){
if (wgNamespaceNumber == 6)
mw.util.addPortletLink("p-cactions", "javascript:BadJPG()", "{{BadJPG}}", "");
if (document.location.href.indexOf("BadJPG=1") > 0)
BadJPG();
}
addOnloadHook(addBadJPG);