MediaWiki:Mypage.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at MediaWiki:Mypage. |
// Small script to emulate Special:Mypage for other Special-pages (Mycontributions, Mylogs etc.)
// Usage: https://commons.wikimedia.org/w/index.php?title=Special:Log&type=patrol&withJS=MediaWiki:Mypage.js
// Revision: 2015-08-25
// Maintainer: Krinkle
/*global mw */
mw.loader.using(['mediawiki.util']).then(function () {
var conf = mw.config.get([
'wgCanonicalNamespace',
'wgUserName',
'wgCanonicalSpecialPageName',
'wgPageName',
'wgScript'
]);
// Only on Special pages for logged-in users
if (conf.wgCanonicalNamespace === 'Special' && conf.wgUserName) {
switch (conf.wgCanonicalSpecialPageName) {
case 'Contributions':
location.href = conf.wgScript + '?title=' + conf.wgPageName + '&target=' + conf.wgUserName;
break;
case 'Log':
if (mw.util.getParamValue('type')) {
location.href = conf.wgScript + '?title=' + conf.wgPageName + '/'+ mw.util.getParamValue('type') + '&user=' + conf.wgUserName;
} else {
location.href = conf.wgScript + '?title=' + conf.wgPageName + '&user=' + conf.wgUserName;
}
break;
default:
// Do nothing
}
}
}());