Index: trunk/extensions/WikiLove/wikiLove.css |
— | — | @@ -259,6 +259,13 @@ |
260 | 260 | float: right; |
261 | 261 | margin-top: 0.9em; |
262 | 262 | display: none; |
| 263 | + |
| 264 | + /* @embed */ |
| 265 | + background-image: url(images/spinner.gif); |
| 266 | + background-position: 0px 0px; |
| 267 | + background-repeat: repeat-x; |
| 268 | + width: 16px; |
| 269 | + height: 16px; |
263 | 270 | } |
264 | 271 | |
265 | 272 | /* add details gallery */ |
Index: trunk/extensions/WikiLove/wikiLove.js |
— | — | @@ -29,9 +29,6 @@ |
30 | 30 | // Test to see if the 'E-mail this user' link exists |
31 | 31 | $.wikiLove.emailable = $( '#t-emailuser' ).length ? true : false; |
32 | 32 | |
33 | | - // Reusable spinner string |
34 | | - var spinner = '<img class="wlSpinner" src="' + mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/images/spinner.gif' + '"/>'; |
35 | | - |
36 | 33 | // Build a type list like this: |
37 | 34 | var $typeList = $( '<ul id="wlTypes"></ul>' ); |
38 | 35 | for( var typeId in $.wikiLove.types ) { |
— | — | @@ -78,7 +75,7 @@ |
79 | 76 | <select id="wlSubtype"></select>\ |
80 | 77 | <div id="wlSubtypeDescription"></div>\ |
81 | 78 | <label id="wlGalleryLabel"><html:msg key="wikilove-image"/></label>\ |
82 | | - <div id="wlGallerySpinner">' + spinner + '</div>\ |
| 79 | + <div id="wlGallerySpinner" class="wlSpinner"></div>\ |
83 | 80 | <div id="wlGallery"></div>\ |
84 | 81 | <label for="wlHeader" id="wlHeaderLabel"><html:msg key="wikilove-header"/></label>\ |
85 | 82 | <input type="text" class="text" id="wlHeader"/>\ |
— | — | @@ -94,7 +91,7 @@ |
95 | 92 | <label for="wlNotifyCheckbox"><html:msg key="wikilove-notify"/></label>\ |
96 | 93 | </div>\ |
97 | 94 | <button class="submit" id="wlButtonPreview" type="submit"></button>\ |
98 | | - ' + spinner + '\ |
| 95 | + <div id="wlPreviewSpinner" class="wlSpinner"></div>\ |
99 | 96 | </form>\ |
100 | 97 | </div>\ |
101 | 98 | <div id="wlPreview">\ |
— | — | @@ -103,7 +100,7 @@ |
104 | 101 | <div id="wlPreviewArea"></div>\ |
105 | 102 | <form id="wlSendForm">\ |
106 | 103 | <button class="submit" id="wlButtonSend" type="submit"></button>\ |
107 | | - ' + spinner + '\ |
| 104 | + <div id="wlSendSpinner" class="wlSpinner"></div>\ |
108 | 105 | </form>\ |
109 | 106 | </div>\ |
110 | 107 | </div>' ); |
— | — | @@ -248,20 +245,17 @@ |
249 | 246 | if( $.wikiLove.currentTypeOrSubtype.gallery.imageList instanceof Array) { |
250 | 247 | $( '#wlGalleryLabel' ).show(); |
251 | 248 | $( '#wlGallery' ).show(); |
252 | | - $( '#wlGallerySpinner' ).show(); |
253 | 249 | $.wikiLove.showGallery(); // build gallery from array of images |
254 | 250 | } else { |
255 | 251 | // gallery is a category |
256 | 252 | $( '#wlGalleryLabel' ).show(); |
257 | 253 | $( '#wlGallery' ).show(); |
258 | | - $( '#wlGallerySpinner' ).show(); |
259 | 254 | $.wikiLove.makeGallery(); // build gallery from category |
260 | 255 | } |
261 | 256 | } |
262 | 257 | else { |
263 | 258 | $( '#wlGalleryLabel' ).hide(); |
264 | 259 | $( '#wlGallery' ).hide(); |
265 | | - $( '#wlGallerySpinner' ).hide(); |
266 | 260 | } |
267 | 261 | |
268 | 262 | if( $.inArray( 'notify', $.wikiLove.currentTypeOrSubtype.fields ) >= 0 && $.wikiLove.emailable ) { |
— | — | @@ -355,7 +349,7 @@ |
356 | 350 | * Fires AJAX request for previewing wikitext. |
357 | 351 | */ |
358 | 352 | doPreview: function( wikitext ) { |
359 | | - $( '#wlAddDetails .wlSpinner' ).fadeIn( 200 ); |
| 353 | + $( '#wlPreviewSpinner' ).fadeIn( 200 ); |
360 | 354 | $.ajax({ |
361 | 355 | url: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/api.php?', |
362 | 356 | data: { |
— | — | @@ -369,7 +363,7 @@ |
370 | 364 | type: 'POST', |
371 | 365 | success: function( data ) { |
372 | 366 | $.wikiLove.showPreview( data.parse.text['*'] ); |
373 | | - $( '#wlAddDetails .wlSpinner' ).fadeOut( 200 ); |
| 367 | + $( '#wlPreviewSpinner' ).fadeOut( 200 ); |
374 | 368 | } |
375 | 369 | }); |
376 | 370 | }, |
— | — | @@ -398,7 +392,7 @@ |
399 | 393 | * Fires the final AJAX request and then redirects to the talk page where the content is added. |
400 | 394 | */ |
401 | 395 | doSend: function( subject, wikitext, type, mail ) { |
402 | | - $( '#wlPreview .wlSpinner' ).fadeIn( 200 ); |
| 396 | + $( '#wlSendSpinner' ).fadeIn( 200 ); |
403 | 397 | |
404 | 398 | var sendData = { |
405 | 399 | 'action': 'wikilove', |
— | — | @@ -420,7 +414,7 @@ |
421 | 415 | dataType: 'json', |
422 | 416 | type: 'POST', |
423 | 417 | success: function( data ) { |
424 | | - $( '#wlPreview .wlSpinner' ).fadeOut( 200 ); |
| 418 | + $( '#wlSendSpinner' ).fadeOut( 200 ); |
425 | 419 | |
426 | 420 | if ( typeof data.error !== 'undefined' ) { |
427 | 421 | $( '#wlPreview' ).append( '<div class="wlError">' + mw.html.escape( data.error.info ) + '<div>' ); |
— | — | @@ -449,7 +443,7 @@ |
450 | 444 | showGallery: function() { |
451 | 445 | $( '#wlGallery' ).html( '' ); |
452 | 446 | $.wikiLove.gallery = {}; |
453 | | - $( '#wlGallerySpinner .wlSpinner' ).fadeIn( 200 ); |
| 447 | + $( '#wlGallerySpinner' ).fadeIn( 200 ); |
454 | 448 | |
455 | 449 | $.each( $.wikiLove.currentTypeOrSubtype.gallery.imageList, function(index, value) { |
456 | 450 | |
— | — | @@ -466,6 +460,8 @@ |
467 | 461 | dataType: 'json', |
468 | 462 | type: 'POST', |
469 | 463 | success: function( data ) { |
| 464 | + $( '#wlGallerySpinner' ).fadeOut( 200 ); |
| 465 | + |
470 | 466 | if ( !data || !data.query || !data.query.pages ) { |
471 | 467 | return; |
472 | 468 | } |
— | — | @@ -507,7 +503,7 @@ |
508 | 504 | makeGallery: function() { |
509 | 505 | $( '#wlGallery' ).html( '' ); |
510 | 506 | $.wikiLove.gallery = {}; |
511 | | - $( '#wlGallerySpinner .wlSpinner' ).fadeIn( 200 ); |
| 507 | + $( '#wlGallerySpinner' ).fadeIn( 200 ); |
512 | 508 | |
513 | 509 | $.ajax({ |
514 | 510 | url: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/api.php', |
— | — | @@ -582,7 +578,7 @@ |
583 | 579 | $( '#wlGalleryTitle' ).hide(); |
584 | 580 | } |
585 | 581 | |
586 | | - $( '#wlGallerySpinner .wlSpinner' ).fadeOut( 200 ); |
| 582 | + $( '#wlGallerySpinner' ).fadeOut( 200 ); |
587 | 583 | } |
588 | 584 | }); |
589 | 585 | }, |