Line 1: |
Line 1: |
| /* Any JavaScript here will be loaded for all users on every page load. */ | | /* Any JavaScript here will be loaded for all users on every page load. */ |
| | | |
− | /**** Special:Upload enhancements ****** | + | |
− | * moved to [[MediaWiki:Upload.js]]
| + | //Fix "Upload file" link when using the secure proxy |
− | *
| + | //This is a workaround that can be removed when bug 10843 is fixed |
− | * Maintainer: [[User:Lupo]]
| + | addOnloadHook(function() |
− | ****/
| |
− | JSconfig.registerKey('UploadForm_loadform', true,
| |
− | {
| |
− | 'bg': 'Използване на логиката на новия формуляр за качвания',
| |
− | 'en': 'Use new upload form logic', // default
| |
− | 'mk': 'Искористете ја логиката на новиот образец за подигнување',
| |
− | 'ru': 'Использовать новую логику формы загрузки'
| |
− | }, 3);
| |
− | JSconfig.registerKey('UploadForm_newlayout', true,
| |
− | {
| |
− | 'bg': 'Използване на облика на новия формуляр за качвания',
| |
− | 'en': 'Use new upload form layout', // default
| |
− | 'mk': 'Искористете го рувото на новиот образец за подигнување',
| |
− | 'ru': 'Использовать новый интерфейс формы загрузки'
| |
− | }, 3);
| |
− |
| |
− | function enableNewUploadForm () | |
| { | | { |
− | var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/);
| + | if (document.getElementById("t-upload")) |
− | if (match) {
| + | { |
− | var webKitVersion = parseInt(match[1]);
| + | document.getElementById("t-upload").getElementsByTagName("a")[0].href = wgArticlePath.replace("$1", "Help:Upload") |
− | if (webKitVersion < 420) return; // Safari 2 crashes hard with the new upload form...
| + | } |
− | }
| + | }) |
− | | + | |
− | // honor JSConfig user settings
| + | // |
− | if( !JSconfig.keys['UploadForm_loadform'] ) return;
| + | // Insert a personalized Texttemplate into the Special:Upload edit box. |
− | | + | // |
− | importScript( 'MediaWiki:UploadForm.js' );
| + | function delayedUpdateSpecialUpload(){ |
| + | var editbox = document.getElementById('wpUploadDescription'); |
| + | |
| + | if (location.href == "http://wikivet.net/index.php/Special:Upload"){ |
| + | |
| + | editbox.value = "{"+"{Information\n" |
| + | + "|Description=\n" |
| + | + "|Source=\n" |
| + | + "|Date=\n" |
| + | + "|Author=\n" |
| + | + "|Permission=See below\n" |
| + | + "|Other_versions=\n" |
| + | + "}"+"}\n\n"; |
| + | } |
| + | |
| + | if (location.href == "http://wikivet.net/index.php?title=Special:Upload&uselang=own"){ |
| + | |
| + | editbox.value = "{"+"{Information\n" |
| + | + "|Description=\n" |
| + | + "|Source=Own Work\n" |
| + | + "|Date=" + window.location.pathname + "\n" |
| + | + "|Author=" + "\[\[User:" + wgUserName + "|" + wgUserName + "\]\]" + "\n" |
| + | + "|Permission=See below\n" |
| + | + "}"+"}\n\n"; |
| + | } |
| + | |
| + | if (window.location.pathname == "/index.php"){ |
| + | |
| + | editbox.value = "{"+"{Information\n" |
| + | + "|Description=\n" |
| + | + "|Source=\n" |
| + | + "|Date=\n" |
| + | + "|Author=\n" |
| + | + "|Permission=See below\n" |
| + | + "}"+"}\n\n"; |
| + | } |
| } | | } |
− |
| + | addOnloadHook(delayedUpdateSpecialUpload); |
− | if (wgPageName == 'Special:Upload')
| + | |
− | {
| |
− | importScript( 'MediaWiki:Upload.js' );
| |
− | // Uncomment the following line (the call to enableNewUploadForm) to globally enable the
| |
− | // new upload form. Leave the line *above* (the include of MediaWiki:Upload.js) untouched;
| |
− | // that script provides useful default behavior if the new upload form is disabled or
| |
− | // redirects to the old form in case an error occurs.
| |
− | enableNewUploadForm ();
| |
− | }
| |
− |
| |
− | // We may be running MediaWiki:UploadForm.js on this site. The following script changes the
| |
− | // "reupload" links on image pages to go to the basic form.
| |
− | if (wgNamespaceNumber == 6) importScript ('MediaWiki:UploadFormLinkFixer.js');
| |
| | | |
| function includePage( name ) | | function includePage( name ) |