User:Whiteknight/per book/Wikibooks:Votes for deletion.js

Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
  • Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac);
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5;
  • Konqueror: simply click the Reload button, or press F5;
  • Opera users may need to completely clear their cache in Tools→Preferences.
/*
  A Semi-automated archiver for VfD. Use at your own risk, it's very fragile and buggy.
*/

$(function () {
  var editlinks = wk.getElementsByClass("editsection");
  for(var i = 0; i < editlinks.length; i++) {
    var j = i + 1
    var a = document.createElement("a");
    a.href = "javascript:ArchiveSection(" + j + ");";
    a.innerHTML = "archive";
    a.id = "WK_Archive_" + j;
    wk.appendChildren(editlinks[i], ["[", a, "]"]);
  }
});

var j;
function ArchiveSection(num) {
  j = num;
  wk.loadWikiTextSection("Wikibooks:Votes for deletion", j, ArchiveSection2);
}

function ArchiveSection2(text) {
  var pagename = "Wikibooks:Votes for deletion";
  name = prompt("Enter the name of the book or page");
  if(!confirm("Move discussion for " + name + "?")) return;
  wk.postEdit(pagename + "/" + name, text, "Moving discussion to archive");
  wk.postEdit(pagename, "", "Moving discussion to archive", {section:j});
  window.location.refresh(true);
}