User:JeremyMcCracken/monobook.js

addOnloadHook(contribstab); addOnloadHook(logstab); function contribstab { if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) { //If we're in User or User talk namespace var pagename; var name1; var name2; name1=wgPageName.indexOf(":"); //Find the colon to separate User: prefix if (name1 != -1) { //Skip it if we didn't find a colon name1=name1+1; pagename=wgPageName.substring(name1); } else { pagename=wgPageName; //if no colon, assume we have the user name already } name2=pagename.indexOf("/"); //If it's a subpage, get root name if (name2 > 0){ //if we found a slash earlier pagename=pagename.substring(0,name2); } addPortletLink ('p-cactions', '/wiki/Special:Contributions/'+pagename, 'Contributions', 1, 'View this user\'s contributions'); //Add the button } //resumes here for non-user/UT pages } //Written by Jeremy McCracken April, 2008 //Original file location http://en.wikipedia.org/wiki/User:JeremyMcCracken/contribstab.js

function logstab { if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) { //If we're in User or User talk namespace var pagename; var name1; var name2; name1=wgPageName.indexOf(":"); //Find the colon to separate User: prefix if (name1 != -1) { //Skip it if we didn't find a colon name1=name1+1; pagename=wgPageName.substring(name1); } else { pagename=wgPageName; //if no colon, assume we have the user name already } name2=pagename.indexOf("/"); //If it's a subpage, get root name if (name2 > 0){ //if we found a slash earlier pagename=pagename.substring(0,name2); } addPortletLink ('p-cactions', '/w/index.php?title=Special:Log&page=User:'+pagename, 'Logs', 1, 'View this user\'s logs'); //Add the button } //resumes here for non-user/UT pages } //Written by Jeremy McCracken June, 2008 //Original file location http://en.wikipedia.org/wiki/User:JeremyMcCracken/logstab.js