Jump to content

User:Pxma/afdcloser.js

From Wikipedia, the free encyclopedia
(Redirected from User:PxMa/afdcloser.js)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript("User:PxMa/simpleajax.js");
importScript("User:Azatoth/morebits.js");
 
function afdhelperload(){
 if(wgTitle.indexOf("Articles for deletion/") == -1){
  return;
 }
 mw.util.addPortletLink("p-cactions", "javascript:afdhelper('Close')", "Close", "ca-close", "close", "");
}
$(afdhelperload);
 
function afdhelper(type){
 if(type == "Close"){
  var params = window.prompt("add the results");
  if(params == null){
   params = "";
  }else{
   params = " " + params;
  }
  var tag = "{" + "{" + "subst:afd top"+params+"}}";
  simpleAJAXAppendPrepend(wgPageName, "{"+"{"+"subst:afd top}}" +params+ "\~\~\~\~", "{"+"{"+"subst:afd bottom}}", "Closing AfD", false, false, "<h3>Archiving...</h3>", "<h3>Archived, reloading...</h3>", true, false);
 }
document.forms["editform"].wpTextbox1.replace(/\{\{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD\|[^\}]*\}\}/, '');
}