User:ScriptHoward/monobook.js

// importScript('User:AzaToth/twinkle.js');

// Returns  name

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; }

// Opens the block log in the current window, and Special:Blockip in a popup. // Width, height, top, and left are chosen for a 1600x1200 display. //function blockpage_and_log(target) //{ // window.open('Special_Blockip.html?foo=blarg&faketarget=' + target, 'Block', 'width=1600,height=600,top=600,left=0'); // document.location.href = 'http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target; //}

// Adds "block" and "blocklog" tabs to User: and User talk: pages. function add_block_tab { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

// use the "edit this page" tab to get already-tidied url 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='), editlk.lastIndexOf('&action=edit')); var slloc = editlk.indexOf('/'); if (slloc > 0) editlk = editlk.substring(0, slloc);

// add "TabTest" tab tabs.appendChild(addlilink('http://foo.com/foo.cgi?' + editlk, 'TabTest')); }

function do_onload {   add_block_tab; }

if (window.addEventListener) window.addEventListener("load", do_onload, false); else if (window.attachEvent) window.attachEvent("onload", do_onload);