Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js |
— | — | @@ -46,20 +46,15 @@ |
47 | 47 | var previewSize = 180, |
48 | 48 | thumb = $( '<div id="mw-upload-thumbnail" class="thumb tright">' + |
49 | 49 | '<div class="thumbinner">' + |
50 | | - '<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>' + |
| 50 | + '<div class="mw-small-spinner" style="width: 180px; height: 180px"></div>' + |
51 | 51 | '<div class="thumbcaption"><div class="filename"></div><div class="fileinfo"></div></div>' + |
52 | 52 | '</div>' + |
53 | 53 | '</div>' ); |
54 | 54 | thumb.find( '.filename' ).text( file.name ).end() |
55 | 55 | .find( '.fileinfo' ).text( prettySize( file.size ) ).end(); |
56 | 56 | |
57 | | - var ctx = thumb.find( 'canvas' )[0].getContext( '2d' ), |
58 | | - spinner = new Image(); |
59 | | - spinner.onload = function() { |
60 | | - ctx.drawImage( spinner, (previewSize - spinner.width) / 2, |
61 | | - (previewSize - spinner.height) / 2 ); |
62 | | - }; |
63 | | - spinner.src = mw.config.get( 'wgScriptPath' ) + '/skins/common/images/spinner.gif'; |
| 57 | + var $canvas = $('<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>'), |
| 58 | + ctx = $canvas[0].getContext( '2d' ); |
64 | 59 | $( '#mw-htmlform-source' ).parent().prepend( thumb ); |
65 | 60 | |
66 | 61 | var meta; |
— | — | @@ -131,6 +126,7 @@ |
132 | 127 | ctx.clearRect( 0, 0, 180, 180 ); |
133 | 128 | ctx.rotate( rotation / 180 * Math.PI ); |
134 | 129 | ctx.drawImage( img, x, y, width, height ); |
| 130 | + thumb.find('.mw-small-spinner').replaceWith($canvas); |
135 | 131 | |
136 | 132 | // Image size |
137 | 133 | var info = mw.msg( 'widthheight', logicalWidth, logicalHeight ) + |