From 1473e9838247c982afbeeb98e0cf5e26243db260 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Wed, 24 Aug 2011 21:37:59 +0000 Subject: [PATCH] jquery.spinner: Fix small issues (Follows-up r95445) * Using the same spinner as before, preserving svn history (20px vs. 16px) * Adding a line-break at the end of file and changing indentation per our conventions * Adjusting doc to reflect the plugin itself instead of what it replaces. * Using shorthand utility in jQuery (no / and using the attr-object as second argument) * Adding @return comment to $.fn.injectSpinner * Adding return statement to $.removerSpinner (returning a jQuery object of the element). Could be useful, but better than not having a return value at all. JSHint: * Adding parentheses around the class object property, otherwise it may be interpreted as a class operator which breaks the object. --- resources/jquery/images/spinner.gif | Bin 673 -> 4648 bytes resources/jquery/jquery.spinner.css | 8 +++---- resources/jquery/jquery.spinner.js | 35 +++++++++++++++------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/resources/jquery/images/spinner.gif b/resources/jquery/images/spinner.gif index d0bce1542342e912da81a2c260562df172f30d73..37d3a43d78603d1869637840c7bf5f455afff010 100644 GIT binary patch literal 4648 zcmd6q`BT&R8OH;`1j3bIxCw!9ciQPRe?TUAecsRO zc|V852YEqhcmy8t9SdP(WMph?j6@<$Oia*dw3(S1iA17MC_X+u0RaIA4jhPxh=`1g zjE;_ui;GK0NH}`*s7xly$jB%tC@3l_Dl03isHjjXm34J>_4V}{ji$Z5y{oIMudi=x zY;1CJa$#X%adGk5wQJX}U%zqV#?6~IZ{NPXyu7@!vU2zC-PP6Ad-v|$zkh#yeSKqN z!-~;*}R` zEe^7x>(Ovy9Qdh~q*4Z071UL~#8L@=|75M$Q6q)3>}>St9i-7Tz1D7sc8W|ZG9UXo1?Ut67-u8U&^LD7#<-Q_bQ;J%YPGS4t zm5q@liRYPxCUR`8-im0G_O}H@#e~*!p~#G>nsi@h>rSe1X@|$In28B4?*6G&ejE{z z;E~Gqt2-s;(7Za^Iy?RS^(cEB~Dag z`jt+pQOPLgJgo&MqL1m|6 zYo*+5F~_U>Shn7a$?VhVs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^P&YOFfdqy5)K#u0POD40{{R3 diff --git a/resources/jquery/jquery.spinner.css b/resources/jquery/jquery.spinner.css index d3dd093d7a..4f33bb4fa2 100644 --- a/resources/jquery/jquery.spinner.css +++ b/resources/jquery/jquery.spinner.css @@ -1,8 +1,8 @@ -.loading-spinner { +.mw-spinner { /* @embed */ - background: transparent url('images/spinner.gif'); - height: 16px; - width: 16px; + background: transparent url(images/spinner.gif); + height: 20px; + width: 20px; display: inline-block; vertical-align: middle; } \ No newline at end of file diff --git a/resources/jquery/jquery.spinner.js b/resources/jquery/jquery.spinner.js index 5536ecc877..01fa8de07c 100644 --- a/resources/jquery/jquery.spinner.js +++ b/resources/jquery/jquery.spinner.js @@ -1,42 +1,45 @@ /** - * Functions to replace injectSpinner which makes img tags with spinners + * jQuery spinner + * + * Simple jQuery plugin to create, inject and remove spinners. */ ( function( $ ) { $.extend( { /** - * Creates a spinner element + * Creates a spinner element. * - * @param id String id of the spinner - * @return jQuery spinner + * @param id {String} id of the spinner + * @return {jQuery} spinner */ createSpinner: function( id ) { - return $( '
' ) - .attr({ - id: 'mw-spinner-' + id, - class: 'loading-spinner', - title: '...', - alt: '...' - }); + return $( '
' ).attr( { + id: 'mw-spinner-' + id, + 'class': 'mw-spinner', + title: '...', + alt: '...' + } ); }, /** - * Removes a spinner element + * Removes a spinner element. * - * @param id + * @param id {String} + * @return {jQuery} spinner */ removeSpinner: function( id ) { - $( '#mw-spinner-' + id ).remove(); + return $( '#mw-spinner-' + id ).remove(); } } ); /** - * Injects a spinner after the given objects + * Injects a spinner after the elements in the jQuery collection. * * @param id String id of the spinner + * @return {jQuery} */ $.fn.injectSpinner = function( id ) { return this.after( $.createSpinner( id ) ); }; -} )( jQuery ); \ No newline at end of file +} )( jQuery ); -- 2.20.1