User:OsamaK/shouldbesvg.js

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