User:Lord Chamberlain, the Renowned/monobook.js

importScript("User:Supadawg/util.js");

importScript('User:Cameltrader/Advisor.js');

importScript('User:Lightmouse/monobook.js/script.js');

importScript('User:Barticus88/WhatLinksHere.js');

importScript('User:GregU/dashes.js');

importScript("User:Blue-Haired Lawyer/footnote popups.js");

importScript('User:Dschwen/highlightredirects.js');

importScript('User:DStoykov/defaultsort.js'); importScript('User:ais523/stubtagtab.js');

importScript('MediaWiki:LinkFixr.js');

importScript('User:TheJosh/Scripts/NewPagePatrol.js');

importScript('User:Voice_of_All/Addtabs/monobook.js');

importScript('User:Voice_of_All/History/monobook.js');

importScript('User:Dr pda/prosesize.js');

importScript("User:PleaseStand/segregate-refs.js");

importScript('user:js/patroller.js');

importScript("User:GregU/randomlink.js");

importScript('User:Michael Devore/wiksort.js'); //User:Michael Devore/wiksort.js

// Prompt for an edit summary when clicking a rollback link

addOnloadHook(function { var serverRe = wgServer.replace(/([^A-Za-z0-9_])/g, "\\$1");

var scriptRe = wgScript.replace(/([^A-Za-z0-9_])/g, "\\$1");

var rollbackRe = new RegExp ("^(" + serverRe + ")?" + scriptRe + "\\?([^#]*&)?action=rollback(&|$)"); var promptSummary = function { var summary = prompt("Enter rollback summary (or leave as \"default\" to use default summary):", "default"); if (summary == null || summary == "") return false; if (summary == "default") return true; this.href = this.href.replace("?", "?summary=" + encodeURIComponent(summary) + "&"); return true; }; var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { if (rollbackRe.test(links[i].href)) links[i].onclick = promptSummary; } });

// BEGIN STUBFIX CODE //check if we are editing and we want to stubfix if (window.location.href.indexOf('action=edit') != -1 && window.location.href.indexOf('stubfix=1') != -1) { function stubfix { document.getElementById('wpSummary').value = "Removing stub"; var contents = document.getElementById('wpTextbox1').value; var newcontents = contents.replace(/\{\{.*?stubs?(\|?.*)\}\}/g, ""); document.getElementById('wpTextbox1').value = newcontents; document.getElementById('wpWatchthis').checked = ""; document.getElementById('wpDiff').click; }   addOnloadHook(function{ stubfix; }); } //Check if it's article to add the tab if(wgCanonicalNamespace == "") { addOnloadHook(function{   var taburl = "http://en.wikipedia.org/w/index.php?title="+wgPageName+"&action=edit&stubfix=1";   addTab(taburl, "rms", "ca-stubrem", "This removes stub tag.");   }); } //END STUBFIX CODE //

/* */

/*

Notes and links
A useful reference is the code in http://www.sourcewatch.org/skins/common/wikibits.js

Tooltips and access keys
*/

ta = new Object; ta['pt-userpage'] = new Array('.','My user page'); ta['pt-anonuserpage'] = new Array('.','The user page for the ip you\'re editing as'); ta['pt-mytalk'] = new Array('n','My talk page'); ta['pt-anontalk'] = new Array('n','Discussion about edits from this ip address'); ta['pt-preferences'] = new Array('','My preferences'); ta['pt-watchlist'] = new Array('l','The list of pages you\'re monitoring for changes.'); ta['pt-mycontris'] = new Array('y','List of my contributions'); ta['pt-login'] = new Array('o','You are not required to log in - however, you must log in to edit.'); ta['pt-anonlogin'] = new Array('o','You are encouraged to log in, it is not mandatory however.'); ta['pt-logout'] = new Array('o','Log out'); ta['ca-talk'] = new Array('t','Discussion about the content page'); ta['ca-edit'] = new Array('e','You can edit this page. Please use the preview button before saving.'); ta['ca-addsection'] = new Array('+','Add a comment to this discussion.'); ta['ca-viewsource'] = new Array('e','This page is protected. You can view its source.'); ta['ca-history'] = new Array('h','Past versions of this page.'); ta['ca-protect'] = new Array('=','Protect this page'); ta['ca-delete'] = new Array('d','Delete this page'); ta['ca-undelete'] = new Array('d','Restore the edits done to this page before it was deleted'); ta['ca-move'] = new Array('m','Move this page'); ta['ca-nomove'] = new Array('','You don\'t have the permissions to move this page'); ta['ca-watch'] = new Array('w','Add this page to your watchlist'); ta['ca-unwatch'] = new Array('w','Remove this page from your watchlist'); ta['search'] = new Array('f','Search this wiki'); ta['p-logo'] = new Array('','Main Page'); ta['n-mainpage'] = new Array('z','Visit the Main Page'); ta['n-portal'] = new Array('','About the project, what you can do, where to find things'); ta['n-currentevents'] = new Array('','Find background information on current events'); ta['n-recentchanges'] = new Array('r','The list of recent changes in the wiki.'); ta['n-randompage'] = new Array('x','Load a random page'); ta['n-help'] = new Array('','The place to find out.'); ta['n-sitesupport'] = new Array('','Support us'); ta['t-whatlinkshere'] = new Array('j','List of all wiki pages that link here'); ta['t-recentchangeslinked'] = new Array('k','Recent changes in pages linked from this page'); ta['feed-rss'] = new Array('','RSS feed for this page'); ta['feed-atom'] = new Array('','Atom feed for this page'); ta['t-contributions'] = new Array('','View the list of contributions of this user'); ta['t-emailuser'] = new Array('','Send a mail to this user'); ta['t-upload'] = new Array('u','Upload images or media files'); ta['t-specialpages'] = new Array('q','List of all special pages'); ta['ca-nstab-main'] = new Array('c','View the content page'); ta['ca-nstab-user'] = new Array('c','View the user page'); ta['ca-nstab-media'] = new Array('c','View the media page'); ta['ca-nstab-special'] = new Array('','This is a special page, you can\'t edit the page itself.'); ta['ca-nstab-wp'] = new Array('a','View the project page'); ta['ca-nstab-image'] = new Array('c','View the image page'); ta['ca-nstab-mediawiki'] = new Array('c','View the system message'); ta['ca-nstab-template'] = new Array('c','View the template'); ta['ca-nstab-help'] = new Array('c','View the help page'); ta['ca-nstab-category'] = new Array('c','View the category page');

/*

Collapsible section support
*/

addOnloadHook(createCollapsibleSectionLinks);

/* Hook function for onload. Added by User:Neoconned 26 Oct 06. Adds support for up to 5 collapsible sections in each page. Contributors can create these via Template:CollapsibleSectionLead and Template:CollapsibleSectionBody. Manually numbering them in this way is clumsy but the best solution for now, given the lack of a getElementByClass method in the DOM. function createCollapsibleSectionLinks { addToggleDivLink('collapsibleSectionLead1','collapsibleSectionBody1','toggleCSLink1'); addToggleDivLink('collapsibleSectionLead2','collapsibleSectionBody2','toggleCSLink2'); addToggleDivLink('collapsibleSectionLead3','collapsibleSectionBody3','toggleCSLink3'); addToggleDivLink('collapsibleSectionLead4','collapsibleSectionBody4','toggleCSLink4'); addToggleDivLink('collapsibleSectionLead5','collapsibleSectionBody5','toggleCSLink5'); }

/* Adds a toggle visibility link to parentDivId, which toggles the visibility of divToToggleId. Added by User:Neoconned 26 Oct 06. Adapted from http://www.sourcewatch.org/skins/common/wikibits.js:showTocToggle function addToggleDivLink(parentDivId,divToToggleId,toggleLinkId) { if (document.createTextNode) { // Uses DOM calls to avoid document.write + XHTML issues

var linkHolder = document.getElementById(parentDivId) if (!linkHolder) return;

var outerSpan = document.createElement('span'); outerSpan.className = 'toctoggle';

var toggleLink = document.createElement('a'); toggleLink.id = toggleLinkId; toggleLink.className = 'internal'; toggleLink.href = 'javascript:toggleAnyDiv(\'' + divToToggleId + '\')'; toggleLink.appendChild(document.createTextNode('Click to view/hide'));

outerSpan.appendChild(document.createTextNode('[')); outerSpan.appendChild(toggleLink); outerSpan.appendChild(document.createTextNode(']'));

linkHolder.appendChild(document.createTextNode(' ')); linkHolder.appendChild(outerSpan); } }

/* Function to toggle visibility of an arbitrary div. Added by User:Neoconned 26 Oct 06. Source: http://www.friendsofed.com/samples/1590594304.pdf page 150. */ function toggleAnyDiv(targetId) { if (document.getElementById) {		target = document.getElementById(targetId);

if (target.style.display == "none") {			target.style.display = "block"; }		else {			target.style.display = "none"; }	} }

/*

Kanana
*/

addOnloadHook(kananaTestIfEnabled); var kananaCheckboxes = new Array; var kananaCodes = new Array;

var kananaItems = new Array; var kananaItemCodes = new Array;

/* Hook function for onload. Added by User:Neoconned 27 Oct 06. Tests for the presence of a 'magic DIV' to determine whether to use Kanana on this page or not. The only overhead for non-Kanana pages is  this test. function kananaTestIfEnabled { if (document.getElementById) {		target = document.getElementById('kananaOn'); if (target) {			kananaInitialize; }	} }

function kananaInitialize {	var spans = document.getElementsByTagName("span"); var noOfSpans = spans.length; for (i = 0; i < noOfSpans; i++) {		if ( spans[i].id.indexOf('kananaCheckbox') != -1) {			kananaInitializeCheckbox( spans[i] ); }	}

var divs = document.getElementsByTagName("div"); var noOfDivs = divs.length; for (i = 0; i < noOfDivs; i++) {		if ( divs[i].id.indexOf('kananaItem') != -1) {			kananaInitializeItem( divs[i] ); }	} }

function kananaInitializeCheckbox(checkboxContainer) {	var cb = document.createElement("input"); cb.type = "checkbox"; // set type cb.checked = cb.defaultChecked = false; cb.onclick = kananaRefresh; checkboxContainer.appendChild(cb);

var iCheckboxCount = kananaCheckboxes.length;

kananaCheckboxes[iCheckboxCount] = cb;

var startIdx = "kananaCheckbox_".length; var endIdx = checkboxContainer.id.length; kananaCodes[iCheckboxCount] = checkboxContainer.id.substring(startIdx,endIdx);

// Temp feature for debugging - display codes next // to their associated checkboxes /*	var temp = kananaCodes[iCheckboxCount]; checkboxContainer.appendChild(document.createTextNode(temp)); checkboxContainer.appendChild(document.createTextNode(' ')); checkboxContainer.appendChild(document.createTextNode(startIdx)); checkboxContainer.appendChild(document.createTextNode(' ')); checkboxContainer.appendChild(document.createTextNode(endIdx)); */ }

function kananaInitializeItem(itemDiv) {	var iItemCount = kananaItems.length; kananaItems[iItemCount] = itemDiv;

var startIdx = "kananaItem_".length; var endIdx = itemDiv.id.length; var sRHS = itemDiv.id.substring(startIdx,endIdx);

var secondUnderscoreIndex = sRHS.indexOf("_"); startIdx = secondUnderscoreIndex+1; endIdx = sRHS.length;

kananaItemCodes[iItemCount] = ":" + sRHS.substring(startIdx,endIdx) + ":";

// Trace out extracted code for debugging purposes // var temp = "***" + kananaItemCodes[iItemCount] + "***"; // itemDiv.appendChild(document.createTextNode(temp)); }

/* Update which categories of information are displayed on the page when the reader changes the selected categories. */ function kananaRefresh {	var selectedCodes = new Array;

// Determine which item codes are enabled for (i=0; i<kananaCheckboxes.length; i++) {		var cb = kananaCheckboxes[i]; if (cb.checked) {			var nextIdx = selectedCodes.length;

// To save time, bracket the code with colons here selectedCodes[nextIdx] = ":" + kananaCodes[i] + ":"; }	}

// Now run through the items and ensure only those ones that // match the selected codes are visible

for (i=0; i<kananaItems.length; i++) {		var itemCodes = kananaItemCodes[i];

var bDisplayItem = true; for (j=0; ((j<selectedCodes.length) && bDisplayItem); j++) {			if (itemCodes.indexOf(selectedCodes[j])==-1) {				bDisplayItem = false;

// Debugging code // var sErr = itemCodes + " doesn't contain " + //	selectedCodes[j]; // alert(sErr); }		}

var div = kananaItems[i]; if (bDisplayItem) div.style.display = "block"; else div.style.display = "none"; } }

/*

References quality control stuff
*/

// The original value of the article editing field is stored here var refcontrolOriginalArticleText = new String;

// Set up the ref quality control code. function refcontrolInitialize {   refcontrolOriginalArticleText = document.forms.editform.wpTextbox1.value; //alert(refcontrolOriginalArticleText); }

// Only contains one check now, but will do other checks in the future. function refcontrolEditIsOkay {   // Make sure the contributor hasn't increased the number of links to Yahoo news articles. if (refcontrolEditContainsNewYahooNewsLinks) return false;

return true; }

function refcontrolEditContainsNewYahooNewsLinks {   var newArticleText = document.forms.editform.wpTextbox1.value; var re = new RegExp("http://news.yahoo.com","g");

var originalYahooNewsLinks = refcontrolOriginalArticleText.match(re); if (originalYahooNewsLinks==null) originalYahooNewsLinks = new Array;

var currentYahooNewsLinks = newArticleText.match(re); if (currentYahooNewsLinks==null) currentYahooNewsLinks = new Array;

//alert(originalYahooNewsLinks.length); //alert(currentYahooNewsLinks.length);

if (currentYahooNewsLinks.length > originalYahooNewsLinks.length) {       alert("Please do not use links to Yahoo! News stories in SourceWatch citations. This is because the link will very quickly become unavailable. For more information about this issue, and details of alternative locations where you can find the article you are trying to link to, please see the SourceWatch:References page."); return true; }   else {       return false; } }

/* */

// function highlightmyname(n,p) //node, parent node { while(n!=null) {   if(n.nodeType==3) //text node {     if(n.data.toLowerCase.indexOf(wgUserName.toLowerCase)!=-1) {       var ix=n.data.toLowerCase.indexOf(wgUserName.toLowerCase); var t1=ix?document.createTextNode(n.data.substr(0,ix)):null; var t2=document.createTextNode(n.data.substr(ix,wgUserName.length)); var t3=ix+wgUserName.length==n.data.length?null: document.createTextNode(n.data.substr(ix+wgUserName.length)); var s1=document.createElement("SPAN"); s1.style.backgroundColor="#FF0000"; s1.appendChild(t2); var s2=document.createElement("SPAN"); if(t1!=null) s2.appendChild(t1); s2.appendChild(s1); if(t3!=null) s2.appendChild(t3); p.replaceChild(s2,n); if(t3!=null) highlightmyname(t3,s2); //find remaining occurences in the new nodes n=s2.nextSibling; }     else n=n.nextSibling; }   else {     if(n.firstChild!=null) highlightmyname(n.firstChild,n); n=n.nextSibling; } } } addOnloadHook(function {  if(location.href.indexOf("?ais523")==-1&&location.href.indexOf("&ais523")==-1&& location.href.indexOf("?action=edit")==-1&&location.href.indexOf("?action=submit")==-1&& location.href.indexOf("&action=edit")==-1&&location.href.indexOf("&action=submit")==-1&& location.href.indexOf("&action=raw")==-1&&wgPageName!="Special:Preferences")   highlightmyname(document.getElementById('bodyContent').firstChild, document.getElementById('bodyContent')); }); // //

// Normally features are enabled var toFix = true; // In special pages, histories and previews disable them if (wgCanonicalNamespace == "Special" || /*   */ location.href.indexOf('&action=history') != -1 || /*    */ location.href.indexOf('&action=submit') != -1) toFix = false; // popupRedlinkRemoval = toFix; popupFixRedirs = toFix; popupFixDabs = toFix;