From: Krinkle Date: Wed, 24 Aug 2011 21:37:59 +0000 (+0000) Subject: jquery.spinner: Fix small issues X-Git-Tag: 1.31.0-rc.0~28085 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=1473e9838247c982afbeeb98e0cf5e26243db260;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/resources/jquery/images/spinner.gif b/resources/jquery/images/spinner.gif index d0bce15423..37d3a43d78 100644 Binary files a/resources/jquery/images/spinner.gif and b/resources/jquery/images/spinner.gif differ 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 );