User:Unit388/script.js

// /************* afd Helper ************/ // see User:Jnothman/afd_helper importScript("User:Jnothman/automod.js");

afdh_signature = ''+'~'; afdh_summaryprompt = true; afdh_useicons = false; afdh_shortcuts = Object; afdh_shortcuts['d'] = 'Delete'; afdh_shortcuts['k'] = 'Keep'; afdh_shortcuts['m'] = 'Merge'; afdh_shortcuts['mv'] = 'Move'; afdh_shortcuts['rd'] = 'Redirect'; afdh_shortcuts['rw'] = 'Rewrite'; afdh_shortcuts['t'] = 'Transwiki'; afdh_shortcuts['wd'] = 'Weak delete'; afdh_shortcuts['sd'] = 'Strong delete'; afdh_shortcuts['sp'] = 'Speedy delete'; afdh_shortcuts['sk'] = 'Strong keep'; afdh_shortcuts['wk'] = 'Weak keep'; afdh_shortcuts['spk'] = 'Speedy keep'; afdh_shortcuts['c'] = 'Comment'; afdh_icons = Object; afdh_icons['d'] = afdh_icons['wd'] = afdh_icons['sd'] = afdh_icons['sp'] = 'Symbol delete vote.svg'; afdh_icons['k'] = afdh_icons['sk'] = afdh_icons['wk'] = 'Symbol keep vote.svg'; afdh_icons['m'] = 'Symbol merge vote.svg'; afdh_icons['c'] = 'Symbol comment vote.svg'; afdh_commscs = Object; afdh_commscs['pn'] = 'per nom.'; function afd_helper { if (auto_mod) 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('"+escape(anchors[i].href)+"')"; na.title = "Vote on 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); }   if (am_get_title.indexOf(':') == -1) am_add_li('tb', 'javascript:twinklespeedy', 'Pre-TAG', '', 'Tag this article for pre-speedy deletion'); am_add_li('tb', 'javascript:addlimenu(1,1,1,1)', 'Nominate AFD', '', 'Nominate this article for deletion'); } function afd_vote(edit_link) { var shortcuts_list = ''; for (var key in afdh_shortcuts) shortcuts_list += key + ': ' + afdh_shortcuts[key] + '; '; var vote = window.prompt("Enter your vote.  (Shortcuts available are: "+shortcuts_list+")"); if (!vote) return; var icon_link = ''; if (afdh_useicons && afdh_icons[vote.toLowerCase]) icon_link = ' '; if (afdh_shortcuts[vote.toLowerCase]) vote = afdh_shortcuts[vote.toLowerCase]; shortcuts_list = ''; for (var key in afdh_commscs) shortcuts_list += key + ': ' + afdh_commscs[key] + '; '; var comment = window.prompt("Enter your comment. (Shortcuts available are: "+shortcuts_list+")"); if (typeof comment != 'string') return; if (afdh_commscs[comment.toLowerCase]) comment = afdh_commscs[comment.toLowerCase]; var summary = vote; if (afdh_summaryprompt) if (!(summary = window.prompt("Enter the edit summary:", summary))) summary = vote; var url = edit_link + '&amaddafter='+escape("* "+icon_link+vote+" "+comment+" "+afdh_signature+" "+""+"~") + '&amsummary='+escape(summary); if (window.location.href.indexOf("/Log/") == -1) window.location.href = url; else window.open(url, "afd_helper_vote"); } function afd_nominate { var title = am_get_title; var log_date = window.prompt("This should be the date of the latest AFD log. Change it if necessary.", am_guess_date); if (!log_date) return; var reason = window.prompt("Please justify your AFD nomination of "+title+":"); if (!reason) return; var cat = window.prompt("Please categorize your nomination: M: Media and music; O: Organisation, company, or product; B: Biographical; S: Society; W: Web/Internet; G: Games/Sport; T: Science/Technology; F: Fiction and the arts; P: Places or transportation; I: Unclassifiable; ?: Unsure"); if (!cat) cat="U"; window.open(am_make_url(title, , , 'nomination for deletion'), 'afdhn1'); window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, , , 'Nominating '+title+' for deletion') + "&amatstring=TOP+of+the+following+list+-->", 'afdhn3'); window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, , , 'nominated for deletion'); }

function pushmsg(msg) { if (!msg) return; mw.notify(msg); }

function pretag { var title = am_get_title; importScript("User:Unit388/twinklespeedy.js"); var reason = window.prompt("Type in your username:"); if (!reason) return; window.open(am_make_url(title, , , 'Pre-speedy deletion tag'), 'afdhn1'); // window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, , , 'Nominating '+title+' for deletion') + "&amatstring=TOP+of+the+following+list+-->", 'afdhn3'); //window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, , , 'nominated for deletion'); }

function speedya7 { var title = am_get_title; window.open(am_make_url(title, , , 'Speedy Deletion tag'), 'afdhn1'); // window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, , , 'Nominating '+title+' for deletion') + "&amatstring=TOP+of+the+following+list+-->", 'afdhn3'); //window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, , , 'nominated for deletion'); }

function custom { var title = am_get_title; importScript("User:Unit388/twinklespeedy.js"); var reason = window.prompt("Type the deletion code eg A7"); if (!reason) return; window.open(am_make_url(title, , , 'Speedy Deletion Tag'), 'afdhn1'); // window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, , , 'Nominating '+title+' for deletion') + "&amatstring=TOP+of+the+following+list+-->", 'afdhn3'); //window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, , , 'nominated for deletion'); }

addOnloadHook(afd_helper); addOnloadHook(function {    var x;    if (!(x = document.getElementById('ca-edit') )) return;    var url;    if (!(url = x.getElementsByTagName('a')[0] )) return;    if (!(url = url.href )) return;    var cus = mw.util.addPortletLink('p-cactions', 'javascript:custom', 'Custom Speedy', 'ca-edit-0', 'Add a Speedy Deletion tag', '0', x.nextSibling); var y = mw.util.addPortletLink('p-cactions', 'javascript:pretag', 'PreTag', 'ca-edit-0', 'Add a Pre-Speedy Deletion tag', '0', x.nextSibling); var a7 = mw.util.addPortletLink('p-cactions', 'javascript:speedya7', 'Quick A7', 'ca-edit-0', 'Add a Speedy Deletion tag', '0', x.nextSibling); cus.className = x.className;   a7.className = x.className;    y.className = x.className;  // steal classes from the the edit tab...    x.className = 'istalk';     // ...and make the edit tab have no right margin    // exception: don't steal the "selected" class unless actually editing section 0:    if (/(^| )selected( |$)/.test(y.className)) {        if (!document.editform || !document.editform.wpSection || document.editform.wpSection.value != "0") {           y.className = y.className.replace(/(^| )selected( |$)/g, "$1");            x.className += ' selected';        }    } }); // //