User:Tennessee Ernie Ford/monobook.js

function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); }	return null; }

function addStuffToSideBar { document.getElementById('n-recentchanges').firstChild.href = '/index.php?title=Special:RecentChanges&hidemyself=1&hidebots=';

document.getElementById('p-navigation').innerHTML += ' '+ ' '+ ' Command Center '+ ' '+ '#gwiki'+ 'Deletion'+ 'Copyvio'+ 'Master Log</li>'+ '<a href=\"/Special:Newpages">New Pages</a></li>'+ '<a href=\"/Special:Newimages">New Images</a></li>'+ '<a href=\"/Special:Unusedimages">Unused Images</a></li>'+ '<a href=\"/MediaWiki:Sitenotice" style="display:inline">Sitenotice</a> / <a href=\"/MediaWiki:Sitenotice_id" style="display:inline">id</a></li>'+ '<a href=\"/Special:Allmessages">System messages</a></li>'+ '<a href=\"/Special:Statistics" style="display:inline">Statistics</a> / <a href=\"/Special:Version" style="display:inline">Version</a></li>'+ '</ul> ';

document.getElementById('p-search').innerHTML += ' '+ ' '+ ' Search by prefix '+ ' '+   '<form id=prefixform action="/index.php">'+ '<input type=hidden value="Special:PrefixIndex" name=title>'+ '<input type=search name=prefix title="Search by prefix" id=searchInput>'+ '<input type=submit title="Search for all pages with this prefix" value="Go" id="mw-prefixButton" class="searchButton" name="go">'+ ' '+ '  '; } addOnloadHook(addStuffToSideBar);

function defaultFormValues { if(wgAction == 'delete') { document.getElementById('wpDeleteReasonList').value = readCookie('jsDeleteReasonList'); document.getElementById('wpReason').value = readCookie('jsReason'); } if(wgPageName == 'Special:Upload') { document.getElementById('wpUploadDescription').value = readCookie('jsUploadDescription'); document.getElementById('wpLicense').value = readCookie('jsLicense');

if(readCookie('jsWatchthis') == 1) { document.getElementById('wpWatchthis').checked = true; } else { document.getElementById('wpWatchthis').checked = false; }

if(readCookie('jsIgnoreWarning') == 1) { document.getElementById('wpIgnoreWarning').checked = true; } else { document.getElementById('wpIgnoreWarning').checked = false; }

} } // addOnloadHook(defaultFormValues);

function addGWWSwitch {   var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; if (!(url = hist.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; addPortletLink('p-cactions', 'http://wiki.guildwars.com/wiki/' + wgCanonicalNamespace + ':' + wgTitle,                  'GWW', 'ca-gww', 'See this page on Guild Wars Wiki'); addPortletLink('p-cactions', 'http://guildwars.wikia.com/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle ),                  'wikia', 'ca-wikia', 'See this page on GuildWars@Wikia'); } addOnloadHook(addGWWSwitch);

/***** Custom edit buttons ****/ if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/2/23/Button_code.png", "speedTip": "Code", "tagOpen": " ", "sampleText": "foo"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/7/73/Button_code_nowiki.png", "speedTip": "Code+Nowiki", "tagOpen": " ", "sampleText": "foo"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/f/f6/Button_html_comment.png", "speedTip": "HTML comment", "tagOpen": "", "sampleText": "I am a comment"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/d/d5/Button_noinclude.png", "speedTip": "Noinclude", "tagOpen": " ", "tagClose": " ", "sampleText": "bar"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/gw/images/b/bf/Button_pagename.png", "speedTip": "Pagename", "tagOpen": "", "sampleText": ""}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/4/4a/Btn_toolbar_strike.png", "speedTip": "Strikethrough", "tagOpen": " ", "tagClose": " ", "sampleText": "baz"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/e/e1/Button_Quotesbutton.png", "speedTip": "Quote", "tagOpen": "<span style=\"color:green\">\"",    "tagClose": "\" ", "sampleText": "narf"}

}

/*** hideUser for RC ***/ /* insertScript('Forum:Coding/Javascript/hideUser.js');
 * Adds an input box and button under the "Namespace:" selector on Special:RecentChanges.
 * Enter a username in the box and click "Hide" to hide all edits by that user on your current RC list.
 * Clearing the box and clicking "Hide" will restore that user's edits to your current RC list.
 * Entering a different username and clicking "Hide" will do both of the above at once.
 * Does not "remember" the user if you refresh RC.
 * Works on Monobook and Monaco with non-grouped RC. Grouped RC uses some messy nested divs/tables that I don't feel like dealing with.
 * Because of how I'm placing it in the RC options, pressing "Enter" in the hideUser field will submit the Namespace form. I guess I should just make a new form instead of inserting this into the existing one, but this was the first thing I thought of.  I might try that later.

function displayTimer { if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) return; var date; var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0]; var timerLink  = document.createElement( 'a' ); var timerObj   = document.createElement( 'li' ); timerLink.href              = '/' + wgPageName + '?action=purge'; timerLink.title             = 'Purge the server cache and update the contents of this page.' timerObj.id                 = 'pt-timer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight   = 'bold'; timerObj.style.fontSize     = '110%'; timerObj.appendChild( timerLink ); timerParent.insertBefore( timerObj, timerParent.firstChild ); function actualizeUTC {   timerDate           = new Date; timerLink.innerHTML = ( timerDate.getUTCHours  < 10 ? '0' : '' ) + timerDate.getUTCHours   + ':' + ( timerDate.getUTCMinutes < 10 ? '0' : '' ) + timerDate.getUTCMinutes + ':' + ( timerDate.getUTCSeconds < 10 ? '0' : '' ) + timerDate.getUTCSeconds + ' (UTC)'; } function actualizeCustom {   timerDate           = new Date; timerDate.setMinutes( timerDate.getMinutes + timerDate.getTimezoneOffset + timerTimezone * 60 ); timerLink.innerHTML = ( timerDate.getHours  < 10 ? '0' : '' ) + timerDate.getHours   + ':' + ( timerDate.getMinutes < 10 ? '0' : '' ) + timerDate.getMinutes + ':' + ( timerDate.getSeconds < 10 ? '0' : '' ) + timerDate.getSeconds + ' (UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')'; } // start if ( typeof( timerTimezone ) !== 'number' ) {   actualizeUTC; setInterval( actualizeUTC, 1000 ); } else {   actualizeCustom; setInterval( actualizeCustom, 1000 ); } } addOnloadHook(displayTimer);