User:MBisanz/monobookrfa.js

importScript('User:Animum/urlparameters.js');

function addrfacatlinks { var href_ = location.href.replace(/\/wiki\//i, "/w/index.php?title="); var href = href_ + "&action=edit&rfacat="; mw.util.addPortletLink("p-cactions", href + "redir", "redir", "ca-redir"); mw.util.addPortletLink("p-cactions", href + "success", "success", "ca-success"); mw.util.addPortletLink("p-cactions", href + "failed", "unsuccessful", "ca-failed"); }

if(document.title.indexOf("Wikipedia:Requests for adminship/") != -1) addOnloadHook(addrfacatlinks);

function decodeURLParams(param) { switch(param) { case "redir"  : return "Category:Redirects to requests for adminship"; break; case "success" : return "Category:Successful requests for adminship"; break; case "failed" : return "Category:Unsuccessful requests for adminship"; break; } }

addOnloadHook(function {   if(document.title.indexOf("Editing Wikipedia:Requests for adminship/") != -1 && UrlParameters["action"] == "edit" && typeof(UrlParameters["rfacat"]) != 'undefined') {        if(document.forms["editform"].wpTextbox1.value.indexOf("Category:Redirects to requests for adminship") != -1 || document.forms["editform"].wpTextbox1.value.indexOf("Category:Successful requests for adminship") != -1 || ["editform"].wpTextbox1.value.indexOf("Category:Unsuccessful requests for adminship") != -1) {            jsMsg(' ''' This RfA has already been categorized. ''' ');       } else {            var cat = decodeURLParams(UrlParameters["rfacat"]);            document.forms["editform"].wpTextbox1.value += "\n" + cat;            document.forms["editform"].wpSummary.value = "Script-assisted categorization";            document.forms["editform"].wpMinoredit.checked = false;            document.forms["editform"].submit; //Submit        }    } });