diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3d9e0e819fc..a5f399e5c18 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1201,7 +1201,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '83'; +$wgStyleVersion = '84'; # Server-side caching: diff --git a/includes/Skin.php b/includes/Skin.php index aa5623773a2..21b60ec2001 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1652,5 +1652,5 @@ END; wfProfileOut( $fname ); return $bar; } -} - + +} \ No newline at end of file diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 75a0f6a6cac..00cf7ef35bb 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -572,7 +572,7 @@ class UploadForm { $output = $wgParser->parse( $revision->getText(), $title, new ParserOptions() ); return $output->getText(); } - return ''; + return wfMsgHtml( 'license-nopreview' ); } /** @@ -890,7 +890,8 @@ EOT " ); if( $useAjaxLicencePreview ) { $wgOut->addHtml( " - + + " ); } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 362ed4d09f0..2c7c7956039 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1417,6 +1417,7 @@ If you have this image in full resolution upload this one, otherwise change the 'license' => 'Licensing', 'nolicense' => 'None selected', 'licenses' => '-', # don't translate or duplicate this message to other languages +'license-nopreview' => '(Preview not available)', 'upload_source_url' => ' (a valid, publicly accessible URL)', 'upload_source_file' => ' (a file on your computer)', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index d8e7a6d1fce..2351877ee3d 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -827,6 +827,7 @@ $wgMessageStructure = array( 'license', 'nolicense', 'licenses', + 'license-nopreview', 'upload_source_url', 'upload_source_file', ), diff --git a/skins/common/images/spinner.gif b/skins/common/images/spinner.gif new file mode 100644 index 00000000000..1cca4cc3554 Binary files /dev/null and b/skins/common/images/spinner.gif differ diff --git a/skins/common/upload.js b/skins/common/upload.js index 3fc5fa0a47c..d6f589fb906 100644 --- a/skins/common/upload.js +++ b/skins/common/upload.js @@ -147,6 +147,7 @@ var wgUploadLicenceObj = { if( licence in this.responseCache ) { this.showPreview( this.responseCache[licence] ); } else { + injectSpinner( document.getElementById( 'wpLicense' ), 'licence' ); sajax_do_call( 'UploadForm::ajaxGetLicencePreview', [licence], function( result ) { wgUploadLicenceObj.processResult( result, licence ); @@ -156,17 +157,17 @@ var wgUploadLicenceObj = { }, 'processResult' : function( result, licence ) { + removeSpinner( 'licence' ); this.showPreview( result.responseText ); this.responseCache[licence] = result.responseText; }, 'showPreview' : function( preview ) { var previewPanel = document.getElementById( 'mw-licence-preview' ); - if( previewPanel.innerHTML != preview ) { + if( previewPanel.innerHTML != preview ) previewPanel.innerHTML = preview; - } } - + } addOnloadHook( licenseSelectorFixup ); \ No newline at end of file diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 58d2fe6148a..e37cd4c39e3 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -1243,6 +1243,36 @@ function jsMsg( message, className ) { return true; } +/** + * Inject a cute little progress spinner after the specified element + * + * @param element Element to inject after + * @param id Identifier string (for use with removeSpinner(), below) + */ +function injectSpinner( element, id ) { + var spinner = document.createElement( "img" ); + spinner.id = "mw-spinner-" + id; + spinner.src = stylepath + "/common/images/spinner.gif"; + spinner.alt = spinner.title = "..."; + if( element.nextSibling ) { + element.parentNode.insertBefore( spinner, element.nextSibling ); + } else { + element.parentNode.appendChild( spinner ); + } +} + +/** + * Remove a progress spinner added with injectSpinner() + * + * @param id Identifier string + */ +function removeSpinner( id ) { + var spinner = document.getElementById( "mw-spinner-" + id ); + if( spinner ) { + spinner.parentNode.removeChild( spinner ); + } +} + function runOnloadHook() { // don't run anything below this for non-dom browsers if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) {