User:Avatar/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 can be added at User:Avatar/monobook.css. |
// Returns <li><a href="url">name</a></li>
function addlilink(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
var txt = document.createTextNode(name);
na.appendChild(txt);
var li = document.createElement('li');
li.appendChild(na);
return li;
}
// Get's the URL version of the page title.
function get_tidy_title()
{
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
// cut everything up to "title=" from the start and everything past "&action=edit" from the end
editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
return editlk;
}
function add_image_tabs()
{
var imagetitle = get_tidy_title();
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
tabs.appendChild(addlilink('http://www.juelich.de/avatar/check-usage/check-usage.php?filename=' + imagetitle + '&template', 'check-usage'));
}
function do_onload()
{
if (document.title.indexOf('Image:') == 0)
add_image_tabs();
if (document.title.indexOf('User:') == 0
|| document.title.indexOf('User talk:') == 0)
add_block_tab();
else if (document.title.indexOf('Block user') == 0) // could stand to be more robust
do_blockip_stuff();
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
window.attachEvent("onload", do_onload);