Merge "(bug 260) Handle <pre> overflow automatically with a scroll bar"
[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 } );
21 },
22
23 /**
24 * Removes a spinner element.
25 *
26 * @param id {String}
27 * @return {jQuery} spinner
28 */
29 removeSpinner: function ( id ) {
30 return $( '#mw-spinner-' + id ).remove();
31 }
32 } );
33
34 /**
35 * Injects a spinner after the elements in the jQuery collection.
36 *
37 * @param id String id of the spinner
38 * @return {jQuery}
39 */
40 $.fn.injectSpinner = function ( id ) {
41 return this.after( $.createSpinner( id ) );
42 };
43
44 }( jQuery ) );