Jump to content

User:Crazynas/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.
 /* <pre><nowiki> */
 /*********************************************************************************
 * 
 * http://en.wikipedia.org/wiki/User:Kylu/monobook.js
 * [[User:Crazynas/monobook.js]]
 *
 * THERE IS STUFF IN HERE THAT IS USERNAME-SPECIFIC.
 * IF YOU BORROW THESE SCRIPTS, PLEASE MAKE SURE YOU
 * EDIT THEM SO IT SHOWS _YOUR_ USERNAME INSTEAD. THANK YOU.
 *
 * Licensing:
 *   Parts dual-licensed by other authors under GPL and GFDL.
 *   My modifications are purely GFDL.
 *
 *   Please see individual authors for licensing specifics:
 *   From [[User:Bookofjude]]
 *    [[User:Bookofjude]]'s monobook.js, based on primarily on [[User:Wayward]]'s, 
 *    which in turn is based on [[User:Alphax/monobook.js]]'s
 *    with many of [[User:Wayward]]'s own mods
 *    Must use [[User:Wayward/monobook.css]] for full tab functionality
 *    Forked from [[User:ABCD/monobook.js]] around April 2005
 *    Dual licensed under the GFDL and GPL
 *    See also: [[User:JesseW/monobook.js]]
 *    And best of all: [[WP:US]]
 *   From godlike.js:
 *    Sam Hocevar <[email protected]>
 *   From [[User:Essjay]]
 *    [[User:Essjay]]'s monobook.
 *
 *   Mirrored from Klyu
 *
 *********************************************************************************/

/*********************************************************************************/
// * SCRIPT SECTION: INCLUDE * //
/*********************************************************************************/
// This script fragment makes it easier to include scripts from other pages onto this.
// Handy-dandy.
/*** [[User:Lightdarkness]]'s include function ***/
function inc (file) {
  mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s');
}

/*********************************************************************************/
// * SCRIPT SECTION: INCLUDED SCRIPTS * //
/*********************************************************************************/

/* POPUPS STUFF */

inc("User:Lupin/popups.js");

//popups options:
simplePopups=false;
popupAdminLinks=true;
popupFixRedirs=true;
popupFixDabs = true;
popupDelay=0.15;
popupSubpopups=false;
popupNavLinkSeparator=' &bull; ';
popupRedirAutoClick = 'wpPreview';

//Beta!
popupLiveOptions=true;
popupLiveOptionsExpanded=false;

// Everyone knows what PopUps are, why advertize?
// Will happily remove this section if anyone complains.
popupRedlinkSummary='Removing link to empty page [[%s]]';
popupFixDabsSummary='Disambiguate [[%s]] to [[%s]]';
popupFixRedirsSummary='Redirect bypass from [[%s]] to [[%s]]';
popupExtendedRevertSummary='Revert to revision dated %s by %s, oldid %s';
popupRevertToPreviousSummary='Revert to the revision prior to revision %s';
popupRevertSummary='Revert to revision %s';
popupRmDabLinkSummary='Remove link to dab page [[%s]]';

/* END OF POPUPS STUFF */

// Jude's got a fairly new version, may as well use it.
inc("User:Crazynas/godmode.js");

// Yeah, I troll AfD looking for helpless articles to destroy...
inc("User:Jnothman/afd_helper/script.js");

// Name me a regular editor who DOESN'T use this...
inc("User:Interiot/Tool2/code.js");

// Handy-dandy useful script.
inc("User:MarkS/extraeditbuttons.js");

// Topaz's scripts.
inc("User:Topaz/init.js");
inc("User:Topaz/util.js");
inc("User:Topaz/comm.js");
inc("User:Topaz/wputil.js");


/*********************************************************************************/
// * SCRIPT SECTION: INHERENT SCRIPTS * //
/*********************************************************************************/

/*********************************************************************************
 * This is the fun section where I put all the scripts I've stolen from other
 * editors. I think I suffer from "button envy", where I need to have all the
 * fun editing features right at my fingertips at all times.
 *
 * Probably not healthy. If I get cancer, you know why.
 *
 *********************************************************************************/

/**** Initialize on window load ****/
/****
 **** This section loads the scripts so they actually, y'know, work.
 ****
 ****/

addOnloadHook( myLoadFuncs );
/* addOnloadHook(AddTime); */
addOnloadHook(addPurge);
addOnloadHook(changeRecent);
addOnloadHook(addEditSection0);
addOnloadHook(changeLinks);
addOnloadHook(morelinks);
addOnloadHook(addToolBoxLinks);
addOnloadHook(addWatch);
addOnloadHook(akeytt);
addOnloadHook(addNavBarLinks);
addOnloadHook(addGoogle);
addOnloadHook(function () {
	if(document.forms.editform) {
		addLink('p-cactions', 'javascript:replace()', 'replace', 'ca-replace', 'Regexp replace for the edit window', '', 'ca-history');
	}
	});


/**** Load custom functions ****/

/**** This section is required for many other sections,
 **** if a copied function doesn't work, make sure you
 **** included these and have it addOnloadHook'd (see above)
 ****/

function myLoadFuncs()
{
    if(!document.getElementById) return;
    // add a clock
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    addlilink(toplinks, '#', '', 'utcdate');
    showtime();
    morelinks();
}

/**** Add generic tab ****/

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

/***************************************
* Tabs by Korath
* returns <li><a href="url">name</a></li>
****************************************/

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

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

/*** Gets a 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;
  };
}
	
/*** Gets a username on userpages ***/
function getUname() {
	return document.URL.match(/:.*:(.*)/)[1];
}

/*** Adds something to the contentSub ***/
function addcsub(name, link)
{
	var csub = document.getElementById('contentSub');
	var csuba = document.createElement('a');
	csuba.href = link;
	csuba.appendChild(document.createTextNode(name));
	csub.appendChild(csuba);
	return csuba;
}


// Adds "block" and "blocklog" tabs to User: and User talk: pages.
function add_block_tab(){
    var c1 = document.getElementById('column-one');
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    // use the "edit this page" tab to get already-tidied url
    var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
    // cut everything up to "title=" from the start and everything past "&action=edit" from the end
    editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
    editlk = editlk.substring(editlk.indexOf(':') + 1);
    var slloc = editlk.indexOf('/');
    if(slloc > 0) editlk = editlk.substring(0, slloc);

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

    // add "blocklog" tab
    addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');
    
    // add "unblock" tab
    //addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');

    // add "contributions" tab
    addTab('/wiki/Special:Contributions/' + editlk, 'con');
    
    // add "edit count" tab
    addTab('http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=' + editlk + '&dbname=enwiki_p', 'count');
 
    // add "whois" tab
    addTab('http://tools.wikimedia.de/~essjay/nqt.php?queryType=arin&target=' + editlk, 'who');
   
    // add "proxycheck" tab
    addTab('http://quyme.com/proxycheck.php?ip=' + editlk, 'proxy');
}

// Do useful thinks on Special:Log/newusers //

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
	}
}

/**** Tabs and functions ****/
	
// Add test-n templates to user talk pages
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:" + number + "-n|" + page + "}} ~~~~";
	f.wpSummary.value = "Your edits to [[" + page + "]]"
	document.editform.wpWatchthis.checked = false; 
}
	
// Add duration for s/block by                                  
function duration(number)                                             
{                                                                    
	var duration = prompt("Block duration")                            
	var f = document.editform, t = f.wpTextbox1;                        
	if (t.value.length > 0)                                             
	t.value += '\n';                                                   
	t.value += "{{s/block2|signature=~~~~|time=" + duration + "}}";     
	f.wpSummary.value = "You have been blocked for " + duration + ""    
	document.editform.wpWatchthis.checked = false;                                                         
}
	

// 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;
	f.wpWatchthis.checked = watch;
}
	
// Places perm block and name block tags at top of edit section,         
// and marks or unmarks the "Watch this page" checkbox according to watch  
function perm_name_block(msg, summ, watch)                                
{                                                                          
	var f = document.editform, t = f.wpTextbox1;                            
	if (t.value.length > 0)                                                
	t.value += '\n';                                                  
	var temp = t.value;                                                    
	t.value = msg;                                                         
	t.value += '\n\n';                                                     
	t.value += temp;                                                         
	f.wpSummary.value = summ;                                                
	f.wpWatchthis.checked = watch; 
}

function addLink(where, url, name, id, title, key, after){
	//* where is the id of the toolbar where the button should be added;
	//   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
	//
	//* url is the URL which will be called when the button is clicked.
	//   javascript: urls can be used to do more complex things.
	//
	//* name is what will appear as the name of the button.
	//
	//* id is the id of the button; it's best to define one.  
	//   Use a prefix to make sure its unique. Optional.
	//
	//* title is the tooltip title that gives a longer description 
	//   of the button; if you define a accesskey, mention it here. Optional.
	//
	//* key is the char you want for the accesskey. Optional.
	//
	//* after is the id of the button you want to follow this one. Optional.
	//
	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;
}

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

/*** Edit section 0 ***/
function addEditSection0()
{
	ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
	if(!document.getElementById) return;
	var x = document.getElementById('ca-edit');
	if(!x) return;
	var 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';
	}
	var 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);
	}
}

/*** Add purge tab ***/
function addPurge()
{
	ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
	if(!document.getElementById) return;
	var x = document.getElementById('ca-history');
	var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
	if(!x) return;
	if(x.children) x = x.children[0];
	else x = x.childNodes[0];
	
	var pf = document.createElement('form');
	pf.action = '?action=purge';
	pf.method = 'POST';
	pf.id = 'pf';
	x.appendChild(pf);
	
	addlilink(tabs, 'javascript:document.getElementById("pf").submit();', 'purge', 'ca-purge');
}
	
/*** Add article watchlist tab ***/
function addWatch()
{
	if (!location.href.indexOf("Special:") == -1) {
	ta['ca-watchlist'] = ['u', 'Add this article to Wikibot watchlist'];
	if(!document.getElementById) return;
	var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
	// use the "edit this page" tab to get already-tidied url
	var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
	// cut everything up to "title=" from the start and everything past "&action=edit" from the end
	editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
	addlilink(tabs, 'http://192.168.0.64/rc.php?watchlist=' + editlk, 'watchlist', 'ca-watchlist', 'ca-watchlist');	
	}
}

/*** Add google tab ***/
function addGoogle() 
{
	var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
	addlilink(tabs, 'http://www.google.com.au/search?q=' + getPname(), 'google',  'ca-google', 'ca-google');
}
	
/*** Change recent changes link ***/
	
function changeRecent()
{
	var portlet = document.getElementById('n-recentchanges');
	portlet.innerHTML = "<a href=\"http://192.168.0.64/rc.php\">Recent changes</a>";
}

/*** Add afd header, footer and comment ***/
function closeafd(bold, notbold)
{
	var txt = document.editform.wpTextbox1;
	txt.value = "{{subst:vt}} '''" + bold + "'''" + notbold + ". &ndash; ~~~~\n" + txt.value
	+ "\n{{subst:vb}}\n";
	txt = document.editform.wpSummary;
	txt.value = "close discussion: " + bold + notbold;
	document.editform.wpWatchthis.checked = false;
}
	
/*** Talk page AFD result ***/
function afdresult()
{
	var res = prompt("Result?");
	if(!res) return;
	var afddate = prompt("Nomination date?");
	document.editform.wpSummary.value = 'AFD result - ' + res.replace(/'/g, '');
	var txt = document.editform.wpTextbox1;
	if(txt.value.length > 0) txt.value += '\n';
	txt.value += '{{oldafdfull|date=[[' + afddate + ']] [[{{subst:CURRENTYEAR}}]]|result=' + res + '|votepage={{subst:PAGENAME}}}}';
	txt.focus();
}
	
/*** Make old AfD's appear or disappear ***/
	
function hideafd()
{
	var divs = document.getElementsByTagName("div");
	for(var x = 0; x < divs.length; ++x)
		if(divs[x].className.indexOf("vfd") != -1)
		divs[x].style.display = "none";
	document.getElementById('footer').style.display = 'none';
}
	
function showafd()
{
	var divs = document.getElementsByTagName("div");
	for(var x = 0; x < divs.length; ++x)
		if(divs[x].className.indexOf("vfd") != -1)
		divs[x].style.display = "";
	document.getElementById('footer').style.display = '';
}

/*** Not sure how this works ***/
	
function afddelete(){
	//    var form = document.forms.deleteconfirm;
	//    form.wpReason.value = '[[Wikipedia:Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')) + ']]';
	//    form.wpConfirm.checked = true;
}

	
/*** Make the top links look better ***/
	
function changeLinks()
{
	if(!document.getElementById) return;
	document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
	document.getElementById('pt-preferences').firstChild.innerHTML = 'preferences';
	document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist';
	document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions';
}
	
/**** Automatically-updating word count on edit pages ****/

/*** Count words in a field ***/
function countWords(field) { 
	return field && field.value ? field.value.split(/\s+/).length : 0;
}

/*** Creates div ***/ 
function doWordCount() {
	if (document.title.slice(0,7) == "Editing") {
	var x = document.getElementById('editpage-copywarn');
	var y = document.getElementById('editform');
	if (x && y && y.wpTextbox1) {
		var z = document.createElement('div');
		z.id = 'word-count';
		x.appendChild(z);
		refreshCount();
	} else {
		alert('Missing element needed for word count');
	}
	}
}

/*** Auto-updated ***/
function refreshCount() {
	var wc = '<small>Word count: ' + countWords(document.getElementById('editform').wpTextbox1) + '</small>';
	document.getElementById('word-count').innerHTML = wc;
	setTimeout(refreshCount, 10000);
}


function morelinks() {
	var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
	if(document.title.indexOf("Editing User talk:") == 0) {
	  addlimenu(tabs, 'Talk page messages', 'talkm');
	  var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
	// Welcome menu      
	  addlimenu(talkm, 'Welcome', 'welcomess');
	  var welcomess = document.getElementById('welcomess').getElementsByTagName('ul')[0];
	  addlilink(welcomess,'javascript:edit_summary_watch("{{subst:User:Bookofjude/Welcome}}  ~~~~", "Welcome to Wikipedia!", true, 1)','Welcome', '');
	  addlilink(welcomess,'javascript:edit_summary_watch("{{subst:Anon}}  ~~~~", "Welcome to Wikipedia!", true, 1)','Anon', '');
	// Test menu
	  addlimenu(talkm, 'Test[x]', 'testx');
	  var testx = document.getElementById('testx').getElementsByTagName('ul')[0];
	  addlilink(testx,'javascript:testn("nn-test")','Non-notable test', '');
	  addlilink(testx,'javascript:testn("test0")', 'Test0', '');
	  addlilink(testx,'javascript:testn("test1")', 'Test1', '');
	  addlilink(testx,'javascript:testn("test2")','Test2', '');
	  addlilink(testx,'javascript:testn("test2a")','Test2a', '');
	  addlilink(testx,'javascript:testn("test3")','Test3', '');
	  addlilink(testx,'javascript:testn("test4")','Test4', '');
	  addlilink(testx,'javascript:testn("test4-im")','Only warning', '');
	  addlilink(testx,'javascript:testn("User:Bookofjude/tpv1")','Talk page vandalism 1', '');
	  addlilink(testx,'javascript:edit_summary_watc("{{subst:wr}}  ~~~~", "Blanking your talk page", false, 1)', 'Warning blankings 1', '');
	// Blatant vandalism
	  addlimenu(talkm, 'Blatant vandalism', 'bv')
	  var bv = document.getElementById('bv').getElementsByTagName('ul')[0];
	  addlilink(bv,'javascript:testn("vw")','Blatant vandalism 1', '');
	  addlilink(bv,'javascript:testn("bv")','Blatant vandalism 2', '');
	  addlilink(bv,'javascript:edit_summary_watch("{{subst:blanking}}  ~~~~", "Blanking pages", false, 1)','blanking', '');
	// Spam
	  addlimenu(talkm, 'Spam', 'spam');
	  var spam = document.getElementById('spam').getElementsByTagName('ul')[0];
	  addlilink(spam,'javascript:edit_summary_watch("{{subst:spam1}}  ~~~~", "Adding links to Wikipedia", false, 1)','Spam1', '');
	  addlilink(spam,'javascript:edit_summary_watch("{{subst:spam2}}  ~~~~", "Spamming", false, 1)','Spam2', '');
	  addlilink(spam,'javascript:edit_summary_watch("{{subst:spam3}}  ~~~~", "Last warning for spamming", false, 1)','Spam3', '');
	  addlilink(spam,'javascript:edit_summary_watch("{{subst:spam4}}  ~~~~", "You have been blocked for spamming", false, 1)','Spam4', '');
	// Talk page messages
	  addlimenu(talkm, 'Talk messages', 'tkm');
	  var tkm = document.getElementById('tkm').getElementsByTagName('ul')[0];
	  addlilink(tkm,'javascript:edit_summary_watch("{{subst:Summary}}  ~~~~", "Edit summaries", false, 1)','Edit summary 1', '');
	  addlilink(tkm,'javascript:edit_summary_watch("{{subst:Mess2}}  ~~~~", "Messages in articles", false, 1)','Messages 1', '');
	  addlilink(tkm,'javascript:edit_summary_watch("{{subst:Comment2}}  ~~~~", "Messages in articles", false, 1)','Messages 2', '');
	  addlilink(tkm,'javascript:edit_summary_watch("{{subst:Comment3}}  ~~~~", "Messages in articles", false, 1)','Messages 3', '');
	  addlilink(tkm,'javascript:edit_summary_watch("{{subst:Vanity|}}  ~~~~", "About the page you created", false, 1)','Vanity', '');
	  addlilink(tkm,'javascript:edit_summary_watch("{{subst:nothanks|}}  ~~~~", "About your edits", false, 1)','nothanks', '');
	  addlilink(tkm,'javascript:edit_summary_watch("{{subst:nothanks-sd|pg=page name|url=url of source}}  ~~~~", "{{nothanks-sd}}", false, 1)','nothanks-sd', '');
	  addlilink(tkm,'javascript:rvfd(1)', 'rvfd', ''); 
	// Block messages
	  // addlilink(talkm,'javascript:duration(1)', 'Temp Block', '');
	  // addlilink(talkm,'javascript:perm_name_block("{{s/block3|signature=~~~~}}", "You have been indefinitely blocked", true, 1)','Perm Block', ''); 
	  // addlilink(talkm,'javascript:perm_name_block("{{subst:nameblock}} ~~~~", "{{nameblock}}", true, 1)','Name Block', ''); 
	} else if(document.title.indexOf("Wikipedia:Articles for deletion") == 0) {
		addlilink(tabs, 'javascript:hideafd()', 'hide closed', 'ca-hide');
		ta['ca-hide'] = ['', 'Hide closed AFDs'];
		addlilink(tabs, 'javascript:showafd()', 'show closed', 'ca-show');
		ta['ca-show'] = ['', 'Show closed AFDs'];
	} else if(document.title.indexOf("User") == 0) {
		addlilink(tabs, '/wiki/Special:Contributions/' + getUname(), 'contributions', 'ca-contribs');
		addlilink(tabs, 'http://192.168.0.64/rc.php?whitelist=' + getUname(), 'whitelist', 'ca-whitelist');
		addlilink(tabs, 'http://192.168.0.64/rc.php?blacklist=' + getUname(), 'blacklist', 'ca-blacklist');
	}
}
	
/*** Add links to the toolbox ***/

function addToolBoxLinks()
	{
	if(document.title.indexOf("User:") == 0) {
		var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
		addlilink(tb, '/wiki/Special:Ipblocklist', 'IPBlocklist', '');
		addlilink(tb, '/wiki/Wikipedia:Template messages/User_talk_namespace', 'Talk templates', '');
		addlilink(tb, '/wiki/Wikipedia:Template_messages', 'Templates', '');
		addlilink(tb, '/wiki/WP:CSD', 'SD criteria', '');
		username_a = document.URL.match(/:.*:(.*)/);
		username=username_a[1];
		addlilink(tb, 'http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?user=' + getUname() + '&lang=en', 'User\'s edit summary calculations');
		addlilink(tb, 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=' + getUname(), 'User\'s edit count', '');
		var username=document.getElementById("pt-userpage").textContent;
		addlilink(tb, 'http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?user=' + username + '&lang=en', 'My edit summary calculations');
		addlilink(tb, 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=' + username, 'My edit count', '');
		addlilink(tb, '/wiki/Special:Log', 'Log', '');
		addlilink(tb, '/wiki/Category:Requests for unblock', 'Unblock requests', '');
	}
}
	
/*** Add navigation bar links ***/
	
function addNavBarLinks() {   
	var navbar = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
	var afdtime = new Date();
	var months = ['January', 'February', 'March', 'April', 'May', 'June',
		'July', 'August', 'September', 'October', 'November', 'December'];
	addlilink(navbar, '/w/index.php?title=Special:Recentchanges&hidemyself=1&hideminor=1&hideliu=1', 'Recent changes 2', '');
	addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
		+ '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), 'Today\'s AfD', '');
	afdtime.setUTCDate(afdtime.getUTCDate() - 5);
	addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
		+ '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), '5-day-old AfD', '');
	var username=document.getElementById("pt-userpage").textContent;
	addlilink(navbar, '/w/index.php?title=User:' + username + '/monobook.js&action=edit', 'My monobook.js', '');   
	addlilink(navbar, '/w/index.php?title=User:' + username + '/monobook.css&action=edit', 'My monobook.css', ''); 
	/* addlilink(navbar, '/wiki/User:Bookofjude/Sandbox', 'My sandbox', ''); <- gotta work on this... */
}
/*** Adds a link for the clock ***/
function AddTime() {
	var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
	addlilink(toplinks, 'http://192.168.0.64/rc.php', 'Recent changes', '');
	addlilink(toplinks, '#', '', 'utcdate');
	showtime();
}

/*** Auto-updating clock ***/
function showtime() {
	var timerID;
	var now = new Date();
	var timeValue = now.toLocaleString().replace(/GMT/, "UTC");
        var timeValue2 = now.toUTCString().replace(/GMT/, "UTC");
	document.getElementById('utcdate').firstChild.innerHTML = timeValue + "<br>" + timeValue2;
	timerID = setTimeout('showtime()', 100);
}


/* </nowiki></pre> */