From 3b4e0b46e954f9490f571359ec35565a6f4ff0b9 Mon Sep 17 00:00:00 2001 From: John Du Hart Date: Wed, 24 Aug 2011 21:08:39 +0000 Subject: [PATCH] (bug 30499) Create jQuery replacements for injectSpinner and removeSpinner --- resources/Resources.php | 4 +++ resources/jquery/images/spinner.gif | Bin 0 -> 673 bytes resources/jquery/jquery.spinner.css | 8 ++++++ resources/jquery/jquery.spinner.js | 42 ++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 resources/jquery/images/spinner.gif create mode 100644 resources/jquery/jquery.spinner.css create mode 100644 resources/jquery/jquery.spinner.js diff --git a/resources/Resources.php b/resources/Resources.php index 898d241fd4..4d4b8f51ed 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -156,6 +156,10 @@ return array( 'jquery.qunit.completenessTest' => array( 'scripts' => 'resources/jquery/jquery.qunit.completenessTest.js', ), + 'jquery.spinner' => array( + 'scripts' => 'resources/jquery/jquery.spinner.js', + 'styles' => 'resources/jquery/jquery.spinner.css', + ), 'jquery.suggestions' => array( 'scripts' => 'resources/jquery/jquery.suggestions.js', 'styles' => 'resources/jquery/jquery.suggestions.css', diff --git a/resources/jquery/images/spinner.gif b/resources/jquery/images/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..d0bce1542342e912da81a2c260562df172f30d73 GIT binary patch literal 673 zcmZ?wbhEHb6krfw_{6~Q|Nnmm28Kh24mmkF0U1e2Nli^nlO|14{Lk&@8WQa67~pE8 zXTZz|lvDgC+Z`3#dv5h=E26FfcG1 zbL_hF&)}42ws10s6^G;;cE1^EoUR)U5A70}d2pLv!jVIT7j&Z~EblI3x0K*v_sV|m z0kj3v921Z^em#l`(k(o@H$3ZdDRc@9NidXDNbqrumReCGv$gd8+e8WW28HVqkJ_9i zH>s*<31KtHjANIPvi2#*6BEu%3Dak5O_t&NBI)H?V$TxT}#l{vOTn5naXTfF^&~Hhq+NX@#Ccc>y7T?;vjI&jdhsDsPJyAw*m0Qz>i}K7# zL9w50Ng{fT}A5JUe8lRK1h7_Y2;BWJDd=c6f&i?Wv5(5q?6|P zQw{>maxZP<537OA37Uk}7@%_$4o$EWe_Zl>&#id|lE-BpDC#+Fn|msJ%_2h{Hg1vP z#N8WAzfWasG}yq|xqE)DrWaOofX=z|?*pgc%{ig5vl!pqDlC|q&~Z0$&Rvsft&VO- z4MZj+%-+Vx%W}v;V76hyp=;+R;x+~t^Q%*xuFTQAF2})fSfTHDAs>sO!OBw`)&)o$ c0!CNZt))x~rAZP^^P&YOFfdqy5)K#u0POD40{{R3 literal 0 HcmV?d00001 diff --git a/resources/jquery/jquery.spinner.css b/resources/jquery/jquery.spinner.css new file mode 100644 index 0000000000..d3dd093d7a --- /dev/null +++ b/resources/jquery/jquery.spinner.css @@ -0,0 +1,8 @@ +.loading-spinner { + /* @embed */ + background: transparent url('images/spinner.gif'); + height: 16px; + width: 16px; + 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 new file mode 100644 index 0000000000..5536ecc877 --- /dev/null +++ b/resources/jquery/jquery.spinner.js @@ -0,0 +1,42 @@ +/** + * Functions to replace injectSpinner which makes img tags with spinners + */ +( function( $ ) { + +$.extend( { + /** + * Creates a spinner element + * + * @param id String id of the spinner + * @return jQuery spinner + */ + createSpinner: function( id ) { + return $( '
' ) + .attr({ + id: 'mw-spinner-' + id, + class: 'loading-spinner', + title: '...', + alt: '...' + }); + }, + + /** + * Removes a spinner element + * + * @param id + */ + removeSpinner: function( id ) { + $( '#mw-spinner-' + id ).remove(); + } +} ); + +/** + * Injects a spinner after the given objects + * + * @param id String id of the spinner + */ +$.fn.injectSpinner = function( id ) { + return this.after( $.createSpinner( id ) ); +}; + +} )( jQuery ); \ No newline at end of file -- 2.20.1