jquery.spinner: Fix small issues
[lhc/web/wiklou.git] / resources / jquery / jquery.spinner.js
1 /**
2 * jQuery spinner
3 *
4 * Simple jQuery plugin to create, inject and remove spinners.
5 */
6 ( function( $ ) {
7
8 $.extend( {
9 /**
10 * Creates a spinner element.
11 *
12 * @param id {String} id of the spinner
13 * @return {jQuery} spinner
14 */
15 createSpinner: function( id ) {
16 return $( '<div>' ).attr( {
17 id: 'mw-spinner-' + id,
18 'class': 'mw-spinner',
19 title: '...',
20 alt: '...'
21 } );
22 },
23
24 /**
25 * Removes a spinner element.
26 *
27 * @param id {String}
28 * @return {jQuery} spinner
29 */
30 removeSpinner: function( id ) {
31 return $( '#mw-spinner-' + id ).remove();
32 }
33 } );
34
35 /**
36 * Injects a spinner after the elements in the jQuery collection.
37 *
38 * @param id String id of the spinner
39 * @return {jQuery}
40 */
41 $.fn.injectSpinner = function( id ) {
42 return this.after( $.createSpinner( id ) );
43 };
44
45 } )( jQuery );