User:Entropy/monobook.js

noSnow = 1;

/* links for admins and bcrats */ function addBar { document.getElementById('p-navigation').innerHTML += ' '+ ' '+  ' Command Center '+ ' '+ 'Deletion'+ 'Banning'+ 'Master Log'+ 'New Pages</li>'+ '<li id=\>New Images</a></li>'+ '<li id=\>Block User</a></li>'+ '<li id=\>Prefix Index</a></li>'+ '<li id=\>User Rights</a></li>'+ '</ul> '; }

addOnloadHook(addBar);

/* add Purge */ function addPurge {   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', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),                  'purge', 'ca-purge', 'Purge server cache', '0'); }

addOnloadHook(addPurge);

/* add Credits */ function addCredits {   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', url.replace(/([?&]action=)history([&#]|$)/, '$1credits$2'),                  'credits', 'ca-credits', 'Display article credits', '0'); } addOnloadHook(addCredits);

/* Guild Wars Wiki Tools - GuildWiki Switch (c) 2007 by Patrick Westerhoff [User:poke] */

/* GWW tab */ function gwwSwitch {  if ( wgNamespaceNumber < 100 ) {    var itemNode = document.createElement( 'li' ); itemNode.appendChild( document.createElement( 'a' ) ); itemNode.lastChild.href = 'http://wiki.guildwars.com/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle ); itemNode.lastChild.title = 'See this page on Guild Wars Wiki'; itemNode.lastChild.appendChild( document.createTextNode( 'GWW' ) ); document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0].appendChild( itemNode ); } } hookEvent( 'load', gwwSwitch );

/* GW2W tab */ function gw2wSwitch {  if ( wgNamespaceNumber < 100 ) {    var itemNode = document.createElement( 'li' ); itemNode.appendChild( document.createElement( 'a' ) ); itemNode.lastChild.href = 'http://wiki.guildwars2.com/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle ); itemNode.lastChild.title = 'See this page on Guild Wars 2 Wiki'; itemNode.lastChild.appendChild( document.createTextNode( 'GW2W' ) ); document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0].appendChild( itemNode ); } } hookEvent( 'load', gw2wSwitch );

/* PvX tab */ function pvxSwitch {  if ( wgNamespaceNumber < 100 ) {    var itemNode = document.createElement( 'li' ); itemNode.appendChild( document.createElement( 'a' ) ); itemNode.lastChild.href = 'http://www.pvxwiki.com/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle ); itemNode.lastChild.title = 'See this page on PvX Wiki'; itemNode.lastChild.appendChild( document.createTextNode( 'PvX' ) ); document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0].appendChild( itemNode ); } } hookEvent( 'load', pvxSwitch );

/* correct the favicon */ function changeFavicon( url ) { var head  = document.getElementsByTagName( 'head' )[0]; var link = document.createElement( 'link' ); link.rel = 'shortcut icon'; link.type = "image/x-icon"; link.href = url; var links = head.getElementsByTagName( 'link' ); for ( var i = 0; i < links.length; i++ ) {   if ( links[i].rel == 'shortcut icon' ) {      head.removeChild( links[i] ); break; } }  head.appendChild( link ); }

LoadAfter = function { changeFavicon( 'http://images1.wikia.nocookie.net/gw/images/2/2c/GuildWiki_icon.ico' ); }

addOnloadHook(LoadAfter);

/**** function displayTimer.js * by Patrick Westerhoff [poke] */

hookEvent( 'load', displayTimer );

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              = '/wiki/' + 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 ); } }