Jump to content

User:Ultraexactzz/afdsort.js

From Wikipedia, the free encyclopedia
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.
//<pre><nowiki>
 function afdsort() {
  var f = document.editform, t = f.wpTextbox1;
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|U}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|u}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|?}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|I}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|i}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|{{{category}}}}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|{{{cat}}}}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|Category}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|category}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|cat}}\r\n").join("{{subst:Void}}");
  t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|unsorted}}\r\n").join("{{subst:Void}}");
  var cat = prompt("Enter Category code", "");
  if(t.value.split("===").length>=3)
{
    var a=t.value.split("===");
    a[2]="\n" + "{{" + "REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD" + "|" + cat + "}}" + a[2];
    t.value=a.join("===");
}
    f.wpSummary.value = "Sorting per [[CAT:AFD]] using [[User:Ultraexactzz/afdsort|AFDsort]]";
    f.submit();
}
 
addOnloadHook(
 function addafdsortlink() { 
  if (document.title.indexOf("Editing Wikipedia:Articles for deletion") == 0)
  {
    mw.util.addPortletLink("p-cactions", "javascript:afdsort()", "Sort", "", "", "", "");
  } }
); 
//</nowiki></pre>