User:Eleazaros/monobook.js

From Lotro-Wiki.com
Jump to navigation Jump to search

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// <pre>
// Fuction to add a couple special pages to the toolbox on the side menu.
// Mostly so I can find type-o's in my scripts.

function addToolboxItems() {
	addPortletLink ('p-tb', wgArticlePath.replace(/\$1/,'Special:Newpages'), 'New pages');
	addPortletLink ('p-tb', wgArticlePath.replace(/\$1/,'Special:Newimages'), 'New images');
}
/* Alternating row colors for tables */
function bandedTable() {
	el = document.getElementsByTagName("table");
	for (i = 0; i < el.length; i++) {
		var classes = el[i].className.split(" ");
		for (j = 0; j < classes.length; j++) {
			if (classes[j] == "bandedTable") {
				rows = el[i].getElementsByTagName("tr");
				for (k = 0; k < rows.length; k++) {
					rows[k].className = (k % 2 == 0 ? "even" : "odd");
				}
			}
		}
	}
} 

addOnloadHook(function() {
	bandedTable()
	addToolboxItems()
});

// </pre>