User:Saibo/afterUploadTab.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 User:Saibo/afterUploadTab. |
/*
* Adds http://toolserver.org/~revolus/afterUpload to the toolbox (not a tab to save space) on file pages.
* Tested on these skins and projects:
* dewp: Monobook
* COM : Monobook, Vector, Simple, KölnBlau, Chick, Modern, Nostalgia
*
* Usage: add the following lines (without the *) to your [[Special:Mypage/monobook.js]]/[[Special:Mypage/vector.js]]:
*
* mw.loader.load("//commons.wikimedia.org/w/index.php?title=User:Saibo/afterUploadTab.js&action=raw&ctype=text/javascript"); // use tracking (do not remove): [[User:Saibo/afterUploadTab.js]]
*
*
*
* Watch this page to be notified on changes! This is not a stable gadget!
*
* Authors of the base code at http://de.wikipedia.org/w/index.php?title=MediaWiki:Gadget-toolserver-integration.js&action=history (Merlissimo, Arnomane, ...)
* This script is JSHint valid.
*/
/*global jQuery:false, mw:false */
jQuery(document).ready(function () {
'use strict';
var project = mw.config.get('wgServer'); // get the current project - at least de.wp and common
var lang = 'en';
if (mw.config.get('wgUserLanguage') === 'de') { // the TS tool currently only supports de and en
lang = 'de';
}
var tab_SaiboAUT_title = 'afterUpload';
var tab_SaiboAUT_tooltip;
switch (mw.config.get('wgUserLanguage').split('-')[0]) { // i18n
case 'de':
tab_SaiboAUT_tooltip = 'Des Hochladers Bearbeitungen nach dem Hochladen dieser Datei';
break;
case 'qqx':
tab_SaiboAUT_tooltip = '(User:Saibo/afterUploadTab.js/tab_SaiboAUT_tooltip)';
break;
default:
tab_SaiboAUT_tooltip = 'Uploader’s edits after uploading this file';
}
if (mw.config.get('wgAction') === 'view') {
if (mw.config.get('wgNamespaceNumber') === 6) {
mw.util.addPortletLink('p-tb', '//toolserver.org/~revolus/afterUpload/?lang=' + mw.util.rawurlencode(lang) + '&project=' + mw.util.rawurlencode(project) + '&image=' + mw.util.rawurlencode(mw.config.get('wgTitle')), tab_SaiboAUT_title, 't-SaiboAUT', tab_SaiboAUT_tooltip, null, null);
}
}
});
// [[Category:User scripts]]