User:Paranomia/usertab.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Paranomia/usertab. |
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§ion=new', 'leave message', '');
// addTab('http://en.wikipedia.org/w/index.php?title=User_talk:' + editlk + '&action=edit§ion=new', 'leave message');
}
// ip stuff
// if(isIPAddress(editlk)) mw.util.addPortletLink('p-cactions', 'http://hemlock.ts.wikimedia.org/~krimpet/torcheck.php?ip=' + editlk, 'tor', '');
}
});