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

/* 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); }