User:Erutuon/scripts/contributionsTab.js
< User:Erutuon | scripts
Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- This script lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • redirects • your own
/*
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.");
*/
}