diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /resources/mediawiki.special | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'resources/mediawiki.special')
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.changeemail.css (renamed from resources/mediawiki.special/mediawiki.special.preferences.css) | 6 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.changeemail.js | 40 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.changeslist.css | 9 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.javaScriptTest.js | 33 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.movePage.js | 2 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.preferences.js | 43 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.recentchanges.js | 8 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.search.css | 10 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.search.js | 4 | ||||
-rw-r--r-- | resources/mediawiki.special/mediawiki.special.upload.js | 83 |
10 files changed, 142 insertions, 96 deletions
diff --git a/resources/mediawiki.special/mediawiki.special.preferences.css b/resources/mediawiki.special/mediawiki.special.changeemail.css index 8f628a95..3d53e8db 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.css +++ b/resources/mediawiki.special/mediawiki.special.changeemail.css @@ -1,14 +1,10 @@ #mw-emailaddress-validity { padding: 2px 1em; } -body.ltr #mw-emailaddress-validity { +#mw-emailaddress-validity { border-bottom-right-radius: 0.8em; border-top-right-radius: 0.8em; } -body.rtl #mw-emailaddress-validity { - border-bottom-left-radius: 0.8em; - border-top-left-radius: 0.8em; -} #mw-emailaddress-validity.valid { border: 1px solid #80FF80; background-color: #C0FFC0; diff --git a/resources/mediawiki.special/mediawiki.special.changeemail.js b/resources/mediawiki.special/mediawiki.special.changeemail.js new file mode 100644 index 00000000..6b4ed81d --- /dev/null +++ b/resources/mediawiki.special/mediawiki.special.changeemail.js @@ -0,0 +1,40 @@ +/* + * JavaScript for Special:ChangeEmail + */ +( function( $, mw ) { + +/** + * Given an email validity status (true, false, null) update the label CSS class + */ +var updateMailValidityLabel = function( mail ) { + var isValid = mw.util.validateEmail( mail ), + $label = $( '#mw-emailaddress-validity' ); + + // We allow empty address + if( isValid === null ) { + $label.text( '' ).removeClass( 'valid invalid' ); + + // Valid + } else if ( isValid ) { + $label.text( mw.msg( 'email-address-validity-valid' ) ).addClass( 'valid' ).removeClass( 'invalid' ); + + // Not valid + } else { + $label.text( mw.msg( 'email-address-validity-invalid' ) ).addClass( 'invalid' ).removeClass( 'valid' ); + } +}; + +// Lame tip to let user know if its email is valid. See bug 22449 +// Only bind once for 'blur' so that the user can fill it in without errors +// After that look at every keypress for direct feedback if it was invalid onblur +$( '#wpNewEmail' ).one( 'blur', function() { + if ( $( '#mw-emailaddress-validity' ).length === 0 ) { + $(this).after( '<label for="wpNewEmail" id="mw-emailaddress-validity"></label>' ); + } + updateMailValidityLabel( $(this).val() ); + $(this).keyup( function() { + updateMailValidityLabel( $(this).val() ); + } ); +} ); + +} )( jQuery, mediaWiki ); diff --git a/resources/mediawiki.special/mediawiki.special.changeslist.css b/resources/mediawiki.special/mediawiki.special.changeslist.css index cb4d2156..42afbcd7 100644 --- a/resources/mediawiki.special/mediawiki.special.changeslist.css +++ b/resources/mediawiki.special/mediawiki.special.changeslist.css @@ -7,7 +7,8 @@ table.mw-enhanced-rc { border-spacing: 0; } -table.mw-enhanced-rc th, table.mw-enhanced-rc td { +table.mw-enhanced-rc th, +table.mw-enhanced-rc td { padding: 0; vertical-align: top; } @@ -30,8 +31,10 @@ table.mw-enhanced-rc td.mw-enhanced-rc-nested { float: none; } -/* If JS is disabled, the arrow is still needed - for spacing, but ideally shouldn't be shown */ +/** + * If JS is disabled, the arrow is still needed + * for spacing, but ideally shouldn't be shown + */ .mw-enhanced-rc .mw-rc-openarrow { visibility: hidden; } diff --git a/resources/mediawiki.special/mediawiki.special.javaScriptTest.js b/resources/mediawiki.special/mediawiki.special.javaScriptTest.js new file mode 100644 index 00000000..d413f602 --- /dev/null +++ b/resources/mediawiki.special/mediawiki.special.javaScriptTest.js @@ -0,0 +1,33 @@ +/* + * JavaScript for Special:JavaScriptTest + */ +jQuery( document ).ready( function( $ ) { + + // Create useskin dropdown menu and reload onchange to the selected skin + // (only if a framework was found, not on error pages). + $( '#mw-javascripttest-summary.mw-javascripttest-frameworkfound' ).append( function() { + + var $html = $( '<p><label for="useskin">' + + mw.message( 'javascripttest-pagetext-skins' ).escaped() + + ' ' + + '</label></p>' ), + select = '<select name="useskin" id="useskin">'; + + // Build <select> further + $.each( mw.config.get( 'wgAvailableSkins' ), function( id ) { + select += '<option value="' + id + '"' + + ( mw.config.get( 'skin' ) === id ? ' selected="selected"' : '' ) + + '>' + mw.message( 'skinname-' + id ).escaped() + '</option>'; + } ); + select += '</select>'; + + // Bind onchange event handler and append to form + $html.append( + $( select ).change( function() { + window.location = QUnit.url( { useskin: $(this).val() } ); + } ) + ); + + return $html; + } ); +} ); diff --git a/resources/mediawiki.special/mediawiki.special.movePage.js b/resources/mediawiki.special/mediawiki.special.movePage.js index 2f94cc06..68c2ed07 100644 --- a/resources/mediawiki.special/mediawiki.special.movePage.js +++ b/resources/mediawiki.special/mediawiki.special.movePage.js @@ -1,5 +1,5 @@ /* JavaScript for Special:MovePage */ jQuery( function( $ ) { - $( '#wpReason' ).byteLimit(); + $( '#wpReason, #wpNewTitleMain' ).byteLimit(); }); diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js index 2e07e7f1..b7200826 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -22,7 +22,7 @@ $legends.each( function( i, legend ) { $legend.parent().show(); } var ident = $legend.parent().attr( 'id' ); - + var $li = $( '<li/>', { 'class' : ( i === 0 ) ? 'selected' : null }); @@ -37,7 +37,7 @@ $legends.each( function( i, legend ) { var scrollTop = $(window).scrollTop(); window.location.hash = $(this).attr('href'); $(window).scrollTop(scrollTop); - + $preftoc.find( 'li' ).removeClass( 'selected' ); $(this).parent().addClass( 'selected' ); $( '#preferences > fieldset' ).hide(); @@ -58,41 +58,6 @@ $( function() { } } ); -/** - * Given an email validity status (true, false, null) update the label CSS class - */ -var updateMailValidityLabel = function( mail ) { - var isValid = mw.util.validateEmail( mail ), - $label = $( '#mw-emailaddress-validity' ); - - // We allow empty address - if( isValid === null ) { - $label.text( '' ).removeClass( 'valid invalid' ); - - // Valid - } else if ( isValid ) { - $label.text( mw.msg( 'email-address-validity-valid' ) ).addClass( 'valid' ).removeClass( 'invalid' ); - - // Not valid - } else { - $label.text( mw.msg( 'email-address-validity-invalid' ) ).addClass( 'invalid' ).removeClass( 'valid' ); - } -}; - -// Lame tip to let user know if its email is valid. See bug 22449 -// Only bind once for 'blur' so that the user can fill it in without errors -// After that look at every keypress for direct feedback if it was invalid onblur -$( '#mw-input-wpemailaddress' ).one( 'blur', function() { - if ( $( '#mw-emailaddress-validity' ).length === 0 ) { - $(this).after( '<label for="mw-input-wpemailaddress" id="mw-emailaddress-validity"></label>' ); - } - updateMailValidityLabel( $(this).val() ); - $(this).keyup( function() { - updateMailValidityLabel( $(this).val() ); - } ); -} ); - - /** * Timezone functions. @@ -145,7 +110,7 @@ var updateTimezoneSelection = function() { $tzTextbox.val( minutesToHours( minuteDiff ) ); $tzSelect.val( 'other' ); $tzTextbox.get( 0 ).disabled = false; - } else if ( type == 'other' ) { + } else if ( type == 'other' ) { // Grab data from the textbox, parse it. minuteDiff = hoursToMinutes( $tzTextbox.val() ); } else { @@ -172,4 +137,4 @@ if ( $tzSelect.length && $tzTextbox.length ) { $tzTextbox.blur( function() { updateTimezoneSelection(); } ); updateTimezoneSelection(); } -} )( jQuery, mediaWiki ); +} )( jQuery, mediaWiki );
\ No newline at end of file diff --git a/resources/mediawiki.special/mediawiki.special.recentchanges.js b/resources/mediawiki.special/mediawiki.special.recentchanges.js index 7e284fbd..3d520f5e 100644 --- a/resources/mediawiki.special/mediawiki.special.recentchanges.js +++ b/resources/mediawiki.special/mediawiki.special.recentchanges.js @@ -9,24 +9,24 @@ var $select = null; var rc = mw.special.recentchanges = { - + /** * Handler to disable/enable the namespace selector checkboxes when the * special 'all' namespace is selected/unselected respectively. */ - updateCheckboxes: function() { + updateCheckboxes: function() { // The option element for the 'all' namespace has an empty value var isAllNS = ('' === $select.find('option:selected').val() ); // Iterates over checkboxes and propagate the selected option $.each( checkboxes, function( i, id ) { - $( '#' + id ).attr( 'disabled', isAllNS ); + $( '#' + id ).prop( 'disabled', isAllNS ); }); }, init: function() { // Populate - $select = $( '#namespace' ); + $select = $( '#namespace' ); // Bind to change event, and trigger once to set the initial state of the checkboxes. $select.change( rc.updateCheckboxes ).change(); diff --git a/resources/mediawiki.special/mediawiki.special.search.css b/resources/mediawiki.special/mediawiki.special.search.css index 89d55b0b..914e47e3 100644 --- a/resources/mediawiki.special/mediawiki.special.search.css +++ b/resources/mediawiki.special/mediawiki.special.search.css @@ -1,10 +1,10 @@ /** - * Fixes sister projects box moving down the extract + * Fixes sister projects box moving down the extract * of the first result (bug #16886). - * It only happens when the window is small and - * This changes slightly the layout for big screens - * where there was space for the extracts and the - * sister projects and thus it showed like in any + * It only happens when the window is small and + * This changes slightly the layout for big screens + * where there was space for the extracts and the + * sister projects and thus it showed like in any * other browser. * * This will only affect IE 7 and lower diff --git a/resources/mediawiki.special/mediawiki.special.search.js b/resources/mediawiki.special/mediawiki.special.search.js index bac27fc6..8865d04c 100644 --- a/resources/mediawiki.special/mediawiki.special.search.js +++ b/resources/mediawiki.special/mediawiki.special.search.js @@ -22,7 +22,7 @@ var headerLinks = $('.search-types a'); $('#searchText, #powerSearchText').change(function() { var searchterm = $(this).val(); headerLinks.each( function() { - var parts = this.href.split( 'search=' ); + var parts = $(this).attr('href').split( 'search=' ); var lastpart = ''; var prefix = 'search='; if( parts.length > 1 && parts[1].indexOf('&') >= 0 ) { @@ -34,4 +34,4 @@ $('#searchText, #powerSearchText').change(function() { }); }).trigger('change'); -} );
\ No newline at end of file +} ); diff --git a/resources/mediawiki.special/mediawiki.special.upload.js b/resources/mediawiki.special/mediawiki.special.upload.js index 4a8622f5..85b3f3f5 100644 --- a/resources/mediawiki.special/mediawiki.special.upload.js +++ b/resources/mediawiki.special/mediawiki.special.upload.js @@ -25,7 +25,7 @@ jQuery( function( $ ) { * @return boolean */ function fileIsPreviewable( file ) { - var known = ['image/png', 'image/gif', 'image/jpeg'], + var known = ['image/png', 'image/gif', 'image/jpeg', 'image/svg+xml'], tooHuge = 10 * 1024 * 1024; return ( $.inArray( file.type, known ) !== -1 ) && file.size > 0 && file.size < tooHuge; } @@ -46,27 +46,22 @@ jQuery( function( $ ) { var previewSize = 180, thumb = $( '<div id="mw-upload-thumbnail" class="thumb tright">' + '<div class="thumbinner">' + - '<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>' + + '<div class="mw-small-spinner" style="width: 180px; height: 180px"></div>' + '<div class="thumbcaption"><div class="filename"></div><div class="fileinfo"></div></div>' + '</div>' + '</div>' ); thumb.find( '.filename' ).text( file.name ).end() .find( '.fileinfo' ).text( prettySize( file.size ) ).end(); - - var ctx = thumb.find( 'canvas' )[0].getContext( '2d' ), - spinner = new Image(); - spinner.onload = function() { - ctx.drawImage( spinner, (previewSize - spinner.width) / 2, - (previewSize - spinner.height) / 2 ); - }; - spinner.src = mw.config.get( 'wgScriptPath' ) + '/skins/common/images/spinner.gif'; + + var $canvas = $('<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>'), + ctx = $canvas[0].getContext( '2d' ); $( '#mw-htmlform-source' ).parent().prepend( thumb ); var meta; fetchPreview( file, function( dataURL ) { var img = new Image(), rotation = 0; - + if ( meta && meta.tiff && meta.tiff.Orientation ) { rotation = (360 - function () { // See includes/media/Bitmap.php @@ -82,7 +77,7 @@ jQuery( function( $ ) { } }() ) % 360; } - + img.onload = function() { var width, height, x, y, dx, dy, logicalWidth, logicalHeight; // Fit the image within the previewSizexpreviewSize box @@ -98,7 +93,7 @@ jQuery( function( $ ) { dy = (180 - height) / 2; switch ( rotation ) { // If a rotation is applied, the direction of the axis - // changes as well. You can derive the values below by + // changes as well. You can derive the values below by // drawing on paper an axis system, rotate it and see // where the positive axis direction is case 0: @@ -108,7 +103,7 @@ jQuery( function( $ ) { logicalHeight = img.height; break; case 90: - + x = dx; y = dy - previewSize; logicalWidth = img.height; @@ -127,11 +122,12 @@ jQuery( function( $ ) { logicalHeight = img.width; break; } - + ctx.clearRect( 0, 0, 180, 180 ); ctx.rotate( rotation / 180 * Math.PI ); ctx.drawImage( img, x, y, width, height ); - + thumb.find('.mw-small-spinner').replaceWith($canvas); + // Image size var info = mw.msg( 'widthheight', logicalWidth, logicalHeight ) + ', ' + prettySize( file.size ); @@ -160,20 +156,33 @@ jQuery( function( $ ) { */ function fetchPreview( file, callback, callbackBinary ) { var reader = new FileReader(); - reader.onload = function() { - if ( callbackBinary ) { - callbackBinary( reader.result ); - reader.onload = function() { - callback( reader.result ); - }; - reader.readAsDataURL( file ); - } else { - callback( reader.result ); - } - }; if ( callbackBinary ) { + // To fetch JPEG metadata we need a binary string; start there. + // todo: + reader.onload = function() { + callbackBinary( reader.result ); + + // Now run back through the regular code path. + fetchPreview(file, callback ); + }; reader.readAsBinaryString( file ); + } else if ('URL' in window && 'createObjectURL' in window.URL) { + // Supported in Firefox 4.0 and above <https://developer.mozilla.org/en/DOM/window.URL.createObjectURL> + // WebKit has it in a namespace for now but that's ok. ;) + // + // Lifetime of this URL is until document close, which is fine + // for Special:Upload -- if this code gets used on longer-running + // pages, add a revokeObjectURL() when it's no longer needed. + // + // Prefer this over readAsDataURL for Firefox 7 due to bug reading + // some SVG files from data URIs <https://bugzilla.mozilla.org/show_bug.cgi?id=694165> + callback(window.URL.createObjectURL(file)); } else { + // This ends up decoding the file to base-64 and back again, which + // feels horribly inefficient. + reader.onload = function() { + callback( reader.result ); + }; reader.readAsDataURL( file ); } } @@ -200,7 +209,7 @@ jQuery( function( $ ) { function clearPreview() { $( '#mw-upload-thumbnail' ).remove(); } - + /** * Check if the file does not exceed the maximum size */ @@ -213,18 +222,18 @@ jQuery( function( $ ) { return sizes['*']; } $( '.mw-upload-source-error' ).remove(); - - var maxSize = getMaxUploadSize( 'file' ); + + var maxSize = getMaxUploadSize( 'file' ); if ( file.size > maxSize ) { - var error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' + + var error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' + mw.message( 'largefileserver', file.size, maxSize ).escaped() + '</p>' ); $( '#wpUploadFile' ).after( error ); return false; } return true; } - - + + /** * Initialization */ @@ -235,11 +244,11 @@ jQuery( function( $ ) { if ( this.files && this.files.length ) { // Note: would need to be updated to handle multiple files. var file = this.files[0]; - + if ( !checkMaxUploadSize( file ) ) { return; } - + if ( fileIsPreviewable( file ) ) { showPreview( file ); } @@ -261,9 +270,9 @@ jQuery( function ( $ ) { $( '.mw-upload-source-error' ).remove(); if ( this.checked ) { // Disable all inputs - $( 'input[name!="wpSourceType"]', rows ).attr( 'disabled', true ); + $( 'input[name!="wpSourceType"]', rows ).prop( 'disabled', 'disabled' ); // Re-enable the current one - $( 'input', currentRow ).attr( 'disabled', false ); + $( 'input', currentRow ).prop( 'disabled', false ); } }; }() ); |