r88781 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88780‎ | r88781 | r88782 >
Date:11:03, 25 May 2011
Author:janpaul123
Status:ok
Tags:
Comment:
Modified paths:
  • /trunk/extensions/WikiLove/wikiLove.css (modified) (history)
  • /trunk/extensions/WikiLove/wikiLove.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/wikiLove.css
@@ -259,6 +259,13 @@
260260 float: right;
261261 margin-top: 0.9em;
262262 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;
263270 }
264271
265272 /* add details gallery */
Index: trunk/extensions/WikiLove/wikiLove.js
@@ -29,9 +29,6 @@
3030 // Test to see if the 'E-mail this user' link exists
3131 $.wikiLove.emailable = $( '#t-emailuser' ).length ? true : false;
3232
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 -
3633 // Build a type list like this:
3734 var $typeList = $( '<ul id="wlTypes"></ul>' );
3835 for( var typeId in $.wikiLove.types ) {
@@ -78,7 +75,7 @@
7976 <select id="wlSubtype"></select>\
8077 <div id="wlSubtypeDescription"></div>\
8178 <label id="wlGalleryLabel"><html:msg key="wikilove-image"/></label>\
82 - <div id="wlGallerySpinner">' + spinner + '</div>\
 79+ <div id="wlGallerySpinner" class="wlSpinner"></div>\
8380 <div id="wlGallery"></div>\
8481 <label for="wlHeader" id="wlHeaderLabel"><html:msg key="wikilove-header"/></label>\
8582 <input type="text" class="text" id="wlHeader"/>\
@@ -94,7 +91,7 @@
9592 <label for="wlNotifyCheckbox"><html:msg key="wikilove-notify"/></label>\
9693 </div>\
9794 <button class="submit" id="wlButtonPreview" type="submit"></button>\
98 - ' + spinner + '\
 95+ <div id="wlPreviewSpinner" class="wlSpinner"></div>\
9996 </form>\
10097 </div>\
10198 <div id="wlPreview">\
@@ -103,7 +100,7 @@
104101 <div id="wlPreviewArea"></div>\
105102 <form id="wlSendForm">\
106103 <button class="submit" id="wlButtonSend" type="submit"></button>\
107 - ' + spinner + '\
 104+ <div id="wlSendSpinner" class="wlSpinner"></div>\
108105 </form>\
109106 </div>\
110107 </div>' );
@@ -248,20 +245,17 @@
249246 if( $.wikiLove.currentTypeOrSubtype.gallery.imageList instanceof Array) {
250247 $( '#wlGalleryLabel' ).show();
251248 $( '#wlGallery' ).show();
252 - $( '#wlGallerySpinner' ).show();
253249 $.wikiLove.showGallery(); // build gallery from array of images
254250 } else {
255251 // gallery is a category
256252 $( '#wlGalleryLabel' ).show();
257253 $( '#wlGallery' ).show();
258 - $( '#wlGallerySpinner' ).show();
259254 $.wikiLove.makeGallery(); // build gallery from category
260255 }
261256 }
262257 else {
263258 $( '#wlGalleryLabel' ).hide();
264259 $( '#wlGallery' ).hide();
265 - $( '#wlGallerySpinner' ).hide();
266260 }
267261
268262 if( $.inArray( 'notify', $.wikiLove.currentTypeOrSubtype.fields ) >= 0 && $.wikiLove.emailable ) {
@@ -355,7 +349,7 @@
356350 * Fires AJAX request for previewing wikitext.
357351 */
358352 doPreview: function( wikitext ) {
359 - $( '#wlAddDetails .wlSpinner' ).fadeIn( 200 );
 353+ $( '#wlPreviewSpinner' ).fadeIn( 200 );
360354 $.ajax({
361355 url: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/api.php?',
362356 data: {
@@ -369,7 +363,7 @@
370364 type: 'POST',
371365 success: function( data ) {
372366 $.wikiLove.showPreview( data.parse.text['*'] );
373 - $( '#wlAddDetails .wlSpinner' ).fadeOut( 200 );
 367+ $( '#wlPreviewSpinner' ).fadeOut( 200 );
374368 }
375369 });
376370 },
@@ -398,7 +392,7 @@
399393 * Fires the final AJAX request and then redirects to the talk page where the content is added.
400394 */
401395 doSend: function( subject, wikitext, type, mail ) {
402 - $( '#wlPreview .wlSpinner' ).fadeIn( 200 );
 396+ $( '#wlSendSpinner' ).fadeIn( 200 );
403397
404398 var sendData = {
405399 'action': 'wikilove',
@@ -420,7 +414,7 @@
421415 dataType: 'json',
422416 type: 'POST',
423417 success: function( data ) {
424 - $( '#wlPreview .wlSpinner' ).fadeOut( 200 );
 418+ $( '#wlSendSpinner' ).fadeOut( 200 );
425419
426420 if ( typeof data.error !== 'undefined' ) {
427421 $( '#wlPreview' ).append( '<div class="wlError">' + mw.html.escape( data.error.info ) + '<div>' );
@@ -449,7 +443,7 @@
450444 showGallery: function() {
451445 $( '#wlGallery' ).html( '' );
452446 $.wikiLove.gallery = {};
453 - $( '#wlGallerySpinner .wlSpinner' ).fadeIn( 200 );
 447+ $( '#wlGallerySpinner' ).fadeIn( 200 );
454448
455449 $.each( $.wikiLove.currentTypeOrSubtype.gallery.imageList, function(index, value) {
456450
@@ -466,6 +460,8 @@
467461 dataType: 'json',
468462 type: 'POST',
469463 success: function( data ) {
 464+ $( '#wlGallerySpinner' ).fadeOut( 200 );
 465+
470466 if ( !data || !data.query || !data.query.pages ) {
471467 return;
472468 }
@@ -507,7 +503,7 @@
508504 makeGallery: function() {
509505 $( '#wlGallery' ).html( '' );
510506 $.wikiLove.gallery = {};
511 - $( '#wlGallerySpinner .wlSpinner' ).fadeIn( 200 );
 507+ $( '#wlGallerySpinner' ).fadeIn( 200 );
512508
513509 $.ajax({
514510 url: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/api.php',
@@ -582,7 +578,7 @@
583579 $( '#wlGalleryTitle' ).hide();
584580 }
585581
586 - $( '#wlGallerySpinner .wlSpinner' ).fadeOut( 200 );
 582+ $( '#wlGallerySpinner' ).fadeOut( 200 );
587583 }
588584 });
589585 },

Status & tagging log