User:Jklin/surplus.js

// /**** I don't know how any of these work, I am terrible at most types of programming, don't ask. I ****can point you to people who may know. /**** Initialize on window load ****/ /**** **** **** ****/

$( myLoadFuncs ); $(AddTime); $(addPurge); $(changeRecent); $(addEditSection0); $(changeLinks); $(morelinks); $(addToolBoxLinks); $(addWatch); $(akeytt); $(addNavBarLinks); $(addGoogle); $(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  name

/**** 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 0) t.value += '\n'; t.value += "" + page + " Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)"; f.wpSummary.value = "Your edits to " + page + "" document.editform.wpWatchthis.checked = false; }

/*** 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 = "Recent changes"; }

/*** Add afd header, footer and comment ***/ function closeafd(bold, notbold) {	var txt = document.editform.wpTextbox1; txt.value = "
 * The following discussion is an archived debate of the proposed deletion of the article below. Please do not modify it. Subsequent comments should be made on the appropriate discussion page (such as the article's talk page or in a deletion review).  No further edits should be made to this page.  

The result was " + bold + "" + notbold + ". – Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)\n" + txt.value	+ "\n
 * ''The above discussion is preserved as an archive of the debate. Please do not modify it. Subsequent comments should be made on the appropriate discussion page (such as the article's talk page or in a deletion review). No further edits should be made to this page.

\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 += ;	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 = '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 = ' Word count: ' + countWords(document.getElementById('editform').wpTextbox1) + ' '; 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("Hello and welcome to Wikipedia!

Here are some tips to help you get started:
 * If you haven't already, please add your name to the new user log to let others know a little about yourself.
 * Read the Tutorial, and feel free to experiment in the Sandbox.
 * Eventually, you might want to read the Manual of Style and Policies and Guidelines.
 * If you need help, post a question at the Help Desk or ask me on my talk page.
 * To sign your name on a talk page, please finish your comments with   (four tildes). The wiki will insert a link to your userpage and the timestamp.
 * Not every subject needs its own page. Sometimes it is wiser to deal with certain subjects together on one page. See Merge and Redirect for some background. You may want to review Avoiding common mistakes to get started quickly.
 * Explore, be bold in editing pages, and, most importantly, have fun!

Enjoy! If you need any help, please don't hesitate to contact me at User talk:Bookofjude. :-)          -  Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Welcome to Wikipedia!", true, 1)','Welcome', '');	  addlilink(welcomess,'javascript:edit_summary_watch("==Welcome!== Welcome to Wikipedia, the free encyclopedia! You don't have to log in to read or edit articles on Wikipedia, but you may wish to create a account. Doing so is free, requires no personal information, and provides several benefits, including:
 * The use of a username of your choice, provided that it is appropriate.
 * The use of your own watchlist, which shows when articles you are interested in have changed.
 * The ability to create new pages.
 * The ability to rename pages.
 * The ability to edit semi-protected pages.
 * The ability to upload images.
 * The ability to customize the appearance and behavior of the website.
 * Your IP address will no longer be visible to other users.

We hope that you choose to become a Wikipedian and create an account. Feel free to ask me any questions you may have on my talk page. By the way, make sure to sign and date your comments with four tildes (&#126;&#126;&#126;&#126;). Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "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("Please do not remove legitimate warnings from your talk page or replace them with inappropriate content. Removing or maliciously altering warnings from your talk page will not remove them from the page history. You're welcome to archive your talk page, but be sure to provide a link to any deleted legitimate comments. If you continue to remove or vandalize legitimate warnings from your talk page, you will lose your privilege of editing your talk page. Thanks.  Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "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("Please do not replace Wikipedia pages with blank content. Blank pages are harmful to Wikipedia because they have a tendency to confuse readers. If it is a duplicate article, please redirect it to an appropriate existing page. If the page has been vandalised, please revert it to the last legitimate version. If you feel that the content of a page is inappropriate, please edit the page and replace it with appropriate content. If you believe there is no hope for the page, please see the deletion policy for how to proceed. Thanks for contributing to Wikipedia!  Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Blanking pages", false, 1)','blanking', ''); // Spam addlimenu(talkm, 'Spam', 'spam'); var spam = document.getElementById('spam').getElementsByTagName('ul')[0]; addlilink(spam,'javascript:edit_summary_watch("Please do not add inappropriate external links to Wikipedia. Wikipedia is not a mere directory of links nor should it be used for advertising or promotion. Inappropriate links include (but are not limited to) links to personal web sites, links to web sites with which you are affiliated, and links that exist to attract visitors to a web site or promote a product.  See the external links guideline and spam policies for further explanations of links that are considered appropriate.  If you feel the link should be added to the article, then please discuss it on the article's talk page rather than re-adding it. See the welcome page to learn more about Wikipedia. Thank you.   Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Adding links to Wikipedia", false, 1)','Spam1', ''); addlilink(spam,'javascript:edit_summary_watch("Please stop adding inappropriate external links to Wikipedia. It is considered spamming, and Wikipedia is not a vehicle for advertising. Thanks.   Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Spamming", false, 1)','Spam2', ''); addlilink(spam,'javascript:edit_summary_watch("Please stop. If you continue spamming you will be blocked from editing.  Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Last warning for spamming", false, 1)','Spam3', ''); addlilink(spam,'javascript:edit_summary_watch(" This is your last warning. The next time you insert a spam link,  you will be blocked from editing Wikipedia. Persistent spammers may have their websites blacklisted from Wikipedia.    <font face="comic sans MS" size=+1>Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "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(" When editing an article on Wikipedia there is a small field labeled "Edit summary" under the main edit-box. It looks like this: The text written here will appear on the Recent changes page, in the page revision history, on the diff page, and in the watchlists of users who are watching that article. See m:Help:Edit summary for full information on this feature.

Filling in the edit summary field greatly helps your fellow contributors in understanding what you changed, so please always fill in the edit summary field, especially for big edits or when you are making subtle but important changes, like changing dates or numbers. Thank you. <font face="comic sans MS" size=+1>Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Edit summaries", false, 1)','Edit summary 1', '');	  addlilink(tkm,'javascript:edit_summary_watch("Please don't post messages on pages that are completely irrelevant to the topic of the page. It can be seen as spam and Wikipedia regards adding spam to articles or talk pages as a form of vandalism. Thank you. <font face="comic sans MS" size=+1>Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Messages in articles", false, 1)','Messages 1', '');	  addlilink(tkm,'javascript:edit_summary_watch("Please do not add commentary or your own personal analysis to Wikipedia articles. Doing so violates Wikipedia's neutral point of view policy and breaches the formal tone expected in an encyclopedia. If you would like to experiment, use the sandbox. Thank you. <font face="comic sans MS" size=+1>Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Messages in articles", false, 1)','Messages 2', '');	  addlilink(tkm,'javascript:edit_summary_watch("Please stop. If you continue to violate Wikipedia's neutral point of view policy by adding commentary and your personal analysis into articles, you will be blocked from editing Wikipedia. <font face="comic sans MS" size=+1>Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "Messages in articles", false, 1)','Messages 3', '');	  addlilink(tkm,'javascript:edit_summary_watch("Some of the people, places or things you have written about  may not be sufficiently well-known to merit articles of their own. The Wikipedia community welcomes newcomers, and encourages them to become Wikipedians. On Wikipedia, all users are entitled to a user page in which they can describe themselves, and this article's content may be incorporated into that page. However, to merit inclusion in the encyclopedia proper, a subject must be notable. We encourage you to write or improve articles on notable subjects. <font face="comic sans MS" size=+1>Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "About the page you created", false, 1)','Vanity', '');	  addlilink(tkm,'javascript:edit_summary_watch("Hello, and welcome to Wikipedia. We appreciate your, but for legal reasons, we cannot accept copyrighted text or images borrowed from other web sites or printed material, and as a consequence, your addition will most likely be deleted.

Feel free to re-submit a new version of the article. You may use external websites as a source of information, but not as a source of sentences. This part is crucial: say it in your own words.

If the external website belongs to you, and you want to allow Wikipedia to use the text — which means allowing other people to modify it — then you must include on the external site the statement "I, (name), am the author of this article, (article name), and I irrevocably release its content under the terms of the GNU Free Documentation License, Version 1.2 and later, for use on Wikipedia and elsewhere."

You might want to look at Wikipedia's policies and guidelines for more details, or ask a question here. You can also leave a message on my talk page. <font face="comic sans MS" size=+1>Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "About your edits", false, 1)','nothanks', '');	  addlilink(tkm,'javascript:edit_summary_watch("==== Hello, and welcome to Wikipedia! We welcome and appreciate your contributions, such as, but we regretfully cannot accept copyrighted text or images borrowed from either web sites or printed material. This article appears to be a direct copy from. As a copyright violation, appears to qualify for speedy deletion under the speedy deletion criteria. has been tagged for deletion, and may have been deleted by the time you see this message. If the source is a credible one, please consider rewriting the content and citing the source.

If you believe that the article is not a copyright violation, or if you have permission from the copyright holder to release the content freely under the GFDL, you can comment to that effect on Talk:. If the article has already been deleted, but you have a proper release, you can reenter the content at, after describing the release on the talk page. However, you may want to consider rewriting the content in your own words. Thank you, and please feel free to continue contributing to Wikipedia. <font face="comic sans MS" size=+1>Joe Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "", 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("", "You have been indefinitely blocked", true, 1)','Perm Block', ); 	   addlilink(talkm,'javascript:perm_name_block(" <font face="comic sans MS" size=+1>Joe  Jklin  ( T C )  03:46, 3 November 2006 (UTC)", "", 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'); } } /*** 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:Kylu/editing', 'Editing Links', ''); }

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

//