4 * Simple jQuery plugin to create, inject and remove spinners.
10 * Creates a spinner element.
12 * @param id {String} id of the spinner
13 * @return {jQuery} spinner
15 createSpinner: function( id ) {
16 return $( '<div>' ).attr( {
17 id: 'mw-spinner-' + id,
18 'class': 'mw-spinner',
24 * Removes a spinner element.
27 * @return {jQuery} spinner
29 removeSpinner: function( id ) {
30 return $( '#mw-spinner-' + id ).remove();
35 * Injects a spinner after the elements in the jQuery collection.
37 * @param id String id of the spinner
40 $.fn.injectSpinner = function( id ) {
41 return this.after( $.createSpinner( id ) );