Jump to content

User:Rgoodermote/monobook.js

From SpongeBob Wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
//Helper tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//////////////////////
 
//Admin rollback tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//Replace txt
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/replacetxt.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
 
//New user log tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Delete tabs
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Deletion/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//History
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Fixed widths
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Cactus.man/Scripts/FixDiffWidth.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');








//Imported from http://en.wikipedia.org/wiki/User:Nihiltres/monobook.js no alterations have been made to the code or to the comments. I Rgoodermote did not make or have a hand in making this.
// Tab name fixer (copied from User:Anomie/fix-tab-text.js, target content modified)
/* A simple javascript function to change the text in various tabs at the top of the
 * page. Only tested with the monobook skin.
 */
addOnloadHook(function(){
    var fix=function(id, text){
        var el=document.getElementById(id);
        if(!el) return;
        for(el=el.firstChild; el && el.nodeName!='A'; el=el.nextSibling);
        if(!el) return;
        while(el.firstChild) el.removeChild(el.firstChild);
        el.appendChild(document.createTextNode(text));
    }
 
    /* Add lines as necessary. Use the Firefox DOM inspector or some such to determine
     * the appropriate IDs.
     */
//(disabled via commenting)    fix('ca-talk', 'discussion');
    fix('ca-edit', 'edit');
    fix('pt-preferences', 'preferences');
    fix('pt-watchlist', 'watchlist');
    fix('pt-mytalk', 'talk');
    fix('pt-mycontris', 'contributions');
});
//end tab name fixer
 
//Special additions of tabs and personal links
//--personal links
addOnloadHook(function() {
//----link to log
addPortletLink('p-personal','/wiki/Special:Log?user=Rgoodermote','log','pt-log','Log of your non-edit actions','',document.getElementById('pt-mycontris'));
if (wgPageName == "Special:Log" && document.getElementById('mw-log-user').value == "Rgoodermote") {document.getElementById('pt-log').className='active';}
//----link to sandbox
addPortletLink('p-personal','/wiki/User:Rgoodermote/Sandbox','sandbox','pt-sandbox','Your sandbox','',document.getElementById('pt-preferences'));
if (wgPageName == "User:Rgoodermote/Sandbox") {document.getElementById('pt-sandbox').className='active';}
});
//--tabs
//----purge tab
addOnloadHook(function() {
  if (wgCanonicalNamespace != 'Special')
    {
addPortletLink('p-cactions', wgServer + wgScript + '?title=' + escape(wgPageName) + '&action=purge', 'purge', 'ca-purge', 'Purge the server cache of this page', null, (document.getElementById('ca-watch') ? document.getElementById('ca-watch') : document.getElementById('ca-unwatch')));
//and apply the "selected" class, so that one can confirm that the page has been purged. This subroutine is all my own, I'm so proud :p
    if (wgAction == "purge") {document.getElementById('ca-purge').className='selected';}
    }
});
//end special additions
 
//auto-check the "watch this page" tab when editing the MediaWiki namespace, my own code.
addOnloadHook(function() {
  if (wgCanonicalNamespace == 'MediaWiki' && wgAction == "edit") {document.getElementById('wpWatchthis').checked = true;}
});
 
//end auto-check for MediaWiki-space editing
 
//Remove search box and add a plain link in the Navigation section
addOnloadHook(function() {
      document.getElementById("p-search").style.display="none"; //this is done in JS so that if JS fails, the hack fails gracefully back to the search box.
      addPortletLink('p-navigation','/wiki/Special:Search','Search','n-search','Search Wikipedia','',null,null);
});
//end search stuff
 
//enable special user CSS and JS pages for while using my iPod Touch… somewhat experimental but should be quite useful.
addOnloadHook(function() {
  if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
    importStylesheet('User:Rgoodermote/ipod.css');
    importScript('User:Rgoodermote/ipod.js');
}});

/* Warning! Global gadget file! */

function liveClock(){
	liveClock.node = addPortletLink( 'p-personal', wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', '', 'utcdate' );
	liveClock.node.style.fontSize = 'larger';
	liveClock.node.style.fontWeight = 'bolder';

	showTime();
}
addOnloadHook(liveClock);

function showTime(){
	var dateNode = liveClock.node;
	if( !dateNode ) {
		return;
	}

	var now = new Date();
	var hh = now.getUTCHours();
	var mm = now.getUTCMinutes();
	var ss = now.getUTCSeconds();
	var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss );
	dateNode.firstChild.replaceChild( document.createTextNode( time ), dateNode.firstChild.firstChild );

	window.setTimeout(showTime, 1000);
}