:User:Dp462090/monobook.js

/*

 */

// this one breaks popups

// document.write('');

// Filter changes live

// User:Lupin/recent2.js - please include this line

document.write('');

function externISBN() {

for (var i = 0; i < document.links.length; i++)

{

var ln = document.links[i].href.match(/isbn=(.*)/);

if (ln) {

document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1;

}

}

}

$(externISBN);

// Useful stuff from Wikipedia:WikiProject_User_scripts

function addToolboxLink(url, name, id){

var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];

addlilink(tb, url, name, id);

}

function addlilink(tabs, url, name, id, title, key){

var na = document.createElement('a');

na.href = url;

na.appendChild(document.createTextNode(name));

var li = document.createElement('li');

if(id) li.id = id;

li.appendChild(na);

tabs.appendChild(li);

if(id) {

if(key && title) ta[id] = [key, title];

else if(key) ta[id] = [key, ''];

else if(title) ta[id] = ['', title];

}

// re-render the title and accesskeys from existing code in wikibits.js

akeytt();

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 addPurge(){

ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];

var x = document.getElementById('ca-history');

if(!x) return;

if(x.children) x = x.children[0].href;

else x = x.childNodes[0].href;

addTab(x.replace(/=history/, "=purge"), 'purge', 'ca-purge');

akeytt();

}

// culled from User:Lupin/popups.js

function nichalp_articleFromURL(h) {

if (typeof h != 'String') h=String(h);

h=decodeURI(h);

var m=RegExp('[^:]*://en\\.wikipedia\\.org/(wiki/|w/index\\.php\\?title=)([^&?]*)').exec(h);

if(m===null) return null;

return m[2];

}

function nichalp_isIpUser(user) {

return RegExp('(User:)?' +

'((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}' +

'(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])')

.test(user);

}

function nichalp_removeAnchor(article) {

// is there a #? if not, we're done

var i=article.indexOf('#');

if (i == -1) return article;

return article.substring(0,i);

}

function nichalp_userName(article) {

var i=article.indexOf('User');

var j=article.indexOf(':');

if (i != 0 || j == -1) return null;

var k=article.indexOf('/');

if (k==-1) return article.substring(j+1);

else return article.substring(j+1,k);

}

// do it

function nichalp_customLinks() {

addPurge();

var article=nichalp_articleFromURL(document.location.href);

if (!article) return;

var user=nichalp_userName(article);

if(!user) return;

user=nichalp_removeAnchor(user);

if (!nichalp_isIpUser(user)) {

addToolboxLink('http://kohl.wikimedia.org/~kate/cgi-bin/count_edits?dbname=enwiki&user='+user, user+"'s edit count", 'toolbox_katestool');

}

var special='http://en.wikipedia.org/w/index.php?title=Special:';

addToolboxLink(special + 'Log&user='+user, user+"'s log", 'toolbox_userlog');

addToolboxLink(special + 'Blockip&ip='+user, 'Block '+user, 'toolbox_blockuser');

addToolboxLink(special + 'Special:Ipblocklist&action=unblock&ip='+user, 'Unblock '+user, 'toolbox_unblockuser');

}

// make it all happen on page load

if (window.addEventListener) window.addEventListener("load",nichalp_customLinks,false);

else if (window.attachEvent) window.attachEvent("onload",nichalp_customLinks);

else {

window._old_nichalp_onload = window.onload;

window.onload = function() { window._old_nichalp_onload(); nichalp_customLinks(); }

}

//

// User:Dschwen/wikiminiatlas2.js - please include this line

document.write('');

//

// Script from User:Lupin/editcount.js

document.write('