User:Topaz/prodego-monobook.js

//

/*function addlilink(tabs, url, name){

var na = document.createElement('a');

na.href = url;

na.appendChild(document.createTextNode(name));

var li = document.createElement('li');

li.appendChild(na);

tabs.appendChild(li);

return li;

}*/

function addlilink(tabs, url, name, id){

var na = document.createElement('a');

na.href = url;

na.appendChild(document.createTextNode(name));

var li = document.createElement('li');

li.id = id;

li.appendChild(na);

tabs.appendChild(li);

return li;

}

//////////////////////////////////////////

// Tabs by Korath

// 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;

    }*/

    // appends msg to the currently-editted page, sets the summary to summ,

    // and marks or unmarks the Watch this page checkbox according to watch.

    function edit_summary_watch(msg, summ, watch, line)

    {

    var f = document.editform, t = f.wpTextbox1;

    if ((t.value.length > 0) && (line == 1))

    t.value += '\n\n';

    if (line == -1)

    t.value = msg + t.value;

    else

    t.value += msg;

    if (summ.charAt(0) == '+')

    f.wpSummary.value += summ.substr(1);

    else

    f.wpSummary.value = summ;

    f.wpWatchthis.checked = 0;

    }

    function add_talk_header()

    {

    var from_page = "";

    var from_index = location.search.indexOf("&fakefrom=");

    if(from_index != -1)

    var from_page = unescape(location.search.substring(from_index + 10));

    edit_summary_watch("Regarding your edits to \:" + from_page + ": ", "\/\* " + from_page + "\*\/ ", true, 1);

    }

    function vfddelete(){

    document.forms.deleteconfirm.wpReason.value = 'Wikipedia( talk)?):/, '') + '';

    }

    function csddelete (reason) {

    document.forms.deleteconfirm.wpReason.value = reason + document.forms.deleteconfirm.wpReason.value;

    }

    function testwarning(level, summ, sig)

    {

    var user_warnings = new Array (

    "test2a", "test1", "test2", "test3", "test4", "test5-n|31 hours|~\~\~\~", "vblock|31 hours|~\~\~\~",

    "vpblock", "usertalk-sprotect");

    var msg = "{{" + (level == 8 ? "" : "subst:") + user_warnings [level] + "}}" + (sig==1 ? "\n\n\~\~\~\~\n" : "\n");

    if (level == 3)

    msg = "" + "Image:Stop_hand.png" + msg;

    edit_summary_watch (msg, summ, true, ((level != 8) ? 1 : -1));

    }

    function userpageban()

    {

    edit_summary_watch("{{" + "subst:Indefblockeduser}}\n" , "Permanently blocked", true, -1);

    }

    // adds various tabs to call the above

    function add_tabs()

    {

    var c1 = document.getElementById('column-one');

    var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

    // Only add for pages with "Editing User talk:" somewhere in the title

    if (document.title.indexOf("Editing User talk:") != -1)

    {

    addlimenu(tabs, 'Warnings', 'usert');

    var usert = document.getElementById('usert').getElementsByTagName('ul')[0];

    addlilink(usert,'javascript:add_talk_header()',"header");

    addlilink(usert,'javascript:testwarning(1,"+{{" + "test1}}",1)',"test1");

    addlilink(usert,'javascript:testwarning(2,"+{{" + "test2}}",1)',"test2");

    addlilink(usert,'javascript:testwarning(0,"+{{" + "test2a}}",1)',"test2a");

    addlilink(usert,'javascript:testwarning(3,"+{{" + "test3}}",1)',"test3");

    addlilink(usert,'javascript:testwarning(4,"+{{" + "test4}}",1)',"test4");

    addlilink(usert,'javascript:testwarning(5,"+Blocked for 31 hours.",0)',"block");

    addlilink(usert,'javascript:testwarning(8,"semi-protected",0)',"spt");

    }

    else if (document.title.indexOf("Confirm delete") != -1)

    {

    addlimenu(tabs, 'Article Deletion', 'articlesmenu');

    var art = document.getElementById('articlesmenu').getElementsByTagName('ul')[0];

    addlilink(art,'javascript:vfddelete()', 'AFD', '');

    addlilink(art,'javascript:csddelete("CSD A1: Little or no context.")', 'Context', '');

    addlilink(art,'javascript:csddelete("CSD A2: Foreign language articles that exists on another Wikimedia project.")', 'Foreign', '');

    addlilink(art,'javascript:csddelete("CSD A3: No content whatsoever.")', 'Content', '');

    addlilink(art,'javascript:csddelete("CSD A5: Transwikied article.")', 'Trnswiki', '');

    addlilink(art,'javascript:csddelete("CSD A6: Attack page.")', 'Attack', '');

    addlilink(art,'javascript:csddelete("CSD A7: Unremarkable people or groups.")', 'Bio', '');

    addlilink(art,'javascript:csddelete("CSD A8: Blatant copyright infringement.")', 'Cpv', '');

    addlimenu(tabs, 'General Deletion', 'generalmenu');

    var gen = document.getElementById('generalmenu').getElementsByTagName('ul')[0];

    addlilink(gen,'javascript:csddelete("CSD G1: Patent nonsense.")', 'Nons', '');

    addlilink(gen,'javascript:csddelete("CSD G2: Test pages.")', 'Test', '');

    addlilink(gen,'javascript:csddelete("CSD G3: Pure vandalism.")', 'Vand', '');

    addlilink(gen,'javascript:csddelete("CSD G4: Recreation of deleted material.")', 'Recr', '');

    addlilink(gen,'javascript:csddelete("CSD G5: Page created by a banned user.")', 'Banned', '');

    addlilink(gen,'javascript:csddelete("CSD G6: Housekeeping.")', 'Housek', '');

    addlilink(gen,'javascript:csddelete("CSD G7: Author request.")', 'Request', '');

    addlilink(gen,'javascript:csddelete("Talk page of a deleted...")', 'Talk', '');

    }

    // Only add for pages with "Editing User:" somewhere in the title

    else if (document.title.indexOf("Editing User:") != -1)

    {

    addlilink(tabs,'javascript:userpageban()',"ban");

    }

    }

    if (window.addEventListener)

    window.addEventListener("load", add_tabs, false);

    else if (window.attachEvent)

    window.attachEvent("onload", add_tabs);

    function hidevfd(){

    var divs = document.getElementsByTagName("div");

    for(var x = 0; x < divs.length; ++x)

    if(divs[x].className.indexOf("vfd") != -1)

    divs[x].style.display = "none";

    document.getElementById('footer').style.display = 'none';

    }

    function showvfd(){

    var divs = document.getElementsByTagName("div");

    for(var x = 0; x < divs.length; ++x)

    if(divs[x].className.indexOf("vfd") != -1)

    divs[x].style.display = "";

    document.getElementById('footer').style.display = '';

    }

    function vfdlinks(){

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

    if(document.title.indexOf("Wikipedia:Articles for deletion") == 0){

    add_link2('javascript:hidevfd()', 'hide');

    add_link2('javascript:showvfd()', 'show');

    }

    }

    if (window.addEventListener) window.addEventListener("load",vfdlinks,false);

    else if (window.attachEvent) window.attachEvent("onload",vfdlinks);

    ///////////////////////////////////////////////////////////////////

    // AutoVFD by Korath

    // This needs to change depending on skin used.

    //////////////////////////////////////////////////////////////////

    function add_link2(url, name)

    {

    var na = document.createElement('a');

    na.setAttribute('href', url);

    na.appendChild(document.createTextNode(name));

    var li = document.createElement('li');

    li.appendChild(na);

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

    tabs.appendChild(li);

    }

    function strip_namespace(target)

    {

    var colon = target.indexOf(':');

    if (colon != -1)

    {

    var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');

    var ns = target.substring(0, colon);

    if (ns == '' || ns == 'Talk')

    return target.substring(colon + 1);

    else

    for (var i = 0; i < spaces.length; ++i)

    {

    if (ns == spaces[i]

    || ns == spaces[i] + '_talk')

    return target.substring(colon + 1);

    }

    }

    return target;

    }

    function copyvio()

    {

    document.editform.wpTextbox1.value = '{' + '{' + 'copyvio|url=}}';

    document.editform.wpSummary.value = 'copyvio';

    var target = document.editform.action;

    target = target.substring(target.indexOf('title=') + 6,

    target.lastIndexOf('&action=submit'));

    var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

    var date = new Date();

    date = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();

    var pagename = strip_namespace(target);

    window.open('/w/index.php?title=Wikipedia%3ACopyright_problems/' + date + '/Articles' + '&action=edit&fakeaction=copyviolist&faketarget=' + pagename,

    'cpvio',

    'status,location,directories,resizeable,scrollbars');

    }

    function autocopyvio()

    {

    if (document.title.indexOf('Editing ') == 0)

    {

    var action = '';

    var target = '';

    if (location.search)

    {

    var l = location.search.substring(1).split('&');

    for (var i = 0; i < l.length; ++i)

    {

    var eq = l[i].indexOf('=');

    var name = l[i].substring(0, eq);

    if (name == 'fakeaction')

    action = l[i].substring(eq + 1);

    else if (name == 'faketarget')

    target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');

    }

    }

    if (action == 'copyviolist')

    {

    document.editform.wpTextbox1.value += '*' + '{{article-cv|' + target + '}}' + ' from [' + ']. ~' + '~~' + '~\n';

    document.editform.wpSummary.value = 'Copyvio ' + '' + target + '';

    }

    }

    }

    if (window.addEventListener)

    window.addEventListener('load', autocopyvio, false);

    else if (window.attachEvent)

    window.attachEvent('onload', autocopyvio);

    function vfd()

    {

    document.editform.wpTextbox1.value = '{' + '{' + 'subst:afd}}\n' + document.editform.wpTextbox1.value;

    document.editform.wpSummary.value = 'AfD';

    document.editform.wpWatchthis.checked = true;

    var target = document.editform.action;

    target = target.substring(target.indexOf('title=') + 6,

    target.lastIndexOf('&action=submit'));

    var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

    var date = new Date();

    date = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();

    var pagename = strip_namespace(target);

    window.open('/w/index.php?title=Wikipedia%3AArticles_for_deletion/' + pagename + '&action=edit&fakeaction=vfdsub&faketarget=' + target,

    'Vfd',

    'status,location,directories,resizable,scrollbars');

    window.open('/w/index.php?title=Wikipedia%3AArticles_for_deletion/Log/' + date + '&action=edit&fakeaction=vfdlist&faketarget=' + pagename,

    'VfdLog',

    'status,location,directories,resizable,scrollbars');

    }

    function vfdvote(vote)

    {

    if (vote == 1)

    edit_summary_watch("*\'\'\'Delete\'\'\' ~"+"~"+"~"+"~", document.editform.wpSummary.value + "delete", true, 0);

    else if (vote == 2)

    edit_summary_watch("*\'\'\'Keep\'\'\' ~"+"~"+"~"+"~", document.editform.wpSummary.value + "keep", true, 0);

    else if (vote == 3)

    edit_summary_watch("*\'\'\'Merge\'\'\' ~"+"~"+"~"+"~", document.editform.wpSummary.value + "merge", true, 0);

    else if (vote == 4)

    edit_summary_watch("*\'\'\'Redirect\'\'\' ~"+"~"+"~"+"~", document.editform.wpSummary.value + "redirect", true, 0);

    }

    function vfdtalk(result)

    {

    boiler1 = "=" + "=Articles for Deletion debate=" + "=\nThis article ";

    boiler2 = " an [" + "[Wikipedia:Articles for deletion|Articles for Deletion]" + "] debate. The discussion can be found [" + "[Wikipedia:Articles for deletion/{" + "{subst" + ":PAGENAME}" + "}|here]" + "]. ~" + "~" + "~" + "~";

    if(result == 1)

    edit_summary_watch(boiler1 + "survived" + boiler2, document.editform.wpSummary.value + "link to AfD", false, 1);

    else if (result == 2)

    edit_summary_watch(boiler1 + "was merged with and redirected to \'\' \'\' as a result of" + boiler2, document.editform.wpSummary.value + "link to AfD", true, 1);

    else if (result == 3)

    edit_summary_watch(boiler1 + "was redirected to \'\'[\[\]\]\'\' as a result of" + boiler2, document.editform.wpSummary.value + "link to AfD", true, 1);

    }

    function deletiontags()

    {

    if (document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1)

    {

    if (document.editform.wpTextbox1.value.indexOf("Please do not modify it") == -1)

    {

    add_link2('javascript:vfdvote(1)', 'v - d');

    add_link2('javascript:vfdvote(2)', 'v - k');

    add_link2('javascript:vfdvote(3)', 'v - m');

    add_link2('javascript:vfdvote(4)', 'v - r');

    }

    }

    else if (document.title.indexOf("Editing Wikipedia:Votes for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Pages for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Articles for deletion") == -1 && document.title.indexOf("Editing Talk:") == -1 && document.title.indexOf("Editing User talk:") == -1)

    {

    if((document.editform.wpTextbox1.value.indexOf("["+"[Template:Afd") == -1) &&

    (document.editform.wpTextbox1.value.indexOf("\{\{afd\}\}") == -1))

    add_link2('javascript:vfd()', 'afd');

    add_link2('javascript:copyvio()', 'copyvio');

    }

    else if (document.title.indexOf("Editing Wikipedia:Votes for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Pages for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Articles for deletion") == -1 && document.title.indexOf("Editing Talk:") != -1 && document.title.indexOf("Editing User talk:") == -1)

    {

    add_link2('javascript:vfdtalk(1)','afd - k');

    add_link2('javascript:vfdtalk(2)','afd - m');

    add_link2('javascript:vfdtalk(3)','afd - r');

    }

    }

    function autovfd()

    {

    if (document.title.indexOf('Editing ') == 0)

    {

    var action = '';

    var target = '';

    if (location.search)

    {

    var l = location.search.substring(1).split('&');

    for (var i = 0; i < l.length; ++i)

    {

    var eq = l[i].indexOf('=');

    var name = l[i].substring(0, eq);

    if (name == 'fakeaction')

    action = l[i].substring(eq + 1);

    else if (name == 'faketarget')

    target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');

    }

    }

    if (action == 'vfdlist')

    {

    document.editform.wpTextbox1.value += '{{' + 'subst:afd3|pg=' + target + '}}\n';

    document.editform.wpSummary.value = 'Wikipedia:Articles for deletion/' + target + '';

    document.editform.wpWatchthis.checked = false;

    }

    else if (action == 'vfdsub')

    {

    if (document.editform.wpTextbox1.value.length > 0)

    {

    target = document.editform.action;

    target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'))).replace(/_/g, ' ');

    window.alert("There's an old vfd at the default location already.\n\n" +

    'Please either move it out of the way (and update existing links to it), or file the AfD by hand in another location (such as ' + target + ' (2)).');

    }

    else

    {

    document.editform.wpTextbox1.value += "{{" + "subst:afd2|pg=" + target + "|text=\'\'\'Delete\'\'\'}} ~" + "~" + "~" + "~";

    document.editform.wpSummary.value = 'Nominate';

    document.editform.wpWatchthis.checked = true;

    }

    }

    else

    deletiontags();

    }

    }

    if (window.addEventListener)

    window.addEventListener('load', autovfd, false);

    else if (window.attachEvent)

    window.attachEvent('onload', autovfd);

    // 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;

    }*/

    //////////////////////////////////////

    // Mass checkbox manipulation

    // for version undelete and watchlist

    // by OwenX

    //////////////////////////////////////

    function any_boxes()

    {

    for (i=0; i

    for (j=0; j

    if (document.forms[i].elements[j].type == 'checkbox')

    return true;

    return false;

    }

    function check_all_boxes(act)

    {

    var in_range = false;

    for (i=0; i

    {

    for (j=0; j

    {

    f= document.forms[i].elements[j];

    if (f.type == 'checkbox')

    {

    if (act == 1)

    f.checked = true;

    else if (act == 0)

    f.checked = false;

    else if (act == -1)

    f.checked = !f.checked;

    else if (act == 2)

    {

    if (in_range)

    if (f.checked)

    {

    in_range = false;

    break;

    }

    else

    f.checked = true;

    else if (f.checked)

    in_range = true;

    }

    }

    }

    }

    }

    function do_checkboxing()

    {

    if (any_boxes())

    {

    var c1 = document.getElementById('column-one');

    var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

    addlilink(tabs,'javascript:check_all_boxes(1)', 'Check all');

    addlilink(tabs,'javascript:check_all_boxes(0)', 'Uncheck all');

    addlilink(tabs,'javascript:check_all_boxes(-1)', 'Invert all');

    addlilink(tabs,'javascript:check_all_boxes(2)', 'Fill range');

    }

    }

    function do_warn_stuff()

    {

    var c1 = document.getElementById('column-one');

    var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

    var rcol = document.getElementById('bodyContent').getElementsByTagName('td').item(1);

    if (rcol != null)

    {

    var vandalname = rcol.getElementsByTagName('a')[2].innerHTML;

    var page = document.title.substring (0, document.title.length - 35);

    addlilink(tabs,'http://en.wikipedia.org/w/index.php?title=User_talk:' + vandalname + '&action=edit&fakefrom=' + escape(page), 'Warn');

    }

    }

    function do_onload()

    {

    if (document.title.indexOf('View and restore deleted pages') == 0 ||

    document.title.indexOf('My watchlist') == 0)

    do_checkboxing();

    if (document.getElementById('contentSub').innerHTML.indexOf("(Difference between revisions)")>-1)

    do_warn_stuff();

    if (document.title.indexOf('Block user') == 0) // could stand to be more robust

    do_blockip_stuff();

    if(!document.getElementById) return;

    // add a clock

    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];

    addlilink(toplinks, '#', '', 'utcdate');

    showtime();

    morelinks();

    }

    if (window.addEventListener)

    window.addEventListener("load", do_onload, false);

    else if (window.attachEvent)

    window.attachEvent("onload", do_onload);

    // ##### begin various mods from Essjay's monobook #####

    function addTab(url, name, id, title, key){

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

    addlilink(tabs, url, name, id, title, key);

    }

    // Adds "block" and "blocklog" tabs to User: and User talk: pages.

    function add_block_tab(){

    var c1 = document.getElementById('column-one');

    var tabs = document.getElementById('p-cactions').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

    addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block');

    // add "blocklog" tab

    addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');

    // add "unblock" tab

    addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');

    // add "contributions" tab

    addTab('/wiki/Special:Contributions/' + editlk, 'con');

    // add "edit count" tab

    addTab('http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'count');

    // add "whois" tab

    addTab('http://www.samspade.org/t/lookat?a=' + editlk, 'who');

    // add "proxycheck" tab

    //addTab('http://quyme.com/proxycheck.php?ip=' + editlk, 'proxy');

    }

    function morelinks()

    {

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

    if(document.title.indexOf("User:") == 0)

    {

    addlimenu(tabs, 'User functions', 'userf');

    var userf = document.getElementById('userf').getElementsByTagName('ul')[0];

    var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;

    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);

    // format: addlilink(userf, url, name);

    // add "block" tab

    addlilink(userf, '/wiki/Special:Blockip/' + editlk, 'block user');

    // previous: addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block', '');

    // add "blocklog" tab

    addlilink(userf, '/wiki/Special:Log/block?page=User:' + editlk, 'block log', '');

    // addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');

    // add "unblock" tab

    addlilink(userf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock', '');

    // addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');

    // add "contributions" tab

    addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contribs', '');

    // addTab('/wiki/Special:Contributions/' + editlk, 'con');

    // add "user log" tab

    addlilink(userf, '/w/index.php?title=Special:Log&type=&user=' + editlk, 'user log', '');

    // add "edit count" tab

    addlilink(userf, 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'editcount', '');

    // addTab('http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'count');

    // add "whois" tab

    addlilink(userf, 'http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'whois', '');

    // addTab('http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'who');

    }

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

    if(document.title.indexOf("User talk:") == 0)

    {

    addlimenu(tabs, 'User functions', 'userf');

    var userf = document.getElementById('userf').getElementsByTagName('ul')[0];

    var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;

    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);

    // format: addlilink(userf, url, name);

    // add "block" tab

    addlilink(userf, '/wiki/Special:Blockip/' + editlk, 'block user');

    // previous: addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block', '');

    // add "blocklog" tab

    addlilink(userf, '/wiki/Special:Log/block?page=User:' + editlk, 'block log', '');

    // addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');

    // add "unblock" tab

    addlilink(userf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock', '');

    // addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');

    // add "contributions" tab

    addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contribs', '');

    // addTab('/wiki/Special:Contributions/' + editlk, 'con');

    // add "user log" tab

    addlilink(userf, '/w/index.php?title=Special:Log&type=&user=' + editlk, 'user log', '');

    // add "edit count" tab

    addlilink(userf, 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'editcount', '');

    // addTab('http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'count');

    // add "whois" tab

    addlilink(userf, 'http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'whois', '');

    // addTab('http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'who');

    }

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

    if(document.title.indexOf("Editing User talk:") == 0)

    {

    addlimenu(tabs, 'User functions', 'userf');

    var userf = document.getElementById('userf').getElementsByTagName('ul')[0];

    var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;

    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);

    // format: addlilink(userf, url, name);

    // add "block" tab

    addlilink(userf, '/wiki/Special:Blockip/' + editlk, 'block user');

    // previous: addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block', '');

    // add "blocklog" tab

    addlilink(userf, '/wiki/Special:Log/block?page=User:' + editlk, 'block log', '');

    // addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');

    // add "unblock" tab

    addlilink(userf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock', '');

    // addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');

    // add "contributions" tab

    addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contribs', '');

    // addTab('/wiki/Special:Contributions/' + editlk, 'con');

    // add "user log" tab

    addlilink(userf, '/w/index.php?title=Special:Log&type=&user=' + editlk, 'user log', '');

    // add "edit count" tab

    addlilink(userf, 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'editcount', '');

    // addTab('http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'count');

    // add "whois" tab

    addlilink(userf, 'http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'whois', '');

    // addTab('http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'who');

    }

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

    if(document.title.indexOf("Editing User:") == 0)

    {

    addlimenu(tabs, 'User functions', 'userf');

    var userf = document.getElementById('userf').getElementsByTagName('ul')[0];

    var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;

    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);

    // format: addlilink(userf, url, name);

    // add "block" tab

    addlilink(userf, '/wiki/Special:Blockip/' + editlk, 'block user');

    // previous: addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block', '');

    // add "blocklog" tab

    addlilink(userf, '/wiki/Special:Log/block?page=User:' + editlk, 'block log', '');

    // addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');

    // add "unblock" tab

    addlilink(userf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock', '');

    // addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');

    // add "contributions" tab

    addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contribs', '');

    // addTab('/wiki/Special:Contributions/' + editlk, 'con');

    // add "user log" tab

    addlilink(userf, '/w/index.php?title=Special:Log&type=&user=' + editlk, 'user log', '');

    // add "edit count" tab

    addlilink(userf, 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'editcount', '');

    // addTab('http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + editlk, 'count');

    // add "whois" tab

    addlilink(userf, 'http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'whois', '');

    // addTab('http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'who');

    }

    }

    if ( document.createElement && window.addEventListener )

    {

    function SoFixItLoad() //post-load

    {

    }

    function SoFixItInit() // pre-load, (don't want to slow down loading of article's content, though)

    {

    UserMenu = new PortletMenu( 'p-personal' );

    PageMenu = new PortletMenu( 'p-cactions' );

    NavMenu = new PortletMenu( 'p-navigation' );

    //ToolMenu = new PortletMenu( 'p-tb' );

    // This is inefficient and not particularly robust.

    // This comes first, I want this link to come up as

    // fast as possible.

    //

    function GetByClass( sElem, sClass )

    { var i, a2 = [], a = document.getElementsByTagName( sElem );

    for ( i = 0; i < a.length; i++ )

    if ( a[ i ].className == sClass )

    a2.push( a[ i ] );

    return a2;

    }

    var a, td = GetByClass( 'td', 'diff-otitle' );

    //if ( ( td = td[ 0 ] ) && ( a = td.getElementsByTagName( 'a' )[ 0 ] ) )

    // a.href = a.href + '&action=edit'; // need to change text, later

    var userName = UserMenu.getText( 'pt-userpage' );

    UserMenu.setText( 'pt-mytalk' , 'Talk' );

    UserMenu.setText( 'pt-preferences', 'Prefs' );

    UserMenu.setText( 'pt-watchlist' , 'Watchlist' );

    UserMenu.setText( 'pt-mycontris' , 'Contribs' );

    UserMenu.setText( 'pt-logout' , 'Log out' );

    if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable

    PageMenu.setText( 'ca-talk' , 'talk' );

    PageMenu.setText( 'ca-edit' , 'edit' );

    PageMenu.setText( 'ca-history' , 'history' );

    PageMenu.setText( 'ca-delete' , 'delete' );

    PageMenu.setText( 'ca-watch' , 'watch' );

    PageMenu.setText( 'ca-protect' , 'protect' );

    }

    function PortletMenu( id ) // constructor

    {

    this.menu = document.getElementById( id );

    this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "

    Views
    ", etc.

    var LIs = this.list.getElementsByTagName( 'li' );

    for ( var i = 0; i < LIs.length; i++ )

    {

    this[ LIs[ i ].id ] = LIs[ i ];

    }

    this.newItem = function( id, txt, url )

    { var li = document.createElement( 'li' ); li.id = id;

    var a = document.createElement( 'a' ); a.href = url;

    a.appendChild( document.createTextNode( txt ) );

    li.appendChild( a );

    alert("trying " + id + " at 831");

    this[ id ] = li; // watch this!!!

    return li;

    }

    this.append = function( id, txt, url )

    { this.list.appendChild( this.newItem( id, txt, url ) );

    }

    this.insertBefore = function( old, id, txt, url )

    { this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] );

    }

    // the ByTagName here is a bit annoying, but in Safari, I was picking

    // up TextNodes by using this[ id ].firstChild.firstChild

    //

    this.getText = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data }

    this.setText = function( id, txt ) { if(!this[id]){return;} this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt }

    this.getHref = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href }

    this.setHref = function( id, url ) { if(!this[id]){return;} this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url }

    // I add em as I need em....

    }

    function RemoveNode( id )

    { var node = document.getElementById( id )

    node.parentNode.removeChild( node );

    }

    SoFixItLoad();

    window.addEventListener( 'load', SoFixItInit, false );

    }

    function showtime()

    {

    var timerID;

    var now = new Date();

    var timeValue = now.toUTCString().replace(/GMT/, "UTC");

    document.getElementById('utcdate').firstChild.innerHTML = timeValue;

    timerID = setTimeout('showtime()', 100);

    }

    function addlimenu(tabs, name, id)

    {

    var na = document.createElement('a');

    na.href = '#';

    var mn = document.createElement('ul');

    na.appendChild(document.createTextNode(name));

    var li = document.createElement('li');

    li.id = id;

    li.className = 'tabmenu';

    li.appendChild(na);

    li.appendChild(mn);

    tabs.appendChild(li);

    return li;

    }

    // User:Lupin/popups.js - please include this line

    mw.loader.load(

    'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'

    + '&action=raw&ctype=text/javascript&dontcountme=s');

    // Filter changes live

    // User:Lupin/recent2.js - please include this line

    mw.loader.load(

    'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'

    + '&action=raw&ctype=text/javascript&dontcountme=s');

    popupFixDabs=true;

    popupFixRedirs=true;

    popupAdminLinks=true;

    function inc (file) {

    mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s');

    }

    inc("User:Topaz/init.js");

    inc("User:Topaz/util.js");

    inc("User:Topaz/comm.js");

    inc("User:Topaz/wputil.js");

    inc("User:Prodego/statuschanger.js");

    inc("User:Interiot/Tool2/code.js");

    inc("User:Prodego/AFDclose.js");

    function topaz_extratoolbarbuttons() {

    topaz.wputil.addsidepanelbutton("p-tb", "Page log",

    'http://en.wikipedia.org/w/index.php?title=Special:Log&page='+topaz.wputil.pagename()

    );

    topaz.wputil.addsidepanelbutton("p-tb", "Purge",

    'http://en.wikipedia.org/w/index.php?title='+topaz.wputil.pagename()+'&action=purge'

    );

    }

    if (window.addEventListener)

    window.addEventListener('load', topaz_extratoolbarbuttons, false);

    else if (window.attachEvent)

    window.attachEvent('onload', topaz_extratoolbarbuttons);

    //