User:Dlyons493/Working
Appearance
afd_helper_dl
[edit]/************* afd Helper DL ************/ // see User:Jnothman/afd_helper
function afd_get_query_vars(){
var res = new Array(); var pairs = location.search.substring(1).split("&"); for(var i=0; i < pairs.length; i++){ var pair = pairs[i].split("="); res[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' '); } return res;
}
function afd_helper() {
qvars = afd_get_query_vars(); var vote; if (qvars['action']=='edit') { if (vote = qvars['afdverdict']) { var comment = qvars['afdcomment'] || ; var text = document.getElementById('wpTextbox1'); if (text.value.charAt(text.value.length-1) != '\n') text.value += '\n'; text.value += "* "+vote+" "+comment+" ~~"+"~~"; document.getElementById('wpSummary').value += ' ' + vote; document.getElementById('editform').submit(); } return; } var anchors = new Array(); { var oldanchors = document.getElementById('bodyContent').getElementsByTagName('a'); for (var i=0; i < oldanchors.length; i++) anchors[i] = oldanchors[i]; } var url_re = /\?title=Wikipedia:Articles_for_deletion\/([^&]+)&action=edit&/; var url, matches; for (var i=0; i < anchors.length; i++) { if (!(matches = anchors[i].href.match(url_re)) || (matches[1].substr(0, 4) == 'Log/')) continue; var na = document.createElement('a'); na.href = "javascript:afd_vote('"+anchors[i].href+"')"; na.title = "Make a vote on the proposed deletion of"+unescape(matches[1]); var inlink = document.createElement('sup'); inlink.appendChild(document.createTextNode('vote')); na.appendChild(inlink); anchors[i].parentNode.insertBefore(na, anchors[i].nextSibling); }
}
function afd_vote(edit_link) {
var vote = window.prompt("Enter your vote (eg delete, keep, merge):"); if (!vote) return; var comment = window.prompt("Enter your comment:"); if (typeof comment != 'string') return; var url = edit_link + '&afdverdict='+escape(vote)+'&afdcomment='+escape(comment); window.open(url);
}