User:Erutuon/scripts/contributionsTab.js

/* Adds a "contributions" tab at the top of user pages, next to "watch"/"unwatch".

To enable this script, add this code to your Special:MyPage/common.css here on Wiktionary - importScript("User:Erutuon/contributionsTab.js"); -

or use this code on other wikis. - mw.loader.load('//en.wiktionary.org/w/index.php?title=User:Erutuon/contributionsTab.js&action=raw&ctype=text/javascript'); -

if ( [ 2, 3 ].indexOf(mw.config.get("wgNamespaceNumber")) !== -1 ) { //If we're in User or User talk namespace var username = mw.config.get("wgPageName").match(/^User(?:_talk)?\:([^\/]+)(?:\/.+)?$/); if (username !== null) { username = username[1]; mw.util.addPortletLink(			"p-cactions",			"/wiki/Special:Contributions/" + username,			"Contributions",			null,			"View this user\'s contributions"		); } /* else { console.log("Username not found in pagename."); } } else { console.log("No contributions tab added: not user or user talk namespace."); */ }