MediaWiki:Vector.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.
/* Any JavaScript here will be loaded for users using the Vector skin */
$( extraButtons );
function extraButtons() {
var title = mw.config.get( 'wgTitle' ).replace( /&/g, '%26' );
if ( !document.getElementById( 'switchtabs' ) ) {
return;
}
var inv = '<li id="ca-inv"><span><a href="/w/index.php?title=Inventory:' + title + '" title="An inventory of the topic" accesskey="i">Inventory</a></span></li>';
var rev = '<li id="ca-rev"><span><a href="/w/index.php?title=Review:' + title + '" title="The article\'s reviews" accesskey="r">Reviews</a></span></li>';
var createRev = '<li id="n-Create-Review"><span><a href="/w/index.php?title=Review: ' + title + '" title="The article\'s reviews">Create a review of this set</a></span></li>';
var wiki = '<li id="ca-wiki"><span><a href="/w/index.php?title=' + title + '" title="The topic\'s wiki entry" accesskey="w">Article</a></span></li>';
switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
case 0: // mainspace id
if ( '#catlinks a:contains(sets)' ) {
$( '#p-namespaces li:nth-child(2)' ).after( inv, rev );
$( createRev ).insertAfter( '#p-Reviews .body ul li:nth-child(2)' );
}
break;
case 114: // inventory namespace id
$( '#p-namespaces li:nth-child(2)' ).after( wiki, rev );
$( createRev ).insertAfter( '#p-Reviews .body ul li:nth-child(2)' );
break;
case 118: // review namespace id
$( '#p-namespaces li:nth-child(2)' ).after( wiki, inv );
break;
}
}