MediaWiki:Deepsea.js

From Brickipedia, the LEGO Wiki

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.
$( extraButtons );
 
function extraButtons() {
	var title = mw.config.get( 'wgTitle' ).replace( /&/g, '%26' );
	if ( !document.getElementById( 'switchtabs' ) ) {
		return;
	}

	var inv = '<li id="ca-inv"><a href="/w/index.php?title=Inventory:' + title + '" title="An inventory of the topic" accesskey="i">Inventory</a></li>';
	var rev = '<li id="ca-rev"><a href="/w/index.php?title=Review:' + title + '" title="The article\'s reviews" accesskey="r">Reviews</a></li>';
	var createRev = '<li id="n-Create-Review"><a href="/w/index.php?title=Review: ' + title + '" title="The article\'s reviews">Create a review of this set</a></li>';
	var wiki = '<li id="ca-wiki"><a href="/w/index.php?title=' + title + '" title="The topic\'s wiki entry" accesskey="w">Article</a></li>';

	switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
		case 0: // mainspace id
			if ( '#catlinks a:contains(sets)' ) {
				$( '#p-namespaces li:nth-child(3)' ).after( inv, rev );
				$( createRev ).insertAfter( '#p-Reviews .body ul li:nth-child(2)' );
			}
			break;
		case 114: // inventory namespace id
			$( '#p-namespaces li:nth-child(3)' ).after( wiki, rev );
			$( createRev ).insertAfter( '#p-Reviews .body ul li:nth-child(2)' );
			break;
		case 118: // review namespace id
			$( '#p-namespaces li:nth-child(3)' ).after( wiki, inv );
			break;
	}
}