User:Aldy/vector.js

From RationalWiki
Jump to navigation Jump to search

Note: After saving, 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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
// Reduces the length of personal links at the top of the page
function shortlinks() 
{
 document.getElementById('pt-userpage').firstChild.innerHTML = 'Aldy';
 document.getElementById('pt-mytalk').firstChild.innerHTML = 'Talk';
 document.getElementById('pt-preferences').firstChild.innerHTML = 'Pref';
 document.getElementById('pt-newmessages').firstChild.innerHTML = 'Msgs';
 document.getElementById('pt-mycontris').firstChild.innerHTML = 'Ctbs';
 document.getElementById('pt-logout').firstChild.innerHTML = 'Out';
}
addOnloadHook(shortlinks);

// Highlight recent changes
hookEvent( 'load', recentChangesHighlights );
function recentChangesHighlights() {
	if ( wgPageName == 'Special:RecentChanges' ) { 
		var targetContent = document.getElementById( 'bodyContent' );
		var rows = targetContent.getElementsByTagName( 'li' );
		for ( var l = 0; l < rows.length; l++ ) {
			liHTML = rows[l].innerHTML
			liText = rows[l].textContent;
			if ( liHTML.indexOf( '/wiki/Special:Log/' ) != -1 ) {
				rows[l].style.backgroundColor = '#DDF';
			}
			if ( liHTML.indexOf( '/wiki/Special:Log/block' ) != -1 || liHTML.indexOf( '/wiki/Special:Log/delete' ) != -1 ) {
				rows[l].style.backgroundColor = '#FCC';
			}
			if ( liHTML.indexOf( 'class="newpage"' ) != -1 ) {
				rows[l].style.backgroundColor = '#DFD';
			}
			if ( liHTML.indexOf( 'class="minor"' ) != -1 ) {
				rows[l].style.backgroundColor = '#FEF';
			}
		}
	}
}