|
|
Řádek 3: |
Řádek 3: |
| importScriptURI('http://en.wikipedia.org/w/index.php?title=User:ProveIt_GT/ProveIt.js&action=raw&ctype=text/javascript'); | | importScriptURI('http://en.wikipedia.org/w/index.php?title=User:ProveIt_GT/ProveIt.js&action=raw&ctype=text/javascript'); |
| // [[User:ProveIt GT/ProveIt.js]] | | // [[User:ProveIt GT/ProveIt.js]] |
|
| |
| /****************** MyUploads ***********************
| |
|
| |
| Puts a link in the upper right corner of all pages.
| |
| This code is JSHint valid!
| |
|
| |
| Maintainer: [[User:Rd232]]
| |
| written in 2011
| |
| *****************************************************/
| |
|
| |
| /*global mw: false, jQuery: false, $: false */
| |
| /*jshint curly:false, */
| |
|
| |
| (function () {
| |
| 'use strict';
| |
| if (window.uploadLink || mw.user.anonymous()) return;
| |
|
| |
| window.uploadLink = { // extra-object to prevent pollution of "window"
| |
| getUserName: function () {
| |
| var username = '';
| |
| switch (mw.config.get('wgNamespaceNumber')) {
| |
| case 3: // User_talk
| |
| case 2: // User
| |
| username = mw.config.get('wgPageName').match(/.*?\:(.*?)(\/.*)*$/)[1];
| |
| break;
| |
| case -1: // Special pages
| |
| try {
| |
| if ("Contributions" === mw.config.get('wgCanonicalSpecialPageName')) {
| |
| if (-1 !== location.href.indexOf("\/Special:Contributions\/")) {
| |
| username = decodeURI(location.href.match(/Special\:Contributions\/(.*?)$/)[1]);
| |
| } else if (-1 !== location.href.indexOf(mw.config.get('wgScript'))) {
| |
| username = mw.util.getParamValue('target');
| |
| }
| |
| }
| |
| if ("Log" === mw.config.get('wgCanonicalSpecialPageName')) {
| |
| if (mw.util.getParamValue('user')) username = mw.util.getParamValue('user');
| |
| if (mw.util.getParamValue('page')) {
| |
| if (/User:+./.test(mw.util.getParamValue('page'))) {
| |
| username = mw.util.getParamValue('page').replace("User:", "");
| |
| }
| |
| }
| |
| }
| |
| } catch (ex) {}
| |
| break;
| |
| }
| |
| return username;
| |
| },
| |
|
| |
| install: function () {
| |
| var link, userlink, username = encodeURI(this.getUserName());
| |
|
| |
| link = mw.config.get('wgScript') + '?title=' + 'Special:MyUploads';
| |
| userlink = mw.config.get('wgScript') + '?title=' + 'Special:ListFiles/' + username;
| |
|
| |
| var userlinkTexts = {
| |
| // Translations of the menu item
| |
| i18n: {
| |
| 'be-tarask': '???????? ??????????',
| |
| 'be-x-old': '???????? ??????????',
| |
| 'de': 'Benutzeruploads',
| |
| 'en': 'User uploads',
| |
| 'et': 'Kasutaja üleslaadimised',
| |
| 'fr': 'Imports de l’utilisateur',
| |
| 'it': 'Caricamenti utente',
| |
| 'ml': '?????????????? ???\u200c??????',
| |
| 'ru': '???????? ?????????'
| |
| }
| |
| };
| |
|
| |
| var linkTextList = {
| |
| // Translations of the menu item
| |
| i18n: {
| |
| 'cs': 'Moje soubory',
| |
| 'de': 'Eigene Dateien',
| |
| 'en': 'My uploads', // default
| |
| }
| |
| };
| |
|
| |
| var linkTooltipList = {
| |
| // Translations of the menu item tooltip
| |
| i18n: {
| |
| 'cs': 'Seznam vašich načtených souborů',
| |
| 'de': 'Liste der Dateien, die du hochgeladen hast',
| |
| 'en': 'List of files you have uploaded', // default
| |
| }
| |
| };
| |
|
| |
| var linkText = linkTextList.i18n[mw.config.get('wgUserLanguage')] || linkTextList.i18n[mw.config.get('wgUserLanguage').split('-')[0]] || linkTextList.i18n.en;
| |
| var linkTooltip = linkTooltipList.i18n[mw.config.get('wgUserLanguage')] || linkTooltipList.i18n[mw.config.get('wgUserLanguage').split('-')[0]] || linkTooltipList.i18n.en;
| |
|
| |
| mw.util.addPortletLink('p-personal', link, linkText, 'pt-upl', linkTooltip, '', document.getElementById('pt-logout'));
| |
|
| |
| var userlinkText = userlinkTexts.i18n[mw.config.get('wgUserLanguage')] || userlinkTexts.i18n[mw.config.get('wgUserLanguage').split('-')[0]] || userlinkTexts.i18n.en;
| |
| if (username) {
| |
| mw.util.addPortletLink('p-tb', userlink, userlinkText, 't-JSONListUploads', '', '', document.getElementById('t-log'));
| |
| }
| |
| } // function
| |
| }; // object
| |
/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky. */
importScriptURI('http://en.wikipedia.org/w/index.php?title=User:ProveIt_GT/ProveIt.js&action=raw&ctype=text/javascript');
// [[User:ProveIt GT/ProveIt.js]]