User:AmiDaniel/junk.js

Source: Wikipedia, the free encyclopedia.
<
User:AmiDaniel
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> */



//Please leave the following line
//user:Where/usertabs

$(function() {
  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history
     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/wiki/Special:Contributions/" + username, "contribs", "ca-contrib", "contribs", "");
     addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=&user=" + username, "logs", "ca-logs", "logs", "");
     addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&page=User:" + username, "block log", "ca-blog", "blog", "");
  }
})

function addOldids(){
    var re=/index[.]php[?]title=[^&]*&oldid=(\d+)$/;
    var len=document.links.length;
    for (var i=0; i<len; ++i) {
        var a=document.links[i];
        if (re.test(a.href)) {
            var m=a.href.match(re);
            a.innerHTML += ' (' + m[1] + ')';
        }
    }
}
// for testing from monobook.js: 

if (window.location.href.indexOf("&action=history") != -1)
{
$(addOldids);
}

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

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

/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */

/**
 * [[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]]
 **/

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

/*** Includes ***/
inc("User:Lupin/popups.js");
inc("User:Interiot/Tool2/code.js");

/*** Popups customisations, see [[Wikipedia:Tools/Navigation popups]] ***/
popupFixRedirs = true;
popupRedirAutoClick = 'wpPreview';
popupFixDabs = true;
popupStructure = 'menus';

/*** Hooks ***/
$(AddTime);
$(addPurge);
$(addEditSection0);
$(changeLinks);
$(morelinks);
$(addToolBoxLinks);
$(akeytt);
$(addNavBarLinks);
$(addGoogle);
$(function (){
	if(document.title.indexOf("Confirm delete -") == 0) {
		var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
		addlilink(tabs, "javascript:csd('5 day old, undisputed prod')", 'prod')
	}
});
$(function () {
	if(document.forms.editform) {
		addLink('p-cactions', 'javascript:replace()', 'replace', 'ca-replace', 'Regexp replace for the edit window', '', 'ca-history');
	}
	});

$(function () {
if (document.getElementById('t-contributions')) {
	z=document.getElementById("content").childNodes;
	for (var n=0;n<z.length;n++) { 
		if (z[n].className=="firstHeading") var username = z[n].textContent.replace(new RegExp('User:([^/]*)', 'g'), '$1');
	};
	var toolbox = document.getElementById('p-tb').getElementsByTagName('ul')[0];
	addlilink(toolbox, '/w/index.php?title=Special:Log&user='+username, 'User Logs');
}});
function replace2(s, r) {
	if(s) {
		if(!r && r != '') return;
		var txt = document.editform.wpTextbox1;
		txt.value = txt.value.replace(new RegExp(s, "g"), r);
	}
}
function csd(text){
	var reason = document.getElementById('wpReason');
	reason.value = text;
        document.forms[0].wpConfirmB.click();
}
$(function () {
	if(document.forms.editform) {
		var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
		addlimenu(tabs, 'replace', 'replf');
		var replf = document.getElementById('replf').getElementsByTagName('ul')[0];
		addlilink(replf,"javascript:replace2('(\\n)','$1$1')",'Double whitespace', '');		
	}
	});


/*** GENERIC FUNCTIONS ***/

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

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

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

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);
	}
}
	
/**** 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 wrapper for addlilink ***/
function addTab(url, name, id, title, key){ 
	var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
	addlilink(tabs, url, name, id, title, key);
}

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


/*** 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');
}
	
/*** Adds a link for the clock ***/
function AddTime() {
	var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
	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 = timeValue2 /*+ "<br>" + timeValue2;*/
	timerID = setTimeout('showtime()', 100);
}

/*** AFD FUNCTIONS ***/

/*** 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) {

	}
}
	
/*** 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:AmiDaniel/Sandbox', 'My sandbox', ''); 
}

$(StatusChange);

/*** Status changer ***/
function StatusChange() {
  var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;
  var subpage = "/Status";
  var scheme = "/StatusDiv";
  var table = "/StatusTable";
  var linkprefix = "http://en.wikipedia.org/w/index.php?title=User:";
  var contribs = document.getElementById( 'pt-mycontris' );
  //Add the links
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=online", "(on", "pt-status-here", "Here", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=busy", "busy", "pt-status-busy", "Busy", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=away", "away", "pt-status-away", "Out", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=sleeping", "sleep)", "pt-status-fish", "Fish", "");
  if (location.href.indexOf("User:"+user+subpage+"&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  status = location.href.split("=");
  status = status[status.length-1];
  //Modify the form
  document.getElementById('wpTextbox1').value = "{{User:"+user+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "Status: "+status;
  document.getElementById('wpMinoredit').checked = 'checked';
  //Submit it!
  document.getElementById('editform').submit();
}

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