User:CO/baghelper.js

importScript("User:TheFearow/simpleajax.js");

function baghelperload{ if(wgTitle.indexOf("Bots/Requests for approval/") != 0){ return; } mw.util.addPortletLink("p-cactions", "javascript:baghelper('trial')", "Trial", "ca-bag-trial", "BAG Trial", ""); mw.util.addPortletLink("p-cactions", "javascript:baghelper('speedy')", "BAG Speedy", "ca-bag-speedy", "BAG Speedy", ""); mw.util.addPortletLink("p-cactions", "javascript:baghelper('approved')", "Approve", "ca-bag-approve", "BAG Approve", ""); mw.util.addPortletLink("p-cactions", "javascript:baghelper('denied')", "Denied", "ca-bag-denied", "BAG Denied", ""); mw.util.addPortletLink("p-cactions", "javascript:baghelper('expired')", "Expired", "ca-bag-expired", "BAG Expired", ""); mw.util.addPortletLink("p-cactions", "javascript:baghelper('withdrawn')", "Withdrawn", "ca-bag-withdrawn", "BAG Withdrawn", ""); mw.util.addPortletLink("p-cactions", "javascript:baghelper('archive')", "Archive", "ca-bag-archive", "BAG Archive", ""); } $(baghelperload);

function baghelper(type){ if(type == "trial"){ var params = window.prompt("Template params (e.g. 'edits=50|days=3')", "edits=50"); if(params == null){ params = ""; }else{ params = "|" + params; } var tag = "{" + "{" + "BotTrial"+params+"}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Approving for Trial", false, true, " Editing... ", " Saved! ", true); } if(type == "speedy"){ var tag = "{" + "{" + "BotSpeedy}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Speedy Approve", false, true, " Editing... ", " Saved! ", false); //bagarchive('Speedy'); } if(type == "approved"){ var tag = "{" + "{" + "BotApproved}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Approved", false, true, " Editing... ", " Saved! ", false); //bagarchive('Approved'); } if(type == "denied"){ var tag = "{" + "{" + "BotDenied}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Denied", false, true, " Editing... ", " Saved! ", false); //bagarchive('Denied'); } if(type == "expired"){ var tag = "{" + "{" + "BotExpired}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Expired", false, true, " Editing... ", " Saved! ", false); //bagarchive('Denied'); } if(type == "withdrawn"){ var tag = "{" + "{" + "BotWithdrawn}}"; simpleAJAXAppend(wgPageName, ":"+tag+" "+""+"\n", "Withdrawn", false, true, " Editing... ", " Saved! ", false); //bagarchive('Denied'); } if(type == "archive"){ var result = window.prompt("What was the result? Approved/Denied/Withdrawn/Expired/Speedy", "Approved"); simpleAJAXAppendPrepend(wgPageName, "{"+"{"+"subst:BT|"+result+"}}", "{"+"{"+"subst:BB}}", "Archiving", false, false, " Archiving... ", " Archived, reloading... ", true); } }