5536ecc877b682c13e745ad28ed2dca5bc25e942
[lhc/web/wiklou.git] / resources / jquery / jquery.spinner.js
1 /**
2 * Functions to replace injectSpinner which makes img tags with spinners
3 */
4 ( function( $ ) {
5
6 $.extend( {
7 /**
8 * Creates a spinner element
9 *
10 * @param id String id of the spinner
11 * @return jQuery spinner
12 */
13 createSpinner: function( id ) {
14 return $( '<div/>' )
15 .attr({
16 id: 'mw-spinner-' + id,
17 class: 'loading-spinner',
18 title: '...',
19 alt: '...'
20 });
21 },
22
23 /**
24 * Removes a spinner element
25 *
26 * @param id
27 */
28 removeSpinner: function( id ) {
29 $( '#mw-spinner-' + id ).remove();
30 }
31 } );
32
33 /**
34 * Injects a spinner after the given objects
35 *
36 * @param id String id of the spinner
37 */
38 $.fn.injectSpinner = function( id ) {
39 return this.after( $.createSpinner( id ) );
40 };
41
42 } )( jQuery );