User:Sj/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
 * NICE gadget 
 * http://wikipedia.grouplens.org/NICE/consent.  
 * User:EpochFail. 
 **/

importScript("User:EpochFail/No_Biting.js")

/*
==AzaToth's reversion tools ==
<pre> <nowiki> */
// install [[Wikipedia:WikiProject User scripts/Scripts/Twinkle]]
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklearv.js');
importScript('User:AzaToth/twinklespeedy.js');
// importScript('User:AzaToth/twinklediff.js');
importScript('User:AzaToth/twinkle.js');
importScript('User:Ale_jrb/Scripts/igloo.js'); // [[User:Ale_jrb/Scripts/igloo]]

/*
</nowiki> </pre>
==WikEd, replaces Firefox's text edit window ==
<pre> <nowiki> */

// install [[User:Cacycle/wikEd]] in-browser text editor
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>');

/*
</nowiki> </pre>
==Lupin's anti-vandal tools ==
<pre> <nowiki> */


// Script from [[User:Lupin/recent2.js]]
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

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

mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s'); 

/*{{User:AndyZ/peerreviewer.js}}*/
/*
</nowiki> </pre>
== Watchlist sorter ==
<pre> <nowiki>
Sorts your watchlist by namespace, and also adds spaces for readability.
*/

addOnloadHook(function (){
  if (location.href.indexOf('Special:Watchlist') == -1) return; //Are we on a watchlist?
  //days = document.getElementById('bodyContent').getElementsByTagName('ul');
  days = document.evaluate( //Hell knows how it works - found in "Dive into Greasemonkey"
    "//ul[@class='special']",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
  for (d = 0; d < days.snapshotLength; d++) { //For each day
    day = days.snapshotItem(d);
    newday = document.createElement('ul'); //This will replace the old listing
    while ((diffs = day.getElementsByTagName('li')).length > 0) { //Are there any diffs left?
      //Try to extract the namespace
      As = diffs[0].getElementsByTagName('a');
      if (As[0].innerHTML == 'diff')
        pagename = As[2].innerHTML;
      else
        pagename = As[1].innerHTML;
      if (pagename.indexOf(':') == -1)
        namespace = 'Main';
      else
        namespace = pagename.split(':')[0]; //This will fail for articles which contain ":" in name
      hdrs = newday.getElementsByTagName('h5'); //Get the list of namespace headers
      hdr = null;
      for (j=0; j<hdrs.length; j++) //Find the header
        if (hdrs[j].innerHTML==namespace) {
          hdr = hdrs[j]; break;
        }
      if (hdr==null) { //Not found? Make a new one!
        hdr = document.createElement('h5');
        hdr.innerHTML = namespace;
        newday.appendChild(hdr);
        namespacesub = document.createElement('ul');
        newday.appendChild(namespacesub);
      }
      hdr.nextSibling.appendChild(diffs[0]); //Move the diff
    }
    newday.appendChild(document.createElement('hr')); //For readablility
    day.parentNode.replaceChild(newday,day);
  }
});


// Filter changes live
// [[User:Lupin/recent2.js]] - please include this line
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

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

mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

// Filter changes live
// [[User:Lupin/recent2.js]] - please include this line
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

// <nowiki> //

////////////////////////////////////////////////////////////////////////////
// [[User:Essjay]]'s monobook.
// It's all copied from [[User:Celestianpower]] who copied it from lots of places. It says where from when known
////////////////////////////////////////////////////////////////////////////

//From somewhere
function hideafd(){
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs[x].className.indexOf("afd") != -1)
            divs[x].style.display = "none";
    document.getElementById('footer').style.display = 'none';
}

function showafd(){
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs[x].className.indexOf("afd") != -1)
            divs[x].style.display = "";
    document.getElementById('footer').style.display = '';
}

function addlilink(tabs, url, name){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}


//Hybirdization of ABCD afd closer

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 + notbold;
    form.wpWatchthis.checked = false;
}

function afdresult(){
    var res = prompt("Result?");
    if(!res) return;
    var form = document.editform;
    form.wpSummary.value = 'AFD result';
    var txt = form.wpTextbox1;
    txt.value += '{{oldafdfull|date=[[DAY MONTH]] [[2005]]|result=' + res + '|votepage={{subst:PAGENAME}}}}';
    txt.focus();
}

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 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 afdresult(){
    var res = prompt("Result?");
    if(!res) return;
    var form = document.editform;
    form.wpSummary.value = 'AFD result';
    var txt = form.wpTextbox1;
    txt.value += '{{oldafdfull|date=[[DAY MONTH]] [[2005]]|result=' + res + '|votepage={{subst:PAGENAME}}}}';
    txt.focus();
}

//////////////////////////////////////////
// Tabs by Korath
// returns <li><a href="url">name</a></li>
/////////////////////////////////////////
function addlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);

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

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

// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function edit_summary_watch(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += msg;
  f.wpSummary.value = summ;
}

function testn(number)
{
  var page = prompt("Vandalism to which article?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "test" + number + "-n|" + page + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Vandalism to [[" + page + "]] - warning " + number;
}

// adds various tabs to call the above
function add_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

  // Only add for pages with "Editing User talk:" somewhere in the title
  if (document.title.indexOf("Editing User talk:") != -1)
    {
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:anon}} ~" + "~" + "~" + "~", "{{" + "anon}}", false, 0)',"Anon"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "User:Celestianpower/welcome}} ~" + "~" + "~" + "~", "Welcome!", false, 0)',"Welcome!"));
      tabs.appendChild(addlilink('javascript:testn(1)',"t1"));
	  tabs.appendChild(addlilink('javascript:testn(2)',"t2"));
	  tabs.appendChild(addlilink('javascript:testn(3)',"t3"));
	  tabs.appendChild(addlilink('javascript:testn(4)',"t4"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test5}} ~" + "~" + "~" + "~", "You have been blocked!", true, 1)',"t5"));
    }
	
if (document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1)
    {
        tabs.appendChild(addlilink('javascript:closeafd("keep", "")', 'Keep', ''));
        tabs.appendChild(addlilink('javascript:closeafd("delete", "")', 'Delete', ''));
        tabs.appendChild(addlilink('javascript:closeafd(prompt("Result?"), "")', 'Other', ''));
    }

    if(document.title.indexOf("Confirm delete - Delete") != -1)
    {
        tabs.appendChild(addlilink('javascript:afddelete()', 'AFD', ''));
    }

    if(document.title.indexOf("Editing ") != -1){
        tabs.appendChild(addlilink('javascript:replace()', 'Replace', ''));
    }

    if(document.title.indexOf("Editing Talk:") != -1){
        tabs.appendChild(addlilink('javascript:afdresult()', 'AFDr', ''));
    }


}

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

///////////////////////////////////////////////////////////////////
// AutoAFD by Korath
// This needs to change depending on skin used.
//////////////////////////////////////////////////////////////////
function add_link2(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
  na.appendChild(document.createTextNode(name));

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

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

function strip_namespace(target)
{
  var colon = target.indexOf(':');
  if (colon != -1)
    {
      var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');
      var ns = target.substring(0, colon);
      if (ns == '' || ns == 'Talk')
        return target.substring(colon + 1);
      else
        for (var i = 0; i < spaces.length; ++i)
          {
            if (ns == spaces[i]
                || ns == spaces[i] + '_talk')
              return target.substring(colon + 1);
          }
    }

  return target;
}

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

  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6,
                            target.lastIndexOf('&action=submit'));

  var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
  var date = new Date();
  date = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();

  var pagename = strip_namespace(target);

  window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/' + pagename + '&action=edit&fakeaction=afdsub&faketarget=' + target,
              'Afd ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizeable,scrollbars');
  window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/Log/' + date + '&action=edit&fakeaction=afdlist&faketarget=' + pagename,
              'AfdLog ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}

function autoafd()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }

      if (action == 'afdlist')
        {
          document.editform.wpTextbox1.value += '{{' + 'subst:afd3|pg=' + target + '}}\n';
          document.editform.wpSummary.value = '[[Wikipedia:Articles for deletion/' + target + ']]';
        }
      else if (action == 'afdsub')
        {
          if (document.editform.wpTextbox1.value.length > 0)
            {
              target = document.editform.action;
              target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'))).replace(/_/g, ' ');
              window.alert("There's an old afd at the default location already.\n\n" +
                           'Please either move it out of the way (and update existing links to it), or file the Afd by hand in another location (such as [[' + target + ' (2)]]).');
            }
          else
            document.editform.wpTextbox1.value += '{' + '{' + 'subst:afd2|pg=' + target + '|text=' + '}' + '}' +
  '-- ~' + '~' + '~' + '~\n' +
              '\n*\'\'\' \'\'\'\n*\'\'\' \'\'\'\n*\'\'\' \'\'\'\n';
        }
      else
        add_link2('javascript:afd()', 'Afd');
    }
}

if (window.addEventListener)
  window.addEventListener('load', autoafd, false);
else if (window.attachEvent)
  window.attachEvent('onload', autoafd);

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

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

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

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

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

  if (target == '')
    return;

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

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

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

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

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

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

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

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

}

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

//From User:Func
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() // pre-load, (don't want to slow down loading of article's content, though)
	{

	}

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

			//	This is inefficient and not particularly robust.
			//	This comes first, I want this link to come up as
			//	fast as possible.
			//
		function GetByClass( sElem, sClass )
		{	var i, a2 = [], a = document.getElementsByTagName( sElem );
			for ( i = 0; i < a.length; i++ )
				if ( a[ i ].className == sClass )
					a2.push( a[ i ] );
			return a2;
		}
		var a, td = GetByClass( 'td', 'diff-otitle' );
		if ( ( td = td[ 0 ] ) && ( a = td.getElementsByTagName( 'a' )[ 0 ] ) )
			a.href = a.href + '&action=edit'; // need to change text, later

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

			// personal (top-most) menu
			//
			//		Celestianpower  Háblame  Prefs  Watchlist  Contribs  Kate  VAN  ESP  Log out  <UTCdate>
			//
		UserMenu.setText( 'pt-mytalk'     , 'Talk'  );
		UserMenu.setText( 'pt-preferences', 'Prefs' );
		UserMenu.setText( 'pt-watchlist'  , 'Watchlist' );
		UserMenu.setText( 'pt-mycontris'  , 'Contribs' );
		UserMenu.setText( 'pt-logout'     , 'Log out'   );
			//
		UserMenu.setHref( 'pt-mycontris',
			'http://en.wikipedia.org/w/index.php?title=Special:Contributions&target=' +
			userName + '&offset=0&limit=500' );
			//
			//
			//	it seems there is a stylesheet that makes them lowercase
			//
			//		ok, the lowercased menu items are starting to really bug me:
			//
		document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0].style.textTransform = 'none';
			//
		UserMenu.insertBefore( 'pt-logout'     , 'pt-kate', 'Kate',
			'javascript:void InlineKate( "' + userName + '" )' );
                if(document.getElementById('ca-edit'))
                       document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
			//	so I always know what time it is in UTC land:
			//
		UserMenu.append( 'pt-utc', UTCTime(), 'javascript:void UserMenu.setText("pt-utc",UTCTime())' );

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

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

                        PageMenu.setText( 'ca-edit'     , 'Edit'   );
                        PageMenu.setText( 'ca-history'     , 'History'   );
                        PageMenu.setText( 'ca-delete'     , 'Delete'   );
		}

		var x = 1;
		NavMenu.append( 'n-' + x++, 'monobook.js', '/wiki/User:' + userName + '/monobook.js' );
        NavMenu.append( 'n-' + x++, 'AfDs to be closed', 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Old' );
	}

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

			//	sigh...as far as I can figure, there is empty whitespace being treated
			//	as TextNodes....
			//
		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 ] );
		}

			//	the ByTagName here is a bit annoying, but in Safari, I was picking
			//	up TextNodes by using this[ id ].firstChild.firstChild
			//
		this.getText = function( id      ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data }
		this.setText = function( id, txt ) {        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 }
		
		//	I add em as I need em....
	}

	function InlineKate( user )
	{
		var kate =
			'http://tools.wikimedia.de/~kate/cgi-bin/count_edits?dbname=enwiki&user=' + user;

		var div = document.createElement( 'div' );
			div.id = 'inlineKateDiv';
			div.style.position = 'absolute';
			div.style.zIndex   = 1000;
			div.style.left     =  '20px';
			div.style.top      =  '20px';
			div.style.backgroundColor = '#FFFFFF';
			div.style.borderStyle     = 'solid';
			div.style.borderWidth     = ' medium';
			div.style.borderColor     = '#000000';

			var top = document.createElement( 'div' );
				top.id = 'inlineKateTop';
				top.style.textAlign = 'right';
				top.style.margin = '8px';
				top.style.backgroundColor = '#DDDDDD';

				var a = document.createElement( 'a' );
					a.appendChild( document.createTextNode( "Go to Kate's" ) );
					a.href    = kate;
					a.target  = '_parent';
					a.style.margin = '8px';

				top.appendChild( a );

					a = document.createElement( 'a' );
					a.appendChild( document.createTextNode( 'Close' ) );
					a.href    = "javascript:void RemoveNode('inlineKateDiv')";
					a.style.margin = '8px';

				top.appendChild( a );

			div.appendChild( top );

			var iframe = document.createElement( 'iframe' );
				iframe.id   = 'inlineKateBot';
				iframe.style.width  = '300px';
				iframe.style.height = '400px';
				iframe.style.margin =   '8px';
				iframe.style.borderStyle = 'solid';
				iframe.style.borderWidth = 'thin';
				iframe.style.borderColor = '#000000';
				iframe.src = kate;

			div.appendChild( iframe );

		document.body.appendChild( div );
	}

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

	function UTCTime()
	{
			//	Get a date stamp for the time in UTC-land.
			//
			//	for the future: a format arg
			//
		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 );
}

function NUPatrol()
{
	if (	( window.location.href.indexOf( 'Special%3ALog&type=newusers' ) == -1 ) &&
			( window.location.href.indexOf( 'Special:Log/newusers'        ) == -1 )  )
	return; // make more robust???

	var items, item, i, links, user, name, talk, contribs, insertLoc, link;

	items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );

	function NewLink( txt, url, plainlinks, linkColor )
	{	var a = document.createElement( 'a' );
			a.appendChild( document.createTextNode( txt ) );
			a.href = url;
		if ( plainlinks ) a.className = 'plainlinks';
		if ( linkColor )
		{	if ( typeof linkColor == "string" )
					a.style.color = linkColor;
			else	a.style.color = '#FF0000'; // old default behavior
		}
		return a;
	}

	for ( i = 0; i < items.length; i++ )
	{
		item = items[ i ];
		
		links = item.getElementsByTagName( 'a' );

			user = links[ 0 ]; name = user.firstChild.nodeValue;
			talk = links[ 2 ]; talk.firstChild.nodeValue = 'talk'; // lowercase 'Talk' for consistency
		contribs = links[ 3 ];

		insertLoc = user.nextSibling; // ' newusers '

		item.insertBefore( document.createTextNode( ' ( ' ), insertLoc );

		item.insertBefore( talk, insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( contribs, insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'actions', '/w/index.php?title=Special%3ALog&user=' + name, true, '#000088' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'blocks', '/w/index.php?title=Special%3ALog&type=block&page=User%3A' + name, true, '#008800' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'is blocked?', '/wiki/Special:Ipblocklist?action=search&ip=' + name, true, '#888800' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'do block!', '/w/index.php?title=Special:Blockip&ip=' + name, true, '#880000' ), insertLoc );

		item.insertBefore( document.createTextNode( ' )' ), insertLoc );

		item.removeChild( insertLoc.nextSibling ); // should remove the span
		item.removeChild( insertLoc ); // should remove ' newusers ' text
	}
}

if ( window.addEventListener ) window.addEventListener( 'load', NUPatrol, false );
else if ( window.attachEvent ) window.attachEvent( 'onload', NUPatrol );

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

inc("User:Topaz/init.js");
inc("User:Topaz/util.js");
inc("User:Topaz/comm.js");
inc("User:Topaz/wputil.js");
inc("User:Essjay/statuschanger.js");

// </nowiki> //


// ============================================================ 
// BEGIN Enable multiple onload functions 
// setup onload functions this way: 
// aOnloadFunctions[aOnloadFunctions.length] = function_name; 
// without brackets! 

if (!window.aOnloadFunctions) { 
 var aOnloadFunctions = new Array(); 
} 
window.onload = function() { 
 if (window.aOnloadFunctions) { 
  for (var _i=0; _i<aOnloadFunctions.length; _i++) { aOnloadFunctions[_i](); } 
 } 
} 

// END Enable multiple onload functions 
// ============================================================ 

function addLoadEvent(func) { 
 if (window.addEventListener) window.addEventListener("load", func, false); 
 else if (window.attachEvent) window.attachEvent("onload", func); 
}
 
function interwikiExtra() {  
 // iterate over all <span>-elements 
 for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {   
  // if found a linkInfo span 
  if(a.className == "interwiki-info") {   
   // iterate over all <li>-elements 
   var count=0; for(var j=0; b = document.getElementsByTagName("li")[j]; j++) { 
    if(b.className == "interwiki-" + a.id) { 
     b.innerHTML = b.innerHTML + " "+a.title; 
     if(a.title == "(vo)") { b.title = "Texte original"; }
    } 
    else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) { 
     count = count+1; 
     if(a.id.charAt(a.id.length-1) == count) { b.innerHTML = b.innerHTML + " "+a.title; } 
    } 
   } 
  } 
 } 
} 
addLoadEvent(interwikiExtra); 

function dotabs() {    
 //first tab 
 var a = document.getElementById("ca-nstab-main"); var s = a.innerHTML; var i = s.indexOf('Article');  
 if(a){ 
  if( document.getElementById("Author") ) { 
   a.innerHTML = s.substring(0,i)+"Author"+s.substring(i+7,s.length-1); 
  } 
  q = document.getElementById("textquality") if( q ) { 
   var image = ""; 
   if( q.className == "0%") { image = " <img src='http://upload.wikimedia.org/wikipedia/commons/8/8f/00%25.png' alt='' width='9' height='9' longdesc='' />"; } 
   if( q.className == "25%") { image = " <img src='http://upload.wikimedia.org/wikipedia/commons/5/5b/25%25.png' alt='' width='9' height='9' longdesc='' />"; } 
   if( q.className == "50%") { image = " <img src='http://upload.wikimedia.org/wikipedia/commons/3/3a/50%25.png' alt='' width='9' height='9' longdesc='' />"; } 
   if( q.className == "75%") { image = " <img src='http://upload.wikimedia.org/wikipedia/commons/c/cd/75%25.png' alt='' width='9' height='9' longdesc='' />"; } 
   if( q.className == "100%") { image = " <img src='http://upload.wikimedia.org/wikipedia/commons/6/64/100%25.png' alt='' width='9' height='9' longdesc='' />"; } 
   a.innerHTML = s.substring(0,i+7)+image+s.substring(i+7,s.length-1); 
  } 
 } 
 //2nd tab 
 if( document.getElementById("infoedit") ) { 
  var b = document.getElementById("ca-talk"); 
  if(b){ 
   var s = b.innerHTML; var i = s.indexOf('Discussion'); 
   b.innerHTML = s.substring(0,i)+"Source"+s.substring(i+10,s.length-1); 
  } 
 } 
} 
addLoadEvent(dotabs); 

function BilingualLink() { 
 if( document.body.className != "ns-0" ) return; 
 var doc_url = document.URL; var url = '';  
 // iterate over all <li>-elements 
 for(var j=0; b = document.getElementsByTagName("li")[j]; j++) { 
  if(b.className.substring(0,10) == "interwiki-" ) { 
   var lang = b.className.substring(10,b.className.length); 
   if( doc_url.indexOf('?title=') != -1 ) { 
    var qm = doc_url.indexOf('&match='); 
    if( qm != -1 ) url = doc_url.substring(0,qm)+"&match="+lang; 
    else url = doc_url+"&match="+lang; 
   } 
   else { 
    var qm = doc_url.indexOf('?'); 
    if( qm != -1 ) url = doc_url.substring(0,qm)+"?match="+lang; 
    else url = doc_url+"?match="+lang; 
   } 
   b.innerHTML = b.innerHTML+ "<a href='"+url+"'> &hArr;</a>"; 
  } 
 } 
} 
addLoadEvent(BilingualLink); 

/* </pre> */