User:Encephalon/monobook.js

// //

/**********Korath's blockip*************/

// Returns  name function addlilink(url, name) { var na = document.createElement('a'); na.setAttribute('href', url);

var txt = document.createTextNode(name); na.appendChild(txt);

var li = document.createElement('li'); li.appendChild(na); return li; }

// Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&faketarget=username" is present. function do_blockip_stuff { // focus on Reason field document.getElementsByName('wpBlockReason')[0].focus;

// Look for a &faketarget= for the username/ip var l = location.search.substring(1).split('&'); var target = ''; for (var i = 0; i < l.length; ++i) {     var n = l[i].indexOf('='); if (l[i].substring(0, n) == 'faketarget') {	 target = l[i].substring(n + 1); break; }   }

if (target == '') return;

// put account name in "IP Address/username" field var addr = document.getElementsByName('wpBlockAddress')[0]; addr.value = unescape(target);

// add "blocklog" tab var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target, 'blocklog')); }

// Opens the block log in the current window, and Special:Blockip in a popup. // Width, height, top, and left are chosen for a 1600x1200 display. //function blockpage_and_log(target) //{ // window.open('Special_Blockip.html?foo=blarg&faketarget=' + target, 'Block', 'width=1600,height=600,top=600,left=0'); // document.location.href = 'http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target; //}

// Adds "block" and "blocklog" tabs to User: and User talk: pages. function add_block_tab { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

// use the "edit this page" tab to get already-tidied url var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; // cut everything up to "title=" from the start and everything past "&action=edit" from the end editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); editlk = editlk.substring(editlk.indexOf(':') + 1); var slloc = editlk.indexOf('/'); if (slloc > 0) editlk = editlk.substring(0, slloc);

// add "block" tab tabs.appendChild(addlilink('/w/index.php?title=Special%3ABlockip&faketarget=' + editlk, 'block'));

// To open the block page and block log simultaneously, replace the above line with: // tabs.appendChild(addlilink('javascript:blockpage_and_log("' + editlk + '")', 'Block')); // and uncomment the blockpage_and_log function above.

// add "blocklog" tab tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'blocklog')); }

function do_onload { if (document.title.indexOf('User:') == 0      || document.title.indexOf('User talk:') == 0      || document.title.indexOf('Editing User:') == 0      || document.title.indexOf('Editing User talk:') == 0) add_block_tab; else if (document.title.indexOf('Block user') == 0) // could stand to be more robust do_blockip_stuff; }

if (window.addEventListener) window.addEventListener("load", do_onload, false); else if (window.attachEvent) window.attachEvent("onload", do_onload);

/***********AFD helper************/

document.write(' ');

afdh_signature = +; afdh_summaryprompt = true;

afdh_shortcuts = Array; afdh_shortcuts['c'] = 'Comment.'; afdh_shortcuts['md'] = 'Merge and delete.'; afdh_shortcuts['mr'] = 'Merge and redirect.'; afdh_shortcuts['m'] = 'Move'; afdh_shortcuts['r'] = 'Redirect'; afdh_shortcuts['t'] = 'Transwiki'; afdh_shortcuts['d'] = 'Delete.'; afdh_shortcuts['k'] = 'Keep.'; afdh_shortcuts['sd'] = 'Speedily delete.'; afdh_shortcuts['sk'] = 'Strong keep.';

afdh_commscs = Array; afdh_commscs['pn'] = 'Per nominator.';

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('"+anchors[i].href.replace(/'/g, '\\\'')+"')"; 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:afd_nominate', '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; 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("* "+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; window.open(am_make_url(title, , , 'Nominating for deletion'), 'afdhn1'); window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, , , 'Nominating '+title+' for deletion'), 'afdhn3'); window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, , , 'nominated for deletion');}

if (window.addEventListener) window.addEventListener("load",afd_helper,false); else if (window.attachEvent) window.attachEvent("onload",afd_helper);

/***********Interiot's***********/

mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript');

/***********HosePunchKid's Add Pipe to unsigned2***********/ // Add a pipe to make using Template:Unsigned2 easier. function addPipesToHistory {   if(document.title.indexOf("- History -") > 0) {       var items=getElementsByClass(document, "history-user", "span"); for(i=0;i<items.length;i++) {           var hidden=document.createElement("span"); hidden.appendChild(document.createTextNode("|")); hidden.setAttribute("style", "color: white;"); items[i].childNodes[0].insertBefore(hidden,                   items[i].childNodes[0].childNodes[0]); }   } }

// //