User:Dbenbenn/monobook.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin is at User:Dbenbenn/monobook.css. |
/* <pre><nowiki> Top of Javascript */
function other_wiki_tab(title)
{
global_append_tab('http://en.wikipedia.org/wiki/' + title, 'en');
}
ta['custom-entab'] = new Array('?','Same page on English Wikipedia');
// Adds "block" and "blocklog" tabs to User: and User talk: pages.
function add_user_tabs(title)
{
var username = title.substring(title.indexOf(':') + 1);
var slloc = username.indexOf('/');
if (slloc > 0)
username = username.substring(0, slloc);
other_wiki_tab(title);
global_append_tab('/w/index.php?title=Special:Log&user=' + username, 'log');
global_append_tab('/w/index.php?title=Special:Log&type=block&page=User:' + username, 'blocklog');
}
function add_default_tabs(title)
{
other_wiki_tab(title);
global_append_tab('/w/index.php?title=Special:Log&page=' + title, 'log');
}
function add_image_tabs(imagetitle)
{
other_wiki_tab(imagetitle);
}
function add_special_tabs(title)
{
var titlelow = title.toLowerCase();
if (titlelow.substring(0, 21) == 'special:contributions') {
var username = document.getElementById('contentSub').getElementsByTagName('a')[0].firstChild.nodeValue;
add_user_tabs('User:' + username);
} else
other_wiki_tab(title);
}
function do_onload()
{
var title = global_get_tidy_title();
var namespace = title.substring(0, title.indexOf(':')).toLowerCase();
if (namespace == 'image')
add_image_tabs(title);
else if (namespace == 'user' || namespace == 'user_talk')
add_user_tabs(title);
else if (namespace == 'special')
add_special_tabs(title);
else
add_default_tabs(title);
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
window.attachEvent("onload", do_onload);
/* Bottom of Javascript </nowiki></pre> */