Jump to content

User:Bookofjude/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Bookofjude (talk | contribs) at 13:05, 8 March 2006 (another check (essjay's)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* <pre><nowiki> */
/**** Add generic tab ****/
	
	function addlilink(tabs, url, name, id){
		var na = document.createElement('a');
		na.href = url;
		na.appendChild(document.createTextNode(name));
		var li = document.createElement('li');
		li.id = id;
		li.appendChild(na);
		tabs.appendChild(li);
		return li;
	}

/**** Add tab as menu ****/

function addlimenu(tabs, name, id)
{
    var na = document.createElement('a');
    na.href = '#';
    var mn = document.createElement('ul');
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.className = 'tabmenu';
    li.appendChild(na);
    li.appendChild(mn);
    tabs.appendChild(li);
    return li;
}

function addTab(url, name, id, title, key){ 
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    addlilink(tabs, url, name, id, title, key);
}

function morelinks()
{
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    addlimenu(tabs, 'User functions', 'userf');
    var userf = document.getElementById('userf').getElementsByTagName('ul')[0];
    var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
	editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
	editlk = editlk.substring(editlk.indexOf(':') + 1);
	var slloc = editlk.indexOf('/');
    if(slloc > 0) editlk = editlk.substring(0, slloc);
	
    // format: addlilink(userf, url, name);
		
    // add "block" tab
    addlilink(userf, '/wiki/Special:Blockip/' + editlk, 'block user');
    // previous: addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block', '');

    // add "blocklog" tab
    addlilink(userf, '/wiki/Special:Log/block?page=User:' + editlk, 'block log', '');
    // addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');
    
    // add "unblock" tab
    addlilink(userf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock user', '');
    // addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');

    // add "contributions" tab
    addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contributions', '');
    // addTab('/wiki/Special:Contributions/' + editlk, 'con');
    
    // add "edit count" tab
    addlilink(userf, 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=' + editlk + '&dbname=enwiki_p', 'interiot's tool', '');
    // addTab('http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=' + editlk + '&dbname=enwiki_p', 'count');
 
    // add "whois" tab
    addlilink(userf, 'http://www.samspade.org/t/lookat?a=' + editlk, 'whois user', '');
    // addTab('http://www.samspade.org/t/lookat?a=' + editlk, 'who');
   
    // add "proxycheck" tab
    addlilink(userf, 'http://quyme.com/proxycheck.php?ip=' + editlk, 'open proxy check', '');
    // addTab('http://quyme.com/proxycheck.php?ip=' + editlk, 'proxy');
    
    
}

addOnloadHook(myLoadFuncs);

/**** Load custom functions ****/

function myLoadFuncs()
{
    morelinks();
}

/* </nowiki></pre> */