User:Pxma/afchelper.js

importScript("User:PxMa/simpleajax.js"); importScript("User:Azatoth/morebits.js");

function afchelperload{ if(wgTitle.indexOf("Articles for creation") == -1){ return; } mw.util.addPortletLink("p-cactions", "javascript:afchelper('approved')", "approved", "ca-approved", "approved", ""); mw.util.addPortletLink("p-cactions", "javascript:afchelper('denied')", "denied", "ca-denied", "denied", ""); mw.util.addPortletLink("p-cactions", "javascript:afchelper('archive')", "archive", "ca-archive", "archive", ""); } $(afchelperload);

function afchelper(type){ if(type == "approved"){ var params = window.prompt("add articlename, or don't "); if(params == null){ params = ""; }else{ params = "|" + params; } var tag = "{" + "{" + "subst:afc accept"+params+"}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Approving article", false, true, " Editing... ", " Saved! ", true); } if(type == "denied"){ var params = window.prompt("v/bio/nn/web/corp/music/dict/context/blank/neo/joke/lang/blp/npov/not"); if(params == null){ params = ""; }else{ params = " " + params; } var tag = "{" + "{" + "subst:afc"+params+"}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Article denied", false, true, " Editing... ", " Saved! ", false); } if(type == "archive"){ var result = window.prompt("If accepted add accept", "Approved"); simpleAJAXAppendPrepend(wgPageName, "{"+"{"+"subst:afc top|"+result+"}}", "{"+"{"+"subst:afc b}}", "Archiving", false, false, " Archiving... ", " Archived, reloading... ", true); } }