User:Paranomia/usertab.js

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

function isIPAddress( string ){ var res = /(\d{1,4})\.(\d{1,3})\.(\d{1,3})\.(\d{1,4})/.exec( string ); return res != null && res.slice( 1, 5 ).every( function( e ) { return e < 256; } ); } $(function {

var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk') && (wgAction == 'view' || document.getElementById('newarticletext'))) {       editlk = wgTitle; var slloc = editlk.indexOf('/'); if(slloc > 0) editlk = editlk.substring(0, slloc); if(!isIPAddress(editlk)) { addlimenu(tabs, 'User', 'userf'); var userf = document.getElementById('userf').getElementsByTagName('ul')[0]; // format: addlilink(userf, url, name); // add "listusers" tab // addlilink(userf, '/w/index.php?title=Special:Listusers&group=&username=' + editlk, 'list', '');

// add "check blocked" tab // addlilink(userf, 'http://en.wikipedia.org/w/index.php?title=Special%3AIpblocklist&ip=' + editlk, 'check blocked', ''); // addTab('http://en.wikipedia.org/w/index.php?title=Special%3AIpblocklist&ip=' + editlk, 'check blocked'); // add "contributions" tab addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contribs', ''); // addTab('/wiki/Special:Contributions/' + editlk, 'con'); // add "logs" tab addlilink(userf, '/w/index.php?title=Special:Log&user=' + editlk, 'log', ''); // add "userspace" tab addlilink(userf, '/w/index.php?title=Special:Prefixindex&namespace=2&from=' + editlk, 'subpages', ''); addlilink(userf, 'javascript:get_editcount_json(\ + editlk + '\')', 'count (quick)', ); // add "edit count" tab addlilink(userf, 'http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=' + editlk + '&site=en.wikipedia.org', 'count (full)', ''); // addTab('http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=' + editlk + '&site=en.wikipedia.org', 'count'); // add email tab addlilink(userf, '/wiki/Special:EmailUser/' + editlk, 'email', ''); // add "edit summary usage" tab addlilink(userf, 'http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?user=' + editlk, 'summary usage', ''); // addTab('http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?user=' + editlk, 'summary usage'); addlilink(userf, 'javascript:get_blocked_json(\ + editlk + '\')', 'check blocked', ); addlilink(userf, 'javascript:get_userlist_xml(\ + editlk + '\')', 'rights', ); addlilink(userf, 'http://en.wikipedia.org/w/index.php?title=User_talk:' + editlk + '&action=edit&section=new', 'leave message', ''); // addTab('http://en.wikipedia.org/w/index.php?title=User_talk:' + editlk + '&action=edit&section=new', 'leave message'); }      // ip stuff // if(isIPAddress(editlk)) mw.util.addPortletLink('p-cactions', 'http://hemlock.ts.wikimedia.org/~krimpet/torcheck.php?ip=' + editlk, 'tor', ''); } });