Privacy Policy Cookie Policy Terms and Conditions User:91BOY/monobook.js - Wikipedia, the free encyclopedia

User:91BOY/monobook.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

// <pre><nowiki>[[User:Lupin/popups.js]]

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// <pre><nowiki>//<pre><nowiki>
//--------------------------------------------------------------
//First loads
//Helper tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//////////////////////

//Admin rollback tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//BCrat tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Bureaucrat/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
RfAshowlinks = 'true';
//END
//CU tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/CheckUser/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//UTC clock
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/UTCclock.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Admin protection tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Approvals
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Approvals.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Replace txt
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/replacetxt.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END</nowiki></pre>

//<nowiki><pre>
//---------------------------------------------------------------
//Toolbox links
function changelinks()
{
    if(!document.getElementById) return;
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;
 if (document.title.indexOf('User:' + user_name + '/xml') != -1 || document.title.indexOf('User:' + user_name + '/XML') != -1)
    {addlilink(toplinks, 'javascript:XMLrequestprompt()', 'Request XML', 'Request XML');}
    document.getElementById('pt-mytalk').firstChild.innerHTML = 'my Talk page';
    document.getElementById('pt-preferences').firstChild.innerHTML = 'Change Preferences';
    document.getElementById('pt-watchlist').firstChild.innerHTML = 'Check my Watchlist';
    document.getElementById('pt-mycontris').firstChild.innerHTML = 'My Contributions';
    document.getElementById('pt-logout').firstChild.innerHTML = 'Log out';
    if(document.getElementById('ca-delete'))
      {document.getElementById('ca-delete').firstChild.innerHTML = '<strong><span style="color:darkred;">delete</span></strong>';} 
}

function navigationlinks()
{
    addnavbox_link('/wiki/Wikipedia:Administrator_intervention_against_vandalism','Vandalism','aiv-ln');
    addnavbox_link('/wiki/Category:Candidates_for_speedy_deletion','Speedy deletions','speedy-ln');
    addnavbox_link('/wiki/Wikipedia:Requests for page protection','Protection requests','rfpp-ln');
    addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard','Noticeboard','AN-ln');
}

function addtoolboxlinks()
 {
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, '/wiki/Special:Newpages', 'New pages', '');
    addlilink(tb, '/wiki/Special:Log/newusers', 'New users', '');
    addlilink(tb, '/wiki/WP:PP', 'Protected pages', '');
}
//END
//---------------------------------------------------------------

// ======== USER TABS =======
function userlogs()
{
//no subpages or history
   if (document.title.search("/") != -1 || location.href.search(/Special:|&action=[^p]|&diff=/) !=-1)
   {return;}
   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) 
   {
      username_a = document.URL.match(/:.*:(.*)/);
      username=username_a[1];
      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username, "log", "ca-blog", "block log", "");
      addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "info", "ca-kate", "user info", "");
   }
}
//************

//************
//LAST DIFF TAB
function lastdiff() 
    {
    if (document.title.indexOf("Editing ") != -1 || document.getElementById('ca-history') == undefined || location.href.search(/&action=history/) !=-1)
    {return;}
    z=document.getElementById("content").childNodes;
    for (var n=0;n<z.length;n++) { 
      if (z[n].className=="firstHeading") 
      {
  var pname=document.title.split(' - ')[0].replace(/&/g,'%26').replace(/\\+/g, '%2B');
      }
    }
addTab("http://en.wikipedia.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", "Last", "ca-diff", "Show most recent diff", "");
}

// This will add an [edit top] link at the top of all pages except preview pages
function addtoplink()
{
var edittop = '<span style="color:black;">[</span>edit top<span style="color:black;">]</span>';
  // if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return;
  if(document.title.indexOf("Main Page") != -1) return;

  // get the page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); 

  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:130px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">' + edittop + '</a></div>';

  // insert divContainer into the DOM before the h1
if (document.getElementById("content") !=undefined) {
  document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);}
}
//END

//************
//MAIN
//************

addOnloadHook(Mainfast)
function Mainfast() 
{
    userlogs();
    changelinks();
    navigationlinks();
    addtoolboxlinks();
}

window.onload = Main;
function Main() 
{
    block_check();
    lastdiff();
    addtoplink();
}
//END
//************

function block_check()
{
if (document.title.indexOf('Block user') !=0){return;}
  //monobook
  if (document.getElementById('pt-userpage'))
     {var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;}
  //cologneblue
  else if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
      {
      var toplinks = document.getElementById('quickbar');
      var user_name = toplinks.innerHTML.split('<h6>My pages</h6>')[1].split('title="User:')[1].split('"')[0];
      }
if (document.getElementsByTagName('input')[0].value == user_name)
  {alert('Are you sure you want to block yourself?');}
else if (document.getElementsByTagName('input')[0].value == user_name.replace(/ /g,'_'))
  {alert('Are you sure you want to block yourself?');}
}

//
addOnloadHook(Dfn_js_con)
function Dfn_js_con()
{
Mvaluejs_class = 'DMalak1';
Rvaluejs_class = 'ERollen2';
Uvaluejs_class = 'DRaven2';
}
//

//************
//Slow load tools (written by User:MarkS)
// Script from [[User:MarkS/extraeditbuttons.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/extraeditbuttons.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//New user log tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Admin warning tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Adminwarnings/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Delete tabs
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Deletion/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//************
//Google tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Google/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END

//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); }
//

//************
//Lupin's tools
//************
//Filter changes live [[Category:Wikipedians who use VoA script]]  
//[[User:Lupin/recent2.js]] - please include this line
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//[[User:Lupin/popupsdev.js]] - please include this line 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

popupShortcutKeys=true; // optional: enable keyboard shortcuts
popupAdminLinks=true;   // optional: enable admin links [[Category:Wikipedians who use VoA script]]  
popupSubpopups=false;
popupOnEditSelection=false;
popupStructure='shortmenus';
//END
//************

function XMLrequestprompt()
{
var parameters = '';
var type = 'GET';
var url = location.href;
url = prompt('Enter a URL:');
parse_js_value_cache = 0;
parse_js_value_cache = prompt('Parse the data?' + '\n' + '0 - false (default)' + '\n' + '1 - true (no script/SRCs/images)' + '\n' + '2 - true (no script/SRCs)' + '\n' + '3 - true (script/images allowed)');
if (parse_js_value_cache != 0 && parse_js_value_cache != 1 && parse_js_value_cache != 2 && parse_js_value_cache != 3){return;}
if (!url || url == ''){return;}
makeRequestXML(url, parameters,type);
}

function alertContents()
{
  if (http_request.readyState != 4)
    return;
  body = document.getElementById('bodyContent');
  if (body && parse_js_value_cache == 3)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:"; 
  body.innerHTML = '<strong>XML source return:</strong><br>' + http_request.responseText;
  }
  else if (body && parse_js_value_cache == 2)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:"; 
  var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
  body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">');
  }
  else if (body && parse_js_value_cache == 1)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:"; 
  var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
  body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(<img [^<]+>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">');
  }
  else if (body && parse_js_value_cache == 0)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:";
  var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
  xml = xml.replace(/(<a href=["'][^<]+<.a>)/gi,'%parenST|span style="background-color: yellow"|%parenEN$1%parenST|/span|%parenEN').replace(/(<img [^<]+>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<iframe [^<]+<.iframe>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<script [^`]+)`<.script>/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1</script>%parenST|/span|%parenEN').replace(/(<\w* onload=["'][^<]+["']>)/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1%parenST|/span|%parenEN').replace(/\s(src=["'][^<]+["'])>/gi,'%parenST|span style="background-color: #FF3300"|%parenEN $1>%parenST|/span|%parenEN');
  body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/%parenST\|/g,'<').replace(/\|%parenEN/g,'>');
  }
}

//security override HTTP request
//ALSO, reduce IE security settings
//For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ"
//Basically, enable "signed.applets.codebase_principal_support" in about:config 
function makeRequestXML(url, parameters,type,parse) 
{ 
  if(window.XMLHttpRequest)
  {
try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } 
catch (e) {alert("Permission UniversalBrowserRead denied."); } 
http_request = false;
http_request = new XMLHttpRequest(); 
if (http_request.overrideMimeType) 
{http_request.overrideMimeType('text/xml'); }
if (!http_request) 
{alert('Cannot create XMLHTTP instance'); return false; } 
http_request.onreadystatechange = alertContents;
http_request.open(type, url + parameters, true); 
http_request.send(null); 
  }
  else if (window.ActiveXObject)
  {
    try
    {http_request = new ActiveXObject("Msxml2.XMLHTTP");} 
    catch (e)
     {
      try
      {http_request = new ActiveXObject("Microsoft.XMLHTTP");} 
       catch (e){}
     }
  if (!http_request) {showError(ERROR_XML);}
  http_request.onreadystatechange = alertContents;
  http_request.open(type, url + parameters, true); 
  http_request.send(null); 
  }
}
//

//</nowiki></pre>[[Category:Wikipedians who use VoA script]]  
// install [[User:Cacycle/WikEd]] text diff code
document.write('<script type="text/javascript" src="' 
  + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/WikEd.js' 
  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// install [[User:Pilaf/Live_Preview]] page preview tool
document.write('<script type="text/javascript" src="' 
  + 'http://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js' 
  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// install [[User:Cacycle/wikEd]] edit tool
document.write('<script type="text/javascript" src="' 
  + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js' 
  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//

///* <pre> */

/* 
I am experimenting with including everything using the winc() function, to keep this page clean and allow other people to include the functions they want into their own monobook.js the same way.  Then theirs will be in sync with mine when I update it, etc.  I've done the same with other users' scripts.

Since moving them into other pages, though, it seems to be slower loading/refreshing a page?  I think it's because it's loading scripts from multiple pages.

I am putting my scripts in a subpage of monobook.js instead of a subpage of User:Omegatron, since it gives a link back to the main monobook.js.  Convenient and logical (even if the address looks a little funny).

If you know of a better way to do one of these functions or improve on one that I've written, please let me know.

There's a script here that makes all the [[wikilinks]] in this page (and everywhere else) clickable, even in plain text mode.
*/  


/* This function is used to include scripts from other Wikipedia pages in mine.  I got it from [[User:Quarl/monobook.js]]. */

function winc(s) {
    s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
    document.write('<scr' + 'ipt type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=' + s
             + '&action=raw&ctype=text/javascript&dontcountme=s"></scr' 
             + 'ipt>');
}


/* Included functions */

winc('[[User:Omegatron/monobook.js/addlink.js]]');         /* Adds links to lists on the page, such as the personal tools section */
winc('[[User:Omegatron/monobook.js/fixdiffwidth.js]]');    /* Cleans up the diff so that long lines don't explode the width of the page. */
winc('[[User:Omegatron/monobook.js/edittop.js]]');         /* Adds a link to edit the top (intro) section of an article */
winc('[[User:Omegatron/monobook.js/namedredirect.js]]');   /* Learning XMLHttpRequest while workarounding [[Bugzilla: 218]] */
/*winc('[[User:Omegatron/monobook.js/autolinker.js]]');      Make [[links]] and {{templates}} clickable */


/* Add some extra tabs with different functionalities. */

winc('[[User:Omegatron/monobook.js/replacetab.js]]');               // Regex replacements in the text (from [[User:Trilobite/Tools]])
winc('[[User:Omegatron/monobook.js/unverified.js]]');               // Tag unverified images (from [[User:Trilobite/Tools]])
// winc('[[User:Omegatron/monobook.js/addsincetab.js]]');           // Shows difference between my last edit and current version ([[Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited]])
winc('[[User:Omegatron/monobook.js/dashfixer.js]]');                // Converts -- into — and so on (User:Omegatron)
winc('[[User:Omegatron/monobook.js/unitformatter.js]]');            // Formats units according to SI (User:Omegatron)
winc('[[User:Omegatron/monobook.js/mathcharacterfixer.js]]');       // Fixes up some math characters (not TeX) (User:Omegatron)
winc('[[User:Omegatron/monobook.js/headingformattingfixer.js]]');   // Adds and removes whitespace to make formatting consistent and readable (User:Omegatron)


/* This function is used to include individual scripts from Quarl's pages in mine. */

function qinc(s) {
    document.write('<scr' + 'ipt type="text/javascript" src="' 
             + 'http://wikipedia.quarl.org/scripts/' + s
             + '.js"></scr' 
             + 'ipt>');
}



/* All kinds of scripts from [[User:Quarl]] */

qinc('module');
qinc('datetime');
qinc('msg');
qinc('util');
qinc('wikiwidget');
qinc('wikins');
qinc('wikipage');
qinc('wikiedit');
qinc('diff');
qinc('shortcuts');
qinc('diffsince');
qinc('wikiwatch');
qinc('watchlist');
qinc('watchbutton');
qinc('autofocus');
qinc('autosummary');
qinc('smartsubmit');
qinc('newmessages');
qinc('tabsince');

addOnloadHook(function () {

$watchbutton.widgetLoad(); 
$tabsince.widgetLoad();
$watchlist.widgetLoad();

/* [[User:Omegatron/monobook.js/quarl.js]] */

/* uncomment this to hide alert() errors */
$msg.alert_disabled=true;

});

/* Live Preview */

wpUserName   = 'Omegatron';   // User name to display in signatures
wpShowImages = true;      // Enable downloading and displaying of images

winc('[[User:Pilaf/livepreview.js]]');

// Now set everything up
/* Convert to addonloadhook?  Can't because function doesn't exist yet. */
window.onload = Main;
function Main()
{
 LivePreviewInstall();
 // You may include here other "extensions"
}


/* [[User:Lupin]]'s crazy [[Wikipedia:Tools/Navigation_popups|navigation popups]] */
/* I haven't used this lately, but maybe I'll turn it back on later. */

/*
winc('[[User:Lupin/popupsdev.js]]');
popupDelay=1;
popupAdminLinks=true;
imagePopupsForImages=false;
popupSubpopups=true;
*/

/* Move things around so that sidebar can be fixed in position and content can scroll independently */
/* See [[meta:Help:User style/floating quickbar]] */

addOnloadHook(function () {
    var content = document.getElementById("column-content");    // Find the main content column

    var footer = document.getElementById("footer");  // Find the footer
    footer.parentNode.removeChild(footer);    // Remove the footer from the global wrapper
    content.appendChild(footer);    // Place footer at the end of the content column;

    var tabs = document.getElementById("p-cactions");   // Find the top tab list
    tabs.parentNode.removeChild(tabs);    // Remove the tab list from the side column
    content.insertBefore(tabs,content.firstChild);    // Place tab list at the beginning of the content column
});

/* Do some things when the page loads */

addOnloadHook(function () {

    /* Adds some links to my ''personal tools'' section ("My monobook.js", "My monobook.css", "My sandbox") */

    addLink('p-personal', '/wiki/User:91BOY/monobook.js', 'My monobook.js', 'pt-monobookjs', 'monobook.js is used for storing user javascripts', '', 'pt-logout');
    addLink('p-personal', '/wiki/User:91BOY/monobook.css', 'My monobook.css', 'pt-monobookcss', 'monobook.css is used for storing user CSS styles', '', 'pt-logout');
    addLink('p-personal', '/wiki/User:91BOY/Sandbox', 'My sandbox', 'pt-sandbox', 'My sandbox is used for testing things', '', 'pt-logout');
    addLink('p-personal', '/w/index.php?title=Special%3AAllpages&from=91BOY&namespace=2', 'My subpages', 'pt-subpages', 'Subpages of my userspace', '', 'pt-logout');

    /* Shorten "edit this page" to just "edit" */
    if(document.getElementById('ca-edit')) {
        document.getElementById('ca-edit').firstChild.innerHTML = 'edit';
    }

});


/* Duplicate all the tabs from the top on the bottom of the content box, too.  */
/* From [[Wikipedia:WikiProject User scripts/Scripts/Duplicate tabs at bottom]]. */

addOnloadHook(function () {
    var tabs = document.getElementById('p-cactions').cloneNode(true);
    tabs.id = 'mytabs';
    var listitems = tabs.getElementsByTagName('LI');
    for (i=0;i<listitems.length;i++) {
        if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
    }

    var content = document.getElementById("content");    // Find the content div
    content.parentNode.insertBefore(tabs, content.nextSibling);    // Place tab list right after content div
});


/* Syntax highlighting on pre areas */
/* See [[Wikipedia:WikiProject User scripts/Scripts/Syntax highlighter]] */

addOnloadHook(function () {
    /* CSS syntax highlighting */
    if(document.title.indexOf(".js") == -1) {         //   Ignore pages that end in .js 
        var multicommentRE = new RegExp('(/\\*[\\s\\S]*?\\*/)', 'g');
        var ruleRE = new RegExp('([^\\{]+)\\{([^\\}]+)\\}', 'g');
        var idselectorRE = new RegExp('(#[a-zA-Z0-9\-\_]+)\\b', 'g');
        var classselectorRE = new RegExp('(\\.[a-zA-Z0-9\-\_]+)\\b', 'g');
        var pairRE = new RegExp('([a-zA-Z-]+):([^;]+);', 'g');
        var css = document.getElementsByTagName('pre');
        for (i = 0; i < css.length; i++) {
            var c = css[i];
            var content = c.innerHTML;
            content = content.replace(multicommentRE, '<span class="comment">$1</span>');
            content = content.replace(ruleRE, function(text, selector, body) {
                selector = selector.replace(idselectorRE, '<span class="idselector">$1</span>');
                selector = selector.replace(classselectorRE, '<span class="classselector">$1</span>');
                body = body.replace(pairRE, '<span class="property">$1</span>:<span class="value">$2</span>;');
                return selector + '{' + body + '}';
            });
            c.innerHTML = content;
        }
    } 
});

/* Popup audio help links */

document.write('<scr' + 'ipt type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Omegatron/monobook.js/audiopops.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s"></scr' 
             + 'ipt>');




/** <nowiki>
 * A javascript edit counter, using query.php as the backend
 *
 * Usage instructions for popups users: add
 *

{{subst:js|User:Lupin/editcount.js}}
popupEditCounterTool='custom';
popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1';

 *
 * to your user javascript file (usually monobook.js), hover over a
 * user name and select "edit counter"
 *
 */

//<pre>

ec = {

 getParamValue: function(paramName) {
 var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
 var h=document.location;
 var m;
 if (m=cmdRe.exec(h)) {
 try {
 while(m[1].indexOf('+')!=-1)
 {
 m[1]=m[1].substr(0,m[1].indexOf('+'))+" "+m[1].substr(m[1].indexOf('+')+1);
 }
 return decodeURIComponent(m[1]);
 } catch (someError) {}
 }
 return null;
 },

 doEditCount: function(user) {
 if (!user) { return; }
 ec.user=user;
 ec.makeEditCountDivs();
 ec.getContribs(user);
 setTimeout(ec.checkContribs, 1000);
 },
 makeEditCountDivs: function() {
 var d=document.createElement('div');
 d.id='editcount_output';
 ec.appendDivs(d, [ 'editcount_title', 'editcount_intervalselector', 
    'editcount_stats' ]);
 var h=document.getElementById('siteSub');
 h.parentNode.insertBefore(d, h.nextSibling);
 },
 appendDivs: function(parent, list) {
 for (var i=0; i<list.length; ++i) {
 var d=document.createElement('div');
 d.id=list[i];
 parent.appendChild(d);
 }
 },

 checkContribs: function() {
 if (ec.complete) {
 ec.doOutput();
 } else {
 ec.doStatus();
 setTimeout(ec.checkContribs, 1000);
 }
 },

 doOutput: function(start, end) {
 var d=document.getElementById('editcount_stats');
 if (!ec.count) {
 d.innerHTML='No edits found for ' + ec.user;
 return;
 }
 if (!this.intsel) {
 this.intsel = new IntervalSelector({
 min: ts2unix(this.editlist.first.next.key),
 max: ts2unix(this.editlist.last.prev.key)});
 var this2=this;
 this.intsel.doneDrag=function() {
 //document.title=[this.lo, this.hi];
 this2.doOutput.apply(this2, map(unix2ts, [this.lo, this.hi]));
 };
 this.intsel.dragging=function() {
 var start=unix2ts(this2.intsel.lo);
 var end=unix2ts(this2.intsel.hi);
 document.getElementById('editcount_range').innerHTML=
 formatTs(start) + ' - ' + formatTs(end);
 };
//this.intsel.dragging=this.intsel.doneDrag; // too slow - pretty cool tho
 var intdiv=document.getElementById('editcount_intervalselector');
 intdiv.appendChild(this.intsel.box);
 this.appendDivs(intdiv, ['editcount_range']);
 this.intsel.dragging();
 this.intseldebug=document.createElement('div');
 this.intsel.box.parentNode.insertBefore(this.intseldebug, this.intsel.box);
 }
 document.getElementById('editcount_title').innerHTML=ec.outputHeading();
 document.getElementById('editcount_stats').innerHTML='<p>Total: ' + 
 ec.countFigure() + '<br>First edit: ' + ec.firstEdit.replace(/[TZ]/g, ' ') + 
 '(UTC)' + ec.statsTable(start, end);
 },

 outputHeading: function() {
 return '<h2>Edit count for ' + ec.user + '</h2>';
 },

 doStatus: function() {
 var d=document.getElementById('editcount_stats');
 d.innerHTML=ec.outputHeading() + '<p>Downloaded ' + ec.countFigure() + ' so far' + ec.statsTable();
 },

 countFigure: function() {
 return ec.count + ' edits over ' + objSum(ec.namespaces, 'articleCount') +  ' pages';
 },

 findEdit: function(timestamp, up) { // this is very broken - FIXME!
 if (up) {
 var e=this.editlist.first;
 while(e.key<timestamp && (e=e.next)){};
 //console.log('findEdit, up: got '+timestamp+', found '+(e.prev && e.prev.key || null) );
 return e.prev;
 } else {
 var e=this.editlist.last;
 while(e.key>timestamp && (e=e.prev)){}
 //console.log('findEdit, down: got '+timestamp+', found '+(e.next && e.next.key || null) );
 return e.next;
 }
 },

 statsTable: function(start, end) {
 //console.log('start: '+start + ', end: '+end);
 var barTotal=400;
 var endEdit=this.findEdit(end) || this.editlist.last;
 var startEdit=this.findEdit(start,true);
 if (!startEdit || !startEdit.key) { startEdit=this.editlist.first.next; }
 //console.log('endEdit:' + endEdit.key);
 //console.log('startEdit:'+ startEdit.key);
 var sumValue=function(val) {
 return objSum(startEdit.stats, val) - objSum(endEdit.stats, val);
 }
 var total=sumValue('count');
 if (!total) { return ''; }
 var statValue=function(k, val) {
 if (!startEdit.stats[k]) { return 0; }
 var r=startEdit.stats[k][val];
 //console.log(k + ' ' + val + ': ' + r);
 if (!endEdit.stats[k] || !endEdit.stats[k][val]) { return r; }
 return r - endEdit.stats[k][val];
 };
 // FIXME: abstract this away so it's trivial to add new columns
 r='<p>Statistics between '+formatTs(startEdit.key) + ' and '+formatTs(endEdit.key);
 r+='<table><tr><th>' + ['Namespace',
    'New',
    'Minor',
    'Top',
    'Summaries',
    '(manual)',
    'Pages',
    'Count', '%'].join('</th><th>') + '</th></tr>';
 for (var k in ec.namespace_names) {
 if (!ec.namespaces[k]) { continue; }
 r += '<tr><td>'+[ec.namespace_names[k],
  statValue(k, 'newCount'),
  statValue(k, 'minorCount'),
  statValue(k, 'topCount'),
  statValue(k, 'commentCount'),
  statValue(k, 'manualCommentCount'),
  statValue(k, 'articleCount'),
  statValue(k, 'count'),
  percent(statValue(k, 'count'), total)].join('</td><td>') + '</td>';
 r+=ec.ecBar(barTotal, total, statValue(k, 'count'), statValue(k, 'minorCount') || 0);
 r+='</tr>';
 }
 var totalMinor = sumValue('minorCount');
 r+='<tr><td>'+['<b>Total</b>',
        sumValue('newCount'),
        totalMinor,
        sumValue('topCount'),
        sumValue('commentCount'),
        sumValue('manualCommentCount'),
        sumValue('articleCount'),
        sumValue('count'),
        '100'].join('</td><td>') + '</td>';
 r+=ec.ecBar(barTotal, total, sumValue('count'), totalMinor);
 r+='</table>';
 return r;
 },

 histogramBar: function(value, scale, colour, hint) {
 var height='2ex';
 var style='height: '+ height;
 style += '; background: ' + colour;
 style += '; width: ' + value * scale + 'px';
 style += '; float: left;';
 return '<span style="' + style + '" title="' + hint + '"></span>';
 },

 histogramCell: function(scale, values) {
 var r='<td><div style="width: ' + scale + 'px;">';
 for (var i=0; i<values.length; i+=3) { r+=ec.histogramBar(values[i], scale, values[i+1], values[i+2]); }
 r+='</div></td>';
 return r;
 },

 ecBar: function(scale, total, count, minor) {
 var nonMinorColour='blue';
 var minorColour='#0A3';
 return ec.histogramCell( scale, [(count-minor)/total, nonMinorColour, "non-minor edits",
  minor/total, minorColour, "minor edits"]);
 },

 ajax: {
 download:function(bundle) {
 // mandatory: bundle.url
 // optional:  bundle.onSuccess (xmlhttprequest, bundle)
 // optional:  bundle.onFailure (xmlhttprequest, bundle)
 // optional:  bundle.otherStuff OK too, passed to onSuccess and onFailure

 var x = window.XMLHttpRequest ? new XMLHttpRequest()
 : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
 : false;

 if (x) {
 x.onreadystatechange=function() {
 x.readyState==4 && ec.ajax.downloadComplete(x,bundle);
 };
 x.open("GET",bundle.url,true);
 x.send(null);
 }
 return x;
 },

 downloadComplete:function(x,bundle) {
 x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
 || ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText));
 }
 },


 getContribs: function(user, startAt) {
 var limit=500; // currently maximum allowed per page by query.php
 var url='http://en.wikipedia.org/w/query.php?what=usercontribs' +
 '&uccomments' +  // enable for edit comment analysis
 '&format=json&uclimit=500&titles=User:'+escape(user);
 if (startAt) { url += '&ucend=' + startAt.replace(/[^0-9]/g, ''); }
 ec.ajax.download({ url: url, user: user,
    startAt: startAt, onSuccess: ec.readContribs,
    limit: limit});
 },

 readContribs: function(dl, bundle) {
 window.dl=dl;
 window.bundle=bundle;
 try {
 eval('var jsobj=' + dl.responseText);
 var pages=jsobj.pages;
 var child=ec.anyChild(pages);
 var contribs=child.contributions;
 } catch (summat) {
 throw new Error('Badness happened in readContribs: ' + summat.message);
 return;
 }
 var i=0, j=0;
 var minrev=null;
 for (var c in contribs) {
 ++i;
 var cc=contribs[c];
 if (!minrev || cc.revid < minrev) { minrev = cc.revid; }
 if (ec.edits[cc.revid]) { continue; }
 ++j;
 ec.doStats(cc);
 ec.edits[cc.revid] = cc;
 }
 ec.count += j;
 if (i == bundle.limit && ec.edits[minrev]) {
 ec.getContribs(bundle.user, ec.edits[minrev].timestamp);
 } else {
 ec.complete=true;
 minrev && (ec.firstEdit=ec.edits[minrev].timestamp);
 }
 },

 doStats: function (c) {
 var k=c.ns || 0;
 //if (!ec.namespaces[k]) { console.log('New namespace: '+k + ', title=' +c['*'] +
 // ', alleged NS=' + ec.namespace_names[k]); }
 if (!ec.namespaces[k]) { ec.namespaces[k] = {articles: {}}; }
 var n = ec.namespaces[k];
 incr(n, 'count');
 if (!n.articles[c['*']]) { incr(n, 'articleCount'); }
 incr(n.articles, c['*']);
 if (typeof c.minor != 'undefined') { incr(n, 'minorCount'); }
 if (typeof c.top != 'undefined') { incr(n, 'topCount'); }
 if (typeof c['new'] != 'undefined') { incr(n, 'newCount'); }
 if (c.comment) {
 incr(n, 'commentCount');
 if (!RegExp("^/[*].*?[*]/ *$").test(c.comment)) {
 incr(n, 'manualCommentCount');
 }
 }
 this.editlist.add({key: parseInt(c.timestamp.replace(/[^0-9]/g, ''), 10),
    edit: c,
    stats: this.saveStats()});
 // more stuff here, perhaps
 },

 saveStats: function() {
 var r={};
 var list=['count', 'articleCount', 'minorCount', 'topCount',
   'newCount', 'commentCount', 'manualCommentCount'];
 for (var k in ec.namespaces) {
 r[k]=getStuff(ec.namespaces[k],list);
 }
 return r;
 },

 anyChild: function(obj) {
 for (var p in obj) {
 return obj[p];
 }
 return null;
 },

 edits: {},
 count: 0,
 complete: false,
 namespaces: {},
 namespace_names: {0: 'Article', 1: 'Talk',
   2: 'User', 3: 'User talk',
   4: 'Wikipedia', 5: 'Wikipedia talk',
   6: 'Image', 7: 'Image talk',
   8: 'MediaWiki', 9:'MediaWiki talk',
   10: 'Template', 11: 'Template talk',
   12: 'Help', 13: 'Help talk',
   14: 'Category', 15: 'Category talk',
   100: 'Portal', 101: 'Portal talk' // no comma
 },
 firstEdit: 0,
 editlist: new linkedList(
 {key: 99990101011200, stats: {}},
 {key: 0, stats: {}}),

 dummy: null // no comma
};


window.incr=function(obj, key) {
 if (!obj[key]) { obj[key]=1; }
 else { obj[key]++; }
}

window.objSum=function(obj, x, y) {
 var r=0;
 if (x && y) { for (var k in obj) { r+= (obj[k][x][y] ? obj[k][x][y] : 0); } }
 else if (x) { for (var k in obj) { r+= (obj[k][x] ? obj[k][x] : 0); } }
 else        { for (var k in obj) { r+= (obj[k] ? obj[k] : 0); } }
 return r;
}

window.percent=function(n, N) {
 return Math.floor(n/N * 1000 + .5)/10;
};

if((user=ec.getParamValue('ectarget'))!==null) { addOnloadHook(function(){ec.doEditCount(user);}); }

function linkedList(x0,y0) {
 this.first=null;
 this.last=null;
 this.hash={};
 this.add=function(x) {
 this.hash[x.key]=x;
 if (!this.first) {
 this.first=x;
 this.last=x;
 x.prev=x.next=null;
 return;
 }
 var k=x.key;
 if (true || k - this.first.key < this.last.key - k) {
 this.pushTop(x);
 } else {
 this.pushTail(x);
 }
 };
 this.pushTop=function(x) {
 if (x.key < this.first.key) {
 this.first.prev=x;
 x.next=this.first;
 this.first=x;
 x.prev=null;
 return;
 }
 if (x.key > this.last.key) {
 this.last.next=x;
 x.prev=this.last;
 this.last=x;
 x.next=null;
 }
 for (var y=this.first; y.next; y=y.next) {
 if (y.key < x.key && x.key <= y.next.key) {
 this.insertAfter(y, x);
 return;
 }
 }
 };
 this.pushTail=function(x) {
 for (var y=this.last; y.prev; y=y.prev) {
 if (y.prev.key < x.key && x.key <= y.key) {
 this.insertAfter(y.prev, x);
 return;
 }
 }
 this.first.prev=x;
 x.next=this.first;
 this.first=x;
 x.prev=null;
 };
 this.insertAfter=function(y,x) {
 x.next=y.next;
 x.prev=y;
 y.next.prev=x;
 y.next=x;
 };
 if (x0) { this.add(x0); }
 if (y0) { this.add(y0); }
}

window.getStuff=function(obj, list) {
 var r={};
 for (var i=0; i<list.length; ++i) {
 if (typeof obj[list[i]] != 'undefined') { r[list[i]]=obj[list[i]]; }
 }
 return r;
}

window.IntervalSelector=function(data) {
 if (!data) { data={}; }
 this.min=data.min || 10;
 this.max=data.max || 100;
 this.span=this.max-this.min;
 this.lo=data.lo || this.min;
 this.hi=data.hi || this.max;
 this.width=data.width || 400;
 this.height=data.height || 20;
 this.scale=this.width/this.span;
 this.minBarWidth=data.minBarWidth || 10;
 this.oldmousemove = null;
 this.createDiv();
}


IntervalSelector.prototype.createDiv=function() {
 var d=document.createElement('div');
 d.className='intervalselectorbox';
 //d.style.position='absolute';
 d.style.border='1px solid black'; // FIXME
 var s=document.createElement('div');
 s.className='intervalselector';
 s.style.position='relative';
 s.style.background='orange'; // FIXME
 //s.style.border='2px solid red'; // FIXME
 d.appendChild(s);
 this.box=d;
 this.bar=s;
 var this2=this;
 this.bar.onmousedown=function(e){ this2.mouseDown.apply(this2, [e]); }
 this.box.onmousedown=function(e){ this2.mouseDown.apply(this2, [e]); }
 this.updatePosition();
};

IntervalSelector.prototype.updatePosition=function() {
 var d=this.box;
 d.style.width=this.width+'px';
 d.style.height=this.height+'px';
 var s=this.bar;
 s.style.left=(this.lo-this.min)*this.scale+ 'px';
 s.style.width=(this.hi-this.lo)*this.scale + 'px';
 s.style.height=this.height + 'px';
};

IntervalSelector.prototype.mouseDown=function(e) {
 var endWidth=8;
 var pos=this.getMousePos(e);
 var this2=this;

 var dragFunction=null;
 var leftPos=findPosX(this.bar);
 if (pos.x - leftPos < endWidth) { dragFunction=this2.dragLo; }
 else if ( leftPos + parseInt(this.bar.style.width, 10) - pos.x < endWidth) { dragFunction=this2.dragHi; }
 else { dragFunction = this2.dragBar; }
 var x=pos.x, lo=this.lo;
 if (document.onmousemove && document.onmousemove.origin != 'IntervalSelector') {
 this.oldmousemove = document.onmousemove;
 }
 document.onmousemove=function(e) {
 dragFunction.apply(this2, [e, x, lo]);
 this2.dragging.apply(this2);
 };
 document.onmousemove.origin='IntervalSelector';
 document.onmouseup=function() {
 //console.log(this2.oldmousemove.toString());
 document.onmousemove= this2.oldmousemove;
 this2.doneDrag.apply(this2);
 };
 document.onmouseup.origin='IntervalSelector';
 //document.title=pos.x;
};

IntervalSelector.prototype.doneDrag=function(){};
IntervalSelector.prototype.dragging=function(){};

IntervalSelector.prototype.dragLo=function(e) {
 var pos=this.getMousePos(e);
 var newLo=this.min + (pos.x - findPosX(this.box))/this.scale;
 if (newLo < this.min) { newLo=this.min; }
 else if (newLo > this.hi - this.minBarWidth/this.scale) { newLo=this.hi - this.minBarWidth/this.scale; }
 this.lo=newLo;
 this.updatePosition();
};

IntervalSelector.prototype.dragHi=function(e) {
 var pos=this.getMousePos(e);
 var newHi=this.min + (pos.x - findPosX(this.box))/this.scale;
 if (newHi > this.max) { newHi=this.max; }
 else if (newHi < this.lo + this.minBarWidth/this.scale) { newHi=this.lo + this.minBarWidth/this.scale; }
 this.hi=newHi;
 this.updatePosition();
};

IntervalSelector.prototype.dragBar=function(e, x0, l0) {
 var pos=this.getMousePos(e);
 var delta=pos.x-x0;
 var newLo=l0 + delta/this.scale;
 var newHi=newLo + this.hi-this.lo;
 if (newLo < this.min) { newLo=this.min; newHi=newLo+this.hi-this.lo; }
 else if (newHi > this.max) { newHi=this.max; newLo=newHi-(this.hi-this.lo); }
 this.hi=newHi; this.lo=newLo;
 this.updatePosition();
};

IntervalSelector.prototype.getMousePos=function(e) {
 e = e || window.event;
 var x, y;
 if (e) {
 if (e.pageX) { x=e.pageX; y=e.pageY; }
 else if (typeof e.clientX!='undefined') {
 var left, top, docElt = window.document.documentElement;

 if (docElt) { left=docElt.scrollLeft; }
 left = left || window.document.body.scrollLeft || window.document.scrollLeft || 0;

 if (docElt) { top=docElt.scrollTop; }
 top = top || window.document.body.scrollTop || window.document.scrollTop || 0;

 x=e.clientX + left;
 y=e.clientY + top;
 } else { throw new Error ('bad mouse wiggle event in getMousePos'); return; }
 }
 return {x:x, y:y};
};

window.findPosX=function(obj)
{
 var curleft = 0;
 if (obj.offsetParent)
 {
 while (obj.offsetParent)
 {
 curleft += obj.offsetLeft
 obj = obj.offsetParent;
 }
 }
 else if (obj.x)
 curleft += obj.x;
 return curleft;
}

window.ts2unix=function(ts) {
 var t=ts.toString();
 return +(Date.UTC( t.substring(0,4), parseInt(t.substring(4,6),10)-1, t.substring(6,8),
    t.substring(8,10), t.substring(10,12), t.substring(12,14)));
}
window.unix2ts=function(u) {
 var d=new Date(u);
 return map(zeroFill, [d.getUTCFullYear(), d.getUTCMonth()+1,
       d.getUTCDate(), d.getUTCHours(),
       d.getUTCMinutes(), d.getUTCSeconds()]).join('');
}

window.zeroFill=function(s, min) {
 min = min || 2;
 var t=s.toString();
 return repeatString('0', min - t.length) + t;
}

window.map=function(f, o) {
 if (isArray(o)) { return map_array(f,o); }
 return map_object(f,o);
}
window.isArray =function(x) { return x instanceof Array; }

window.map_array=function(f,o) {
 var ret=[];
 for (var i=0; i<o.length; ++i) {
 ret.push(f(o[i]));
 }
 return ret;
}

window.map_object=function(f,o) {
 var ret={};
 for (var i in o) { ret[o]=f(o[i]); }
 return ret;
}

window.repeatString=function(s,mult) {
 var ret='';
 for (var i=0; i<mult; ++i) { ret += s; }
 return ret;
};

window.formatTs=function(ts) {
 ts=ts.toString();
 if (ts.substring(0,4)=='9999') { return 'now'; }
 return [ts.substring(0,4), ts.substring(4,6), ts.substring(6,8)].join('-') +
 ' ' + [ts.substring(8,10),ts.substring(10,12),ts.substring(12,14)].join(':');
};

function isMethodOf(klass, fn) {
 for (var f in klass.prototype) {
 if (fn===klass.prototype[f]) { return true; }
 }
 return false;
}

//</nowiki></pre>
//ec.doEditCount('Amanda77')
// ec.doEditCount('Llama man')

//</nowiki></pre>// Script from [[User:AndyZ/peerreviewer.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:AndyZ/peerreviewer.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/* <pre><nowiki> */

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FireFox's monobook
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Helper tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Voice of All
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Automatically check "anon only" in block field
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

addOnloadHook(function(){ var x; if (x=document.getElementById('wpAnonOnly')) {x.checked=true;} });

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add link
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    akeytt();
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add toolbox link
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addToolboxLink(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, url, name, id);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add tab
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key)
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add menu
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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');
    if(id) li.id = id;
    li.className = 'tabmenu';
    li.appendChild(na);
    li.appendChild(mn);
    tabs.appendChild(li);
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get page name
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function getPname() {
  z=document.getElementById("content").childNodes;
  for (var n=0;n<z.length;n++) { 
    if (z[n].className=="firstHeading") return z[n].textContent;
  };
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get tidy title
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function get_tidy_title()
{
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));

  return editlk;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add link
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addLink(where, url, name, id, title, key, after){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Voice of All tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Master rollback
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

addOnloadHook(Dfn_js_con)
function Dfn_js_con()
{
Mvaluejs_class = 'm';
Rvaluejs_class = 'r';
Uvaluejs_class = 'u';
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sleeper tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// History analysis
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Find and replace
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/replacetxt.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AfD tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AfD nomination and voting tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/automod.js' +
  '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

afdh_signature = '~~'+'~';
afdh_summaryprompt = true;
afdh_useicons = false;

afdh_shortcuts = Array();
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['c'] = 'Comment';

afdh_icons = Array();
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 = Array();
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: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;
    var icon_link = '';
    if (afdh_useicons && afdh_icons[vote.toLowerCase()])
        icon_link = '[[Image:' + afdh_icons[vote.toLowerCase()] + '|20px]] ';
    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;
    window.open(am_make_url(title, '{{'+'subst:afd}}', '', 'nomination for [[WP:AFD|deletion]]'), 'afdhn1');
    window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, '', '{{'+'subst:afd3|pg='+title+'}}', 'Nominating [['+title+']] for deletion'), 'afdhn3');
    window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, '', '{{'+'subst:afd2|pg='+title+'|text='+reason+' '+afdh_signature+'}}', 'nominated for deletion');
}

addOnloadHook(afd_helper);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AfD closing tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function closeafd(bold, notbold){
    var form = document.editform;
    var txt = form.wpTextbox1;
    txt.value = "{{subst:at}} '''" + bold + "''' " + notbold + " ~~~\n" + txt.value + "\n{{subst:ab}}\n";
    form.wpSummary.value = "close discussion: " + bold;
    form.wpWatchthis.checked = false;
}

function afdresult(){
    var form = document.editform;
    form.wpSummary.value = 'AFD result';
    var txt = form.wpTextbox1;
    txt.value = '{{subst:oldafd}} \n' + txt.value;
}

function afddelete(){
    document.forms.deleteconfirm.wpReason.value = '[[Wikipedia:Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')).replace(/^(Talk|Wikipedia( talk)?):/, '') + ']]';
}

function cfddelete(){
    document.forms.deleteconfirm.wpReason.value = 'category emptied per [[Wikipedia:Categories for discussion]]';
}

function replace(){
    var s = prompt("Search regexp?");
    if(s){
        var r = prompt("Replace regexp?");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

function autoafd_relist()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "relist" + "|~" + "~" + "~}}";
  f.wpSummary.value = "Relisting debate";
}

function autoafd_add_afd_tabs()
{
  // Only add for pages with the right string somewhere in the title
  if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
    {
      addLink('p-cactions', 'javascript:autoafd_relist()', "relist");
    }
}

addOnloadHook(autoafd_add_afd_tabs);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tab customisation tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add tab tools (technical)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function edit_summary_watch(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += msg;
  f.wpSummary.value = summ;
}

function edit_summary_watch2(summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  f.wpSummary.value = summ;
}

function edit_summary_watch3(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  t.value = msg;
  f.wpSummary.value = summ;
}

/* function testn(number)
{
  var page = prompt("Which message do you want to issue?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "User:FireFox/" + page + "}} ~" + "~" + "~";
  t.value += '\n';
  f.wpSummary.value = "vandalism warning";
} */

function blockuser(msg, other)
{
  var f = document.getElementsByName('wpBlockReason')[0];
  f.value = msg;
  var j = document.getElementsByName('wpBlockOther')[0];
  j.value = other;
}

function unblockuser(msg, other)
{
  var f = document.getElementsByName('wpUnblockReason')[0];
  f.value = msg;
}

function testv(number)
{
  var f = document.editform, t = f.wpTextbox1;
  t.value = "";
}

function protected(){
    var form = document.editform;
    form.wpSummary.value = '{{protected}}';
    var txt = form.wpTextbox1;
    txt.value = '{{protected}} \n' + txt.value;
}

function vprotected(){
    var form = document.editform;
    form.wpSummary.value = '{{vprotected}}';
    var txt = form.wpTextbox1;
    txt.value = '{{vprotected}} \n' + txt.value;
}

function sprotected(){
    var form = document.editform;
    form.wpSummary.value = '{{sprotected}}';
    var txt = form.wpTextbox1;
    txt.value = '{{sprotected}} \n' + txt.value;
}

function deletedpage(){
    var form = document.editform;
    form.wpSummary.value = '{{deletedpage}}';
    var txt = form.wpTextbox1;
    txt.value = '{{deletedpage}} \n' + txt.value;
}

function usertalkvprotect(){
    var form = document.editform;
    form.wpSummary.value = '{{usertalk-vprotect}}';
    var txt = form.wpTextbox1;
    txt.value = '{{usertalk-vprotect}} \n' + txt.value;
}

function usertalksprotect(){
    var form = document.editform;
    form.wpSummary.value = '{{usertalk-sprotect}}';
    var txt = form.wpTextbox1;
    txt.value = '{{usertalk-sprotect}} \n' + txt.value;
}

function archive(){
    var form = document.editform;
    form.wpSummary.value = 'archive';
    var txt = form.wpTextbox1;
    txt.value = '{{subst:User:FireFox/AT}} \n' + txt.value;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add tab tools (the actual tabs)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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, 'vandalism', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/1}}", "vandalism warning (1)", true, 1)',"test 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/2}}", "vandalism warning (2)", true, 1)',"test 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3}}", "vandalism warning (3)", true, 1)',"test 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/4}}", "vandalism warning (4)", true, 1)',"test 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b}}", "blocked (vandalism)", true, 1)',"test 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/i}}", "blocked (vandalism)", true, 1)',"test 6");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/1a}}", "message", true, 1)',"date");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/0}}", "possible vandalism warning (0)", true, 1)',"test 0");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/Self}}", "vandalism warning (1)", true, 1)',"testself");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/bv}}", "vandalism warning (bv)", true, 1)',"bvandal");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/RV}}", "vandalism warning (rv)", true, 1)',"rvandal");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b1}}", "vandalism warning (1)", true, 1)',"blank 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b2}}", "vandalism warning (2)", true, 1)',"blank 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b3}}", "vandalism warning (3)", true, 1)',"blank 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b4}}", "vandalism warning (4)", true, 1)',"blank 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b5}}", "blocked (blanking)", true, 1)',"blank 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv}}", "userpage vandalism warning (1)", true, 1)',"user 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv2}}", "userpage vandalism warning (2)", true, 1)',"user 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv3}}", "userpage vandalism warning (3)", true, 1)',"user 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv4}}", "userpage vandalism warning (4)", true, 1)',"user 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv5}}", "blocked (userpage vandalism)", true, 1)',"user 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr}}", "removing warnings warning (1)", true, 1)',"wr 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr2}}", "removing warnings warning (2)", true, 1)',"wr 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr3}}", "removing warnings warning (3)", true, 1)',"wr 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr4}}", "removing warnings warning (4)", true, 1)',"wr 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t0}}", "creating inappropriate articles warning (0)", true, 1)',"create 0");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t1}}", "creating inappropriate articles warning (1)", true, 1)',"create 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t2}}", "creating inappropriate articles warning (2)", true, 1)',"create 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t3}}", "creating inappropriate articles warning (3)", true, 1)',"create 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t4}}", "creating inappropriate articles warning (4)", true, 1)',"create 4");
    }

  if (document.title.indexOf("Editing User talk:") != -1)
    {
      addlimenu(tabs, 'messages', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/1a}}", "message", true, 1)',"date");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/u}}", "blocked (username)", true, 1)',"unb");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/f}}", "blocked (username - non-latin characters)", true, 1)',"latin");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/w}}", "welcome", true, 1)',"welc");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/email}}", "welcome + note", true, 1)',"email");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/Anon}}", "welcome", true, 1)',"anon");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s1}}", "spam warning (1)", true, 1)',"spam 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s2}}", "spam warning (2)", true, 1)',"spam 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s3}}", "spam warning (3)", true, 1)',"spam 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s4}}", "spam warning (3)", true, 1)',"spam 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/bs}}", "blocked (spam)", true, 1)',"spam 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3RR1}}", "three revert rule warning (1)", true, 1)',"3RR 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3RR2}}", "three revert rule warning (2)", true, 1)',"3RR 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3RR3}}", "blocked (three revert rule)", true, 1)',"3RR 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/c1}}", "civility (1)", true, 1)',"civil 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/c2}}", "civility (2)", true, 1)',"civil 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/npa1}}", "no personal attacks (1)", true, 1)',"npa 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/npa2}}", "no personal attacks (2)", true, 1)',"npa 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/npa3}}", "no personal attacks (3)", true, 1)',"npa 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm}}", "disprupting AfD process (1)", true, 1)',"afd 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm2}}", "disprupting AfD process (2)", true, 1)',"afd 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm3}}", "disprupting AfD process (3)", true, 1)',"afd 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm4}}", "disprupting AfD process (4)", true, 1)',"afd 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm5}}", "blocked (disprupting AfD process)", true, 1)',"afd 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/summary}}", "summary", true, 1)',"summ.");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/preview}}", "preview", true, 1)',"prev.");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tilde}}", "sign your posts", true, 1)',"tilde");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/subst}}", "subst", true, 1)',"subst");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tilde}}", "sign your posts", true, 1)',"tilde");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:EA-welcome|~~~}}", "welcome to Esperanza", true, 1)',"esp");
      addlilink(talkm,'javascript:usertalkvprotect()',"vprot");
      addlilink(talkm,'javascript:usertalksprotect()',"sprot");
      addlilink(talkm,'javascript:archive()',"1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/AB}}", "archive", true, 1)',"2");
    }

  if (document.title.indexOf("Editing User:") != -1)
    {
      addlimenu(tabs, 'userpage tags', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:ibu}}", "blocked", true, 1)',"indefinite");
      addlilink(talkm,'javascript:edit_summary_watch("{{indefblocked-username}}", "username block", true, 1)',"username");
      addlilink(talkm,'javascript:edit_summary_watch("{{indefblocked-vandalism}}", "blocked", true, 1)',"vandalism");
      addlilink(talkm,'javascript:edit_summary_watch("{{indef-latin}}", "username block", true, 1)',"non-latin");
      addlilink(talkm,'javascript:edit_summary_watch("{{pageblankvandal}}", "pageblankvandal", true, 1)',"page blank");
      addlilink(talkm,'javascript:edit_summary_watch("{{pagemovevandal}}", "pagemovevandal", true, 1)',"page move");
    }

  if (document.title.indexOf("Editing Image:") == 0)
    {
      addlilink(tabs, 'javascript:edit_summary_watch("{{subst:nld}}", "no licence", true, 1)',"licence");
    }

  if (document.title.indexOf("Editing User:") == 0)
    {
      addlilink(tabs, 'javascript:testv(1)',"");
    }

  if (document.title.indexOf("Editing User talk:") == 0)
    {
      addlilink(tabs, 'javascript:testv(1)',"");
    }

  if (document.title.indexOf("Editing Wikipedia:Articles for deletion") == 0)
    {
        addlilink(tabs, 'javascript:closeafd(prompt("Result"), (prompt("Additional comments")))', 'Result');
    }
         
  if (document.title.indexOf("Editing User:FireFox/status") == 0)
    {
      addlimenu(tabs, 'c/s', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|in}}", "changing status (in)", true, 1)',"i");
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|out}}", "changing status (out)", true, 1)',"o");
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|around}}", "changing status (around)", true, 1)',"a");
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|busy}}", "changing status (busy)", true, 1)',"b");
    }

  if (document.title.indexOf("Editing Wikipedia:Administrator intervention against vandalism") == 0)
    {
      addlimenu(tabs, 'admin intervention against vandalism', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch2("blocked, list empty", true, 1)',"blocked, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("blocked, list not empty", true, 1)',"blocked, not empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, content dispute, list empty", true, 1)',"content dispute, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, content dispute, list not empty", true, 1)',"content dispute, not empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not vandalised since final warning", list empty", true, 1)',"no edit since warning, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not vandalised since final warning", true, 1)',"no edit since warning, not empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not been sufficiently warned", list empty", true, 1)',"not sufficiently warned, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not been sufficiently warned", true, 1)',"not sufficiently warned, not empty");
    }

  if (document.title.indexOf("Editing Category") == 0)
    {
      addlimenu(tabs, 'cat', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch2("renaming of category per [[Wikipedia:Categories for discussion]]", true, 1)',"!");
    }

  if (document.title.indexOf("Editing") == 0)
    {
      addlimenu(tabs, 'protected', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:protected()',"dispute");
      addlilink(talkm,'javascript:vprotected()',"vprotect");
      addlilink(talkm,'javascript:sprotected()',"sprotect");
      addlilink(talkm,'javascript:deletedpage()',"deleted");
    }

  if (document.title.indexOf("Block user") == 0)
    {
 addlilink(tabs, 'javascript:blockuser("vandalism from this IP range, sorry. please see [[Wikipedia:Advice to AOL users]] if you have been impacted by this block.", "90 minutes")', "range");
 addlilink(tabs, 'javascript:blockuser("three revert rule violation", "24 hours")', "3RR");
 addlilink(tabs, 'javascript:blockuser("vandalism", "15 minutes")', "15 mins");
 addlilink(tabs, 'javascript:blockuser("vandalism", "3 hours")', "3 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "24 hours")', "24 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "48 hours")', "48 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "96 hours")', "96 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "192 hours")', "192 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "indefinite")', "indefinite");
 addlilink(tabs, 'javascript:blockuser("{{username}}", "indefinite")', "username");
 addlilink(tabs, 'javascript:blockuser("please contact an administrator for verification purposes, as described on this page", "indefinite")', "verification");
    }

  if (document.title.indexOf("Unblock user") == 0)
    {
 addlilink(tabs, 'javascript:unblockuser("temporarily removing block to change duration")', "change duration");
 addlilink(tabs, 'javascript:unblockuser("unblock requested (via email)")', "email");
 addlilink(tabs, 'javascript:unblockuser("blocked mistakenly")', "mistake");
 addlilink(tabs, 'javascript:unblockuser("collateral damage")', "collateral");
 addlilink(tabs, 'javascript:unblockuser("release autoblock")', "autoblock");
    }

  if (document.title.indexOf("Confirm delete") == 0)
    {
      addlilink(tabs, 'javascript:afddelete()',"afd");
      addlilink(tabs, 'javascript:cfddelete()',"cfd");
    }

  if (document.title.indexOf("Editing Talk:") == 0)
    {
      addlilink(tabs, 'javascript:afdresult()',"afd");
    }

}

if (window.addEventListener)
  window.addEventListener("load", add_tabs, false);
else if (window.attachEvent)
  window.attachEvent("onload", add_tabs);
  
function addtab(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.id = id;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Edit section zero
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addEditSection0() {
  ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
  if (!document.getElementById) return;
  x = document.getElementById('ca-edit');
  if(!x) return;
  y = document.createElement('LI');
  y.id = 'ca-edit-0';
  if (x.className == 'selected') {
    if (/&action=edit&section=0$/.test(window.location.href)) {
      x.className = 'istalk';
      y.className = 'selected';
    } else {
      x.className = 'selected istalk';
    }
  } else if (x.className == 'selected istalk') {
    if (/&action=edit&section=0$/.test(window.location.href)) {
      x.className = 'istalk';
      y.className = 'selected istalk';
    } else {
      y.className = 'istalk';
    }
  } else {
    y.className = x.className;
    x.className = 'istalk';
  }
  z = document.createElement('A');
  if (x.children) {
    z.href = x.children[0].href + '&section=0';
    z.appendChild(document.createTextNode('0'));
    y.appendChild(z);
    document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
  } else {
    z.href = x.childNodes[0].href + '&section=0';
    z.appendChild(document.createTextNode('0'));
    y.appendChild(z);
    document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
  }
}

if (document.title.indexOf("Editing ") == -1) {
  if (window.addEventListener) window.addEventListener("load", addEditSection0, false);
  else if (window.attachEvent) window.attachEvent("onload", addEditSection0);
}

function getPname() {
  z=document.getElementById("content").childNodes;
  for (var n=0;n<z.length;n++) { 
    if (z[n].className=="firstHeading") return z[n].textContent;
  };
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Block, unblock, and block log tabs
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function add_block_tab()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].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);

  addlilink(tabs, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');
  addlilink(tabs, '/w/index.php?title=Special:Blockip&ip=' + editlk, 'block');
  addlilink(tabs, '/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'log');

}

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Visual aids and changes to personal menus
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Personal menu, navigation, toolbox and more tab customisation
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

if ( document.createElement && window.addEventListener )
{
 function SoFixItInit()
 {

 }

 function SoFixItLoad()
 {
 UserMenu = new PortletMenu( 'p-personal'   );
 PageMenu = new PortletMenu( 'p-cactions'   );
  NavMenu = new PortletMenu( 'p-navigation' );
  ToolMenu = new PortletMenu( 'p-tb'         );

 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', 'Preferences' );
 UserMenu.setText( 'pt-watchlist'  , 'Watchlist' );
 UserMenu.setText( 'pt-mycontris'  , 'Contributions' );
 UserMenu.setText( 'pt-logout'     , 'Log out'   );

 document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0].style.textTransform = 'none';

 UserMenu.append( 'pt-utc', UTCTime(), 'javascript:void UserMenu.setText("pt-utc",UTCTime())' );

 if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable
 {
 PageMenu.insertBefore( 'ca-history', 'ca-lastdiff', 'last',
 PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'diff=0' ) );

 PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'action=purge');

                        PageMenu.setText( 'ca-edit'     , 'Edit this page'   );

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

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

 var x = 1;
 NavMenu.append( 'n-' + x++, 'monobook.js', 'http://en.wikipedia.org/w/index.php?title=User:FireFox/monobook.js&action=edit' );
 NavMenu.append( 'n-' + x++, 'monobook.css', 'http://en.wikipedia.org/w/index.php?title=User:FireFox/monobook.css&action=edit' );
 NavMenu.append( 'n-' + x++, 'Status', 'http://en.wikipedia.org/w/index.php?title=User:FireFox/status&action=edit' );
 NavMenu.append( 'n-' + x++, 'FFBot userpage', 'http://en.wikipedia.org/wiki/User:FFBot' );
 NavMenu.append( 'n-' + x++, 'FFBot contributions', 'http://en.wikipedia.org/wiki/Special:Contributions/FFBot' );
 NavMenu.append( 'n-' + x++, 'FFBot CfD', 'http://en.wikipedia.org/wiki/Wikipedia:Categories_for_discussion/Working' );
 NavMenu.append( 'n-' + x++, 'Bot Approval', 'http://en.wikipedia.org/wiki/Wikipedia:Bots/Requests_for_approval' );
 NavMenu.append( 'n-' + x++, 'Bot Requests', 'http://en.wikipedia.org/wiki/Wikipedia:Bot_requests' );
 NavMenu.append( 'n- ' + x++, 'Purge', 'http://en.wikipedia.org/w/index.php?title=' + getPname() + '&action=purge' );
 ToolMenu.append( 'n-' + x++, 'Block IP', 'http://en.wikipedia.org/wiki/Special:Blockip' );
 ToolMenu.append( 'n-' + x++, 'Unblock IP', 'http://en.wikipedia.org/w/index.php?title=Special:Ipblocklist&action=unblock' );
 ToolMenu.append( 'n-' + x++, 'IP block list', 'http://en.wikipedia.org/wiki/Special:Ipblocklist' );
 ToolMenu.append( 'n-' + x++, 'Autoblocks', 'http://tools.wikimedia.de/~pgk/autoblock.php?autoblock=&blocker=FireFox&blockee=&time=0&Submit=Submit+Query' );
 ToolMenu.append( 'n-' + x++, 'Requests: AIV', 'http://en.wikipedia.org/wiki/Wikipedia:Administrator_intervention_against_vandalism' );
 ToolMenu.append( 'n-' + x++, 'Requests: Unblock', 'http://en.wikipedia.org/wiki/Category:Requests_for_unblock' );
 ToolMenu.append( 'n-' + x++, 'Requests: Helpme', 'http://en.wikipedia.org/wiki/Category:Wikipedians_looking_for_help' );
 ToolMenu.append( 'n-' + x++, 'Requests: Adminship', 'http://en.wikipedia.org/wiki/Wikipedia:Requests_for_adminship' );
 ToolMenu.append( 'n-' + x++, 'Speedy deletions', 'http://en.wikipedia.org/wiki/Category:Candidates_for_speedy_deletion' );
 ToolMenu.append( 'n-' + x++, 'AfDs to be closed', 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Old' );
 ToolMenu.append( 'n-' + x++, 'Todays AfDs', 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Log/Today' );
 ToolMenu.append( 'n-' + x++, 'Yesterdays AfDs', 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Log/Yesterday' );
 ToolMenu.append( 'n-' + x++, 'Noticeboard', 'http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard' );
 ToolMenu.append( 'n-' + x++, 'Noticeboard: Incidents', 'http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard/Incidents' );
 ToolMenu.append( 'n-' + x++, 'Noticeboard: 3RR', 'http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard/3RR' );
 ToolMenu.append( 'n-' + x++, 'Edit count', 'http://tools.wikimedia.de/~essjay/edit_count/Count.php' );
 ToolMenu.append( 'n-' + x++, 'New users', 'http://en.wikipedia.org/w/index.php?title=Special:Log&type=newusers&user=&page=&limit=20&offset=0' );
 }

 function PortletMenu( id ) // constructor
 {
 this.menu = document.getElementById( id );
 this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", 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 );

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

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

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

 function RemoveNode( id )
 { var node = document.getElementById( id )
 node.parentNode.removeChild( node );
 }

 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Personal menu clock
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 function UTCTime()
 {
 var s = '',
 d = new Date(),
 a = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
 return d.getUTCDate() + ' ' +
 a[ d.getUTCMonth() ] + ' ' +
 d.getUTCFullYear() + ' ' +
 ( '0' + d.getUTCHours()   ).substr( -2 ) + ':' +
 ( '0' + d.getUTCMinutes() ).substr( -2 ) + ' ' + 'UTC';
 }

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Page logs link in toolbox
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

addOnloadHook(function () {

 var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/;
 ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' ');
 
 if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) {
  regDropSubpages = /[User|User_talk]:([^&?\/]*)[\/]?.*/;
  user = regDropSubpages.exec(ptitle)[1];
  url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user;
 } else if(window.location.href.indexOf("Special:") != -1) {
  return;
 } else {
  url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=" + ptitle;
 }
 
 tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0];
 l = addlilink(tabs, url, "Logs", "pt-logs");

});

document.write('<style type="text/css">' +
    ' .xdiff { width: 100%; background: white; }' +
    ' .xdiff-row { width: 100%; margin: 0 0 3px 0; overflow: hidden; }' +
    ' .xdiff-col { width: 49%; margin: 0; float: left; clear: none; position: relative; }' +
    ' .xdiff-sign, .xdiff-outer, .xdiff-inner { display: block; margin: 0; }' +
    ' .xdiff-sign { position: absolute; top: 0; left: 0; width: 2em; text-align: center; }' +
    ' .xdiff-outer { padding: 0 0 0 2em; }' +
    ' .xdiff-inner { overflow: auto; overflow-y: visible; width: 100%; }' +
    ' .xdiff-inner.diff-addedline { font-size: 85%; background: #cfc; }' +
    ' .xdiff-inner.diff-deletedline { font-size: 85%; background: #ffa; }' +
    ' .xdiff-inner.diff-context { font-size: 85%; background: #eee; }' +
    (!document.recalc ? '' :  // IE kluge:
        ' * html .xdiff-inner { padding-bottom: expression(this.scrollWidth > this.offsetWidth ? "16px" : 0); }' +
        ' * html .xdiff-sign { top: expression((this.parentNode.clientHeight - this.offsetHeight)/2 + "px"); }') +
    '<'+'/style>');

addOnloadHook(maybeStart);
addOnloadHook(addMarvin);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Other / Uncategorised
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Interiot edit count (tool 2)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// End
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//<nowiki><pre>
// Adds a "Changes since last load" link to your watchlist.  <pre>

addOnloadHook(function () {
    if (unescape(window.location.href).indexOf("Special:Watchlist") < 0) return;

    // just one little ID attribute would be _so_ nice...
    var nsSelectForm = document.getElementById('namespace');
    while (nsSelectForm && !(nsSelectForm.tagName && nsSelectForm.tagName.toLowerCase() == 'form'))
         nsSelectForm = nsSelectForm.parentNode;
    if (!nsSelectForm) return;

    var link = document.createElement('a');
    link.id = 'listSince';
    link.href = '#listSince';  // must have a href to show as link!

    var then = +(new Date());
    var fixLinkHref = function () {
        var url = window.location.href.split('#')[0];
        var days = ( +(new Date()) - then )/(1000 * 3600 * 24);
        if (url.match(/[?&]days=/))
            this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days);
        else
            this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;
        return true;
    };
    link.onclick = fixLinkHref;
    link.onmousedown = fixLinkHref;  // react to middle clicks too

    var frag = document.createDocumentFragment();
    frag.appendChild(document.createTextNode(' | '));
    frag.appendChild(link);
    link.appendChild(document.createTextNode('Changes'));
    frag.appendChild(document.createTextNode(' since last load.'));
    nsSelectForm.parentNode.insertBefore(frag, nsSelectForm);
});

/* <pre><nowiki> */

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FireFox's monobook
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Helper tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Voice of All
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Automatically check "anon only" in block field
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

addOnloadHook(function(){ var x; if (x=document.getElementById('wpAnonOnly')) {x.checked=true;} });

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add link
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    akeytt();
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add toolbox link
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addToolboxLink(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, url, name, id);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add tab
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key)
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add menu
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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');
    if(id) li.id = id;
    li.className = 'tabmenu';
    li.appendChild(na);
    li.appendChild(mn);
    tabs.appendChild(li);
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get page name
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function getPname() {
  z=document.getElementById("content").childNodes;
  for (var n=0;n<z.length;n++) { 
    if (z[n].className=="firstHeading") return z[n].textContent;
  };
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get tidy title
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function get_tidy_title()
{
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));

  return editlk;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add link
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addLink(where, url, name, id, title, key, after){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Voice of All tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Master rollback
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

addOnloadHook(Dfn_js_con)
function Dfn_js_con()
{
Mvaluejs_class = 'm';
Rvaluejs_class = 'r';
Uvaluejs_class = 'u';
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sleeper tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// History analysis
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Find and replace
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/replacetxt.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AfD tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AfD nomination and voting tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/automod.js' +
  '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

afdh_signature = '~~'+'~';
afdh_summaryprompt = true;
afdh_useicons = false;

afdh_shortcuts = Array();
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['c'] = 'Comment';

afdh_icons = Array();
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 = Array();
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: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;
    var icon_link = '';
    if (afdh_useicons && afdh_icons[vote.toLowerCase()])
        icon_link = '[[Image:' + afdh_icons[vote.toLowerCase()] + '|20px]] ';
    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;
    window.open(am_make_url(title, '{{'+'subst:afd}}', '', 'nomination for [[WP:AFD|deletion]]'), 'afdhn1');
    window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, '', '{{'+'subst:afd3|pg='+title+'}}', 'Nominating [['+title+']] for deletion'), 'afdhn3');
    window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, '', '{{'+'subst:afd2|pg='+title+'|text='+reason+' '+afdh_signature+'}}', 'nominated for deletion');
}

addOnloadHook(afd_helper);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AfD closing tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function closeafd(bold, notbold){
    var form = document.editform;
    var txt = form.wpTextbox1;
    txt.value = "{{subst:at}} '''" + bold + "''' " + notbold + " ~~~\n" + txt.value + "\n{{subst:ab}}\n";
    form.wpSummary.value = "close discussion: " + bold;
    form.wpWatchthis.checked = false;
}

function afdresult(){
    var form = document.editform;
    form.wpSummary.value = 'AFD result';
    var txt = form.wpTextbox1;
    txt.value = '{{subst:oldafd}} \n' + txt.value;
}

function afddelete(){
    document.forms.deleteconfirm.wpReason.value = '[[Wikipedia:Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')).replace(/^(Talk|Wikipedia( talk)?):/, '') + ']]';
}

function cfddelete(){
    document.forms.deleteconfirm.wpReason.value = 'category emptied per [[Wikipedia:Categories for discussion]]';
}

function replace(){
    var s = prompt("Search regexp?");
    if(s){
        var r = prompt("Replace regexp?");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

function autoafd_relist()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "relist" + "|~" + "~" + "~}}";
  f.wpSummary.value = "Relisting debate";
}

function autoafd_add_afd_tabs()
{
  // Only add for pages with the right string somewhere in the title
  if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
    {
      addLink('p-cactions', 'javascript:autoafd_relist()', "relist");
    }
}

addOnloadHook(autoafd_add_afd_tabs);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tab customisation tools
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add tab tools (technical)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function edit_summary_watch(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += msg;
  f.wpSummary.value = summ;
}

function edit_summary_watch2(summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  f.wpSummary.value = summ;
}

function edit_summary_watch3(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  t.value = msg;
  f.wpSummary.value = summ;
}

/* function testn(number)
{
  var page = prompt("Which message do you want to issue?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "User:FireFox/" + page + "}} ~" + "~" + "~";
  t.value += '\n';
  f.wpSummary.value = "vandalism warning";
} */

function blockuser(msg, other)
{
  var f = document.getElementsByName('wpBlockReason')[0];
  f.value = msg;
  var j = document.getElementsByName('wpBlockOther')[0];
  j.value = other;
}

function unblockuser(msg, other)
{
  var f = document.getElementsByName('wpUnblockReason')[0];
  f.value = msg;
}

function testv(number)
{
  var f = document.editform, t = f.wpTextbox1;
  t.value = "";
}

function protected(){
    var form = document.editform;
    form.wpSummary.value = '{{protected}}';
    var txt = form.wpTextbox1;
    txt.value = '{{protected}} \n' + txt.value;
}

function vprotected(){
    var form = document.editform;
    form.wpSummary.value = '{{vprotected}}';
    var txt = form.wpTextbox1;
    txt.value = '{{vprotected}} \n' + txt.value;
}

function sprotected(){
    var form = document.editform;
    form.wpSummary.value = '{{sprotected}}';
    var txt = form.wpTextbox1;
    txt.value = '{{sprotected}} \n' + txt.value;
}

function deletedpage(){
    var form = document.editform;
    form.wpSummary.value = '{{deletedpage}}';
    var txt = form.wpTextbox1;
    txt.value = '{{deletedpage}} \n' + txt.value;
}

function usertalkvprotect(){
    var form = document.editform;
    form.wpSummary.value = '{{usertalk-vprotect}}';
    var txt = form.wpTextbox1;
    txt.value = '{{usertalk-vprotect}} \n' + txt.value;
}

function usertalksprotect(){
    var form = document.editform;
    form.wpSummary.value = '{{usertalk-sprotect}}';
    var txt = form.wpTextbox1;
    txt.value = '{{usertalk-sprotect}} \n' + txt.value;
}

function archive(){
    var form = document.editform;
    form.wpSummary.value = 'archive';
    var txt = form.wpTextbox1;
    txt.value = '{{subst:User:FireFox/AT}} \n' + txt.value;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Add tab tools (the actual tabs)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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, 'vandalism', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/1}}", "vandalism warning (1)", true, 1)',"test 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/2}}", "vandalism warning (2)", true, 1)',"test 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3}}", "vandalism warning (3)", true, 1)',"test 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/4}}", "vandalism warning (4)", true, 1)',"test 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b}}", "blocked (vandalism)", true, 1)',"test 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/i}}", "blocked (vandalism)", true, 1)',"test 6");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/1a}}", "message", true, 1)',"date");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/0}}", "possible vandalism warning (0)", true, 1)',"test 0");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/Self}}", "vandalism warning (1)", true, 1)',"testself");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/bv}}", "vandalism warning (bv)", true, 1)',"bvandal");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/RV}}", "vandalism warning (rv)", true, 1)',"rvandal");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b1}}", "vandalism warning (1)", true, 1)',"blank 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b2}}", "vandalism warning (2)", true, 1)',"blank 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b3}}", "vandalism warning (3)", true, 1)',"blank 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b4}}", "vandalism warning (4)", true, 1)',"blank 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/b5}}", "blocked (blanking)", true, 1)',"blank 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv}}", "userpage vandalism warning (1)", true, 1)',"user 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv2}}", "userpage vandalism warning (2)", true, 1)',"user 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv3}}", "userpage vandalism warning (3)", true, 1)',"user 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv4}}", "userpage vandalism warning (4)", true, 1)',"user 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tpv5}}", "blocked (userpage vandalism)", true, 1)',"user 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr}}", "removing warnings warning (1)", true, 1)',"wr 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr2}}", "removing warnings warning (2)", true, 1)',"wr 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr3}}", "removing warnings warning (3)", true, 1)',"wr 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/wr4}}", "removing warnings warning (4)", true, 1)',"wr 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t0}}", "creating inappropriate articles warning (0)", true, 1)',"create 0");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t1}}", "creating inappropriate articles warning (1)", true, 1)',"create 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t2}}", "creating inappropriate articles warning (2)", true, 1)',"create 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t3}}", "creating inappropriate articles warning (3)", true, 1)',"create 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/t4}}", "creating inappropriate articles warning (4)", true, 1)',"create 4");
    }

  if (document.title.indexOf("Editing User talk:") != -1)
    {
      addlimenu(tabs, 'messages', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/1a}}", "message", true, 1)',"date");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/u}}", "blocked (username)", true, 1)',"unb");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/f}}", "blocked (username - non-latin characters)", true, 1)',"latin");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/w}}", "welcome", true, 1)',"welc");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/email}}", "welcome + note", true, 1)',"email");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/Anon}}", "welcome", true, 1)',"anon");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s1}}", "spam warning (1)", true, 1)',"spam 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s2}}", "spam warning (2)", true, 1)',"spam 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s3}}", "spam warning (3)", true, 1)',"spam 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/s4}}", "spam warning (3)", true, 1)',"spam 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/bs}}", "blocked (spam)", true, 1)',"spam 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3RR1}}", "three revert rule warning (1)", true, 1)',"3RR 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3RR2}}", "three revert rule warning (2)", true, 1)',"3RR 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/3RR3}}", "blocked (three revert rule)", true, 1)',"3RR 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/c1}}", "civility (1)", true, 1)',"civil 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/c2}}", "civility (2)", true, 1)',"civil 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/npa1}}", "no personal attacks (1)", true, 1)',"npa 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/npa2}}", "no personal attacks (2)", true, 1)',"npa 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/npa3}}", "no personal attacks (3)", true, 1)',"npa 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm}}", "disprupting AfD process (1)", true, 1)',"afd 1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm2}}", "disprupting AfD process (2)", true, 1)',"afd 2");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm3}}", "disprupting AfD process (3)", true, 1)',"afd 3");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm4}}", "disprupting AfD process (4)", true, 1)',"afd 4");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/drm5}}", "blocked (disprupting AfD process)", true, 1)',"afd 5");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/summary}}", "summary", true, 1)',"summ.");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/preview}}", "preview", true, 1)',"prev.");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tilde}}", "sign your posts", true, 1)',"tilde");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/subst}}", "subst", true, 1)',"subst");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/tilde}}", "sign your posts", true, 1)',"tilde");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:EA-welcome|~~~}}", "welcome to Esperanza", true, 1)',"esp");
      addlilink(talkm,'javascript:usertalkvprotect()',"vprot");
      addlilink(talkm,'javascript:usertalksprotect()',"sprot");
      addlilink(talkm,'javascript:archive()',"1");
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:FireFox/AB}}", "archive", true, 1)',"2");
    }

  if (document.title.indexOf("Editing User:") != -1)
    {
      addlimenu(tabs, 'userpage tags', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:ibu}}", "blocked", true, 1)',"indefinite");
      addlilink(talkm,'javascript:edit_summary_watch("{{indefblocked-username}}", "username block", true, 1)',"username");
      addlilink(talkm,'javascript:edit_summary_watch("{{indefblocked-vandalism}}", "blocked", true, 1)',"vandalism");
      addlilink(talkm,'javascript:edit_summary_watch("{{indef-latin}}", "username block", true, 1)',"non-latin");
      addlilink(talkm,'javascript:edit_summary_watch("{{pageblankvandal}}", "pageblankvandal", true, 1)',"page blank");
      addlilink(talkm,'javascript:edit_summary_watch("{{pagemovevandal}}", "pagemovevandal", true, 1)',"page move");
    }

  if (document.title.indexOf("Editing Image:") == 0)
    {
      addlilink(tabs, 'javascript:edit_summary_watch("{{subst:nld}}", "no licence", true, 1)',"licence");
    }

  if (document.title.indexOf("Editing User:") == 0)
    {
      addlilink(tabs, 'javascript:testv(1)',"");
    }

  if (document.title.indexOf("Editing User talk:") == 0)
    {
      addlilink(tabs, 'javascript:testv(1)',"");
    }

  if (document.title.indexOf("Editing Wikipedia:Articles for deletion") == 0)
    {
        addlilink(tabs, 'javascript:closeafd(prompt("Result"), (prompt("Additional comments")))', 'Result');
    }
         
  if (document.title.indexOf("Editing User:FireFox/status") == 0)
    {
      addlimenu(tabs, 'c/s', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|in}}", "changing status (in)", true, 1)',"i");
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|out}}", "changing status (out)", true, 1)',"o");
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|around}}", "changing status (around)", true, 1)',"a");
      addlilink(talkm,'javascript:edit_summary_watch3("{{User:FireFox/Status2|busy}}", "changing status (busy)", true, 1)',"b");
    }

  if (document.title.indexOf("Editing Wikipedia:Administrator intervention against vandalism") == 0)
    {
      addlimenu(tabs, 'admin intervention against vandalism', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch2("blocked, list empty", true, 1)',"blocked, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("blocked, list not empty", true, 1)',"blocked, not empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, content dispute, list empty", true, 1)',"content dispute, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, content dispute, list not empty", true, 1)',"content dispute, not empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not vandalised since final warning", list empty", true, 1)',"no edit since warning, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not vandalised since final warning", true, 1)',"no edit since warning, not empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not been sufficiently warned", list empty", true, 1)',"not sufficiently warned, empty");
      addlilink(talkm,'javascript:edit_summary_watch2("not blocked, has not been sufficiently warned", true, 1)',"not sufficiently warned, not empty");
    }

  if (document.title.indexOf("Editing Category") == 0)
    {
      addlimenu(tabs, 'cat', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch2("renaming of category per [[Wikipedia:Categories for discussion]]", true, 1)',"!");
    }

  if (document.title.indexOf("Editing") == 0)
    {
      addlimenu(tabs, 'protected', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:protected()',"dispute");
      addlilink(talkm,'javascript:vprotected()',"vprotect");
      addlilink(talkm,'javascript:sprotected()',"sprotect");
      addlilink(talkm,'javascript:deletedpage()',"deleted");
    }

  if (document.title.indexOf("Block user") == 0)
    {
 addlilink(tabs, 'javascript:blockuser("vandalism from this IP range, sorry. please see [[Wikipedia:Advice to AOL users]] if you have been impacted by this block.", "90 minutes")', "range");
 addlilink(tabs, 'javascript:blockuser("three revert rule violation", "24 hours")', "3RR");
 addlilink(tabs, 'javascript:blockuser("vandalism", "15 minutes")', "15 mins");
 addlilink(tabs, 'javascript:blockuser("vandalism", "3 hours")', "3 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "24 hours")', "24 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "48 hours")', "48 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "96 hours")', "96 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "192 hours")', "192 hrs");
 addlilink(tabs, 'javascript:blockuser("vandalism", "indefinite")', "indefinite");
 addlilink(tabs, 'javascript:blockuser("{{username}}", "indefinite")', "username");
 addlilink(tabs, 'javascript:blockuser("please contact an administrator for verification purposes, as described on this page", "indefinite")', "verification");
    }

  if (document.title.indexOf("Unblock user") == 0)
    {
 addlilink(tabs, 'javascript:unblockuser("temporarily removing block to change duration")', "change duration");
 addlilink(tabs, 'javascript:unblockuser("unblock requested (via email)")', "email");
 addlilink(tabs, 'javascript:unblockuser("blocked mistakenly")', "mistake");
 addlilink(tabs, 'javascript:unblockuser("collateral damage")', "collateral");
 addlilink(tabs, 'javascript:unblockuser("release autoblock")', "autoblock");
    }

  if (document.title.indexOf("Confirm delete") == 0)
    {
      addlilink(tabs, 'javascript:afddelete()',"afd");
      addlilink(tabs, 'javascript:cfddelete()',"cfd");
    }

  if (document.title.indexOf("Editing Talk:") == 0)
    {
      addlilink(tabs, 'javascript:afdresult()',"afd");
    }

}

if (window.addEventListener)
  window.addEventListener("load", add_tabs, false);
else if (window.attachEvent)
  window.attachEvent("onload", add_tabs);
  
function addtab(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.id = id;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Edit section zero
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function addEditSection0() {
  ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
  if (!document.getElementById) return;
  x = document.getElementById('ca-edit');
  if(!x) return;
  y = document.createElement('LI');
  y.id = 'ca-edit-0';
  if (x.className == 'selected') {
    if (/&action=edit&section=0$/.test(window.location.href)) {
      x.className = 'istalk';
      y.className = 'selected';
    } else {
      x.className = 'selected istalk';
    }
  } else if (x.className == 'selected istalk') {
    if (/&action=edit&section=0$/.test(window.location.href)) {
      x.className = 'istalk';
      y.className = 'selected istalk';
    } else {
      y.className = 'istalk';
    }
  } else {
    y.className = x.className;
    x.className = 'istalk';
  }
  z = document.createElement('A');
  if (x.children) {
    z.href = x.children[0].href + '&section=0';
    z.appendChild(document.createTextNode('0'));
    y.appendChild(z);
    document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
  } else {
    z.href = x.childNodes[0].href + '&section=0';
    z.appendChild(document.createTextNode('0'));
    y.appendChild(z);
    document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
  }
}

if (document.title.indexOf("Editing ") == -1) {
  if (window.addEventListener) window.addEventListener("load", addEditSection0, false);
  else if (window.attachEvent) window.attachEvent("onload", addEditSection0);
}

function getPname() {
  z=document.getElementById("content").childNodes;
  for (var n=0;n<z.length;n++) { 
    if (z[n].className=="firstHeading") return z[n].textContent;
  };
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Block, unblock, and block log tabs
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function add_block_tab()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].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);

  addlilink(tabs, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'u');
  addlilink(tabs, '/w/index.php?title=Special:Blockip&ip=' + editlk, 'b');
  addlilink(tabs, '/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'l');

}

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Visual aids and changes to personal menus
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Personal menu, navigation, toolbox and more tab customisation
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

if ( document.createElement && window.addEventListener )
{
 function SoFixItInit()
 {

 }

 function SoFixItLoad()
 {
 UserMenu = new PortletMenu( 'p-personal'   );
 PageMenu = new PortletMenu( 'p-cactions'   );
  NavMenu = new PortletMenu( 'p-navigation' );
  ToolMenu = new PortletMenu( 'p-tb'         );

 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', 'Preferences' );
 UserMenu.setText( 'pt-watchlist'  , 'Watchlist' );
 UserMenu.setText( 'pt-mycontris'  , 'Contributions' );
 UserMenu.setText( 'pt-logout'     , 'Log out'   );

 document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0].style.textTransform = 'none';

 UserMenu.append( 'pt-utc', UTCTime(), 'javascript:void UserMenu.setText("pt-utc",UTCTime())' );

 if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable
 {
 PageMenu.insertBefore( 'ca-history', 'ca-lastdiff', 'last',
 PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'diff=0' ) );

 PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'action=purge');

                        PageMenu.setText( 'ca-edit'     , 'Edit this page'   );

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

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

 var x = 1;
 NavMenu.append( 'n-' + x++, 'monobook.js', 'http://en.wikipedia.org/w/index.php?title=User:FireFox/monobook.js&action=edit' );
 NavMenu.append( 'n-' + x++, 'monobook.css', 'http://en.wikipedia.org/w/index.php?title=User:FireFox/monobook.css&action=edit' );
 NavMenu.append( 'n-' + x++, 'Status', 'http://en.wikipedia.org/w/index.php?title=User:FireFox/status&action=edit' );
 NavMenu.append( 'n-' + x++, 'FFBot userpage', 'http://en.wikipedia.org/wiki/User:FFBot' );
 NavMenu.append( 'n-' + x++, 'FFBot contributions', 'http://en.wikipedia.org/wiki/Special:Contributions/FFBot' );
 NavMenu.append( 'n-' + x++, 'FFBot CfD', 'http://en.wikipedia.org/wiki/Wikipedia:Categories_for_discussion/Working' );
 NavMenu.append( 'n-' + x++, 'Bot Approval', 'http://en.wikipedia.org/wiki/Wikipedia:Bots/Requests_for_approval' );
 NavMenu.append( 'n-' + x++, 'Bot Requests', 'http://en.wikipedia.org/wiki/Wikipedia:Bot_requests' );
 NavMenu.append( 'n- ' + x++, 'Purge', 'http://en.wikipedia.org/w/index.php?title=' + getPname() + '&action=purge' );
 ToolMenu.append( 'n-' + x++, 'Block IP', 'http://en.wikipedia.org/wiki/Special:Blockip' );
 ToolMenu.append( 'n-' + x++, 'Unblock IP', 'http://en.wikipedia.org/w/index.php?title=Special:Ipblocklist&action=unblock' );
 ToolMenu.append( 'n-' + x++, 'IP block list', 'http://en.wikipedia.org/wiki/Special:Ipblocklist' );
 ToolMenu.append( 'n-' + x++, 'Autoblocks', 'http://tools.wikimedia.de/~pgk/autoblock.php?autoblock=&blocker=FireFox&blockee=&time=0&Submit=Submit+Query' );
 ToolMenu.append( 'n-' + x++, 'Requests: AIV', 'http://en.wikipedia.org/wiki/Wikipedia:Administrator_intervention_against_vandalism' );
 ToolMenu.append( 'n-' + x++, 'Requests: Unblock', 'http://en.wikipedia.org/wiki/Category:Requests_for_unblock' );
 ToolMenu.append( 'n-' + x++, 'Requests: Helpme', 'http://en.wikipedia.org/wiki/Category:Wikipedians_looking_for_help' );
 ToolMenu.append( 'n-' + x++, 'Requests: Adminship', 'http://en.wikipedia.org/wiki/Wikipedia:Requests_for_adminship' );
 ToolMenu.append( 'n-' + x++, 'Speedy deletions', 'http://en.wikipedia.org/wiki/Category:Candidates_for_speedy_deletion' );
 ToolMenu.append( 'n-' + x++, 'AfDs to be closed', 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Old' );
 ToolMenu.append( 'n-' + x++, 'Todays AfDs', 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Log/Today' );
 ToolMenu.append( 'n-' + x++, 'Yesterdays AfDs', 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Log/Yesterday' );
 ToolMenu.append( 'n-' + x++, 'Noticeboard', 'http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard' );
 ToolMenu.append( 'n-' + x++, 'Noticeboard: Incidents', 'http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard/Incidents' );
 ToolMenu.append( 'n-' + x++, 'Noticeboard: 3RR', 'http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard/3RR' );
 ToolMenu.append( 'n-' + x++, 'Edit count', 'http://tools.wikimedia.de/~essjay/edit_count/Count.php' );
 ToolMenu.append( 'n-' + x++, 'New users', 'http://en.wikipedia.org/w/index.php?title=Special:Log&type=newusers&user=&page=&limit=20&offset=0' );
 }

 function PortletMenu( id ) // constructor
 {
 this.menu = document.getElementById( id );
 this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", 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 );

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

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

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

 function RemoveNode( id )
 { var node = document.getElementById( id )
 node.parentNode.removeChild( node );
 }

 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Personal menu clock
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 function UTCTime()
 {
 var s = '',
 d = new Date(),
 a = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
 return d.getUTCDate() + ' ' +
 a[ d.getUTCMonth() ] + ' ' +
 d.getUTCFullYear() + ' ' +
 ( '0' + d.getUTCHours()   ).substr( -2 ) + ':' +
 ( '0' + d.getUTCMinutes() ).substr( -2 ) + ' ' + 'UTC';
 }

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Page logs link in toolbox
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

addOnloadHook(function () {

 var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/;
 ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' ');
 
 if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) {
  regDropSubpages = /[User|User_talk]:([^&?\/]*)[\/]?.*/;
  user = regDropSubpages.exec(ptitle)[1];
  url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user;
 } else if(window.location.href.indexOf("Special:") != -1) {
  return;
 } else {
  url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=" + ptitle;
 }
 
 tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0];
 l = addlilink(tabs, url, "Logs", "pt-logs");

});

document.write('<style type="text/css">' +
    ' .xdiff { width: 100%; background: white; }' +
    ' .xdiff-row { width: 100%; margin: 0 0 3px 0; overflow: hidden; }' +
    ' .xdiff-col { width: 49%; margin: 0; float: left; clear: none; position: relative; }' +
    ' .xdiff-sign, .xdiff-outer, .xdiff-inner { display: block; margin: 0; }' +
    ' .xdiff-sign { position: absolute; top: 0; left: 0; width: 2em; text-align: center; }' +
    ' .xdiff-outer { padding: 0 0 0 2em; }' +
    ' .xdiff-inner { overflow: auto; overflow-y: visible; width: 100%; }' +
    ' .xdiff-inner.diff-addedline { font-size: 85%; background: #cfc; }' +
    ' .xdiff-inner.diff-deletedline { font-size: 85%; background: #ffa; }' +
    ' .xdiff-inner.diff-context { font-size: 85%; background: #eee; }' +
    (!document.recalc ? '' :  // IE kluge:
        ' * html .xdiff-inner { padding-bottom: expression(this.scrollWidth > this.offsetWidth ? "16px" : 0); }' +
        ' * html .xdiff-sign { top: expression((this.parentNode.clientHeight - this.offsetHeight)/2 + "px"); }') +
    '<'+'/style>');

addOnloadHook(maybeStart);
addOnloadHook(addMarvin);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Other / Uncategorised
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Interiot edit count (tool 2)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// End
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* </nowiki></pre> */
THIS WEB:

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - be - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - closed_zh_tw - co - cr - cs - csb - cu - cv - cy - da - de - diq - dv - dz - ee - el - eml - en - eo - es - et - eu - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gd - gl - glk - gn - got - gu - gv - ha - haw - he - hi - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mg - mh - mi - mk - ml - mn - mo - mr - ms - mt - mus - my - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - rm - rmy - rn - ro - roa_rup - roa_tara - ru - ru_sib - rw - sa - sc - scn - sco - sd - se - searchcom - sg - sh - si - simple - sk - sl - sm - sn - so - sq - sr - ss - st - su - sv - sw - ta - te - test - tet - tg - th - ti - tk - tl - tlh - tn - to - tokipona - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu

Static Wikipedia 2008 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2007:

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - be - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - closed_zh_tw - co - cr - cs - csb - cu - cv - cy - da - de - diq - dv - dz - ee - el - eml - en - eo - es - et - eu - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gd - gl - glk - gn - got - gu - gv - ha - haw - he - hi - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mg - mh - mi - mk - ml - mn - mo - mr - ms - mt - mus - my - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - rm - rmy - rn - ro - roa_rup - roa_tara - ru - ru_sib - rw - sa - sc - scn - sco - sd - se - searchcom - sg - sh - si - simple - sk - sl - sm - sn - so - sq - sr - ss - st - su - sv - sw - ta - te - test - tet - tg - th - ti - tk - tl - tlh - tn - to - tokipona - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu

Static Wikipedia 2006:

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - be - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - closed_zh_tw - co - cr - cs - csb - cu - cv - cy - da - de - diq - dv - dz - ee - el - eml - en - eo - es - et - eu - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gd - gl - glk - gn - got - gu - gv - ha - haw - he - hi - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mg - mh - mi - mk - ml - mn - mo - mr - ms - mt - mus - my - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - rm - rmy - rn - ro - roa_rup - roa_tara - ru - ru_sib - rw - sa - sc - scn - sco - sd - se - searchcom - sg - sh - si - simple - sk - sl - sm - sn - so - sq - sr - ss - st - su - sv - sw - ta - te - test - tet - tg - th - ti - tk - tl - tlh - tn - to - tokipona - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu