9
|
1 |
/** |
|
2 |
* @output wp-admin/js/language-chooser.js |
|
3 |
*/ |
|
4 |
|
5
|
5 |
jQuery( function($) { |
9
|
6 |
/* |
|
7 |
* Set the correct translation to the continue button and show a spinner |
|
8 |
* when downloading a language. |
|
9 |
*/ |
5
|
10 |
var select = $( '#language' ), |
|
11 |
submit = $( '#language-continue' ); |
|
12 |
|
|
13 |
if ( ! $( 'body' ).hasClass( 'language-chooser' ) ) { |
|
14 |
return; |
|
15 |
} |
|
16 |
|
18
|
17 |
select.trigger( 'focus' ).on( 'change', function() { |
9
|
18 |
/* |
|
19 |
* When a language is selected, set matching translation to continue button |
|
20 |
* and attach the language attribute. |
|
21 |
*/ |
5
|
22 |
var option = select.children( 'option:selected' ); |
|
23 |
submit.attr({ |
|
24 |
value: option.data( 'continue' ), |
|
25 |
lang: option.attr( 'lang' ) |
|
26 |
}); |
|
27 |
}); |
|
28 |
|
18
|
29 |
$( 'form' ).on( 'submit', function() { |
9
|
30 |
// Show spinner for languages that need to be downloaded. |
5
|
31 |
if ( ! select.children( 'option:selected' ).data( 'installed' ) ) { |
|
32 |
$( this ).find( '.step .spinner' ).css( 'visibility', 'visible' ); |
|
33 |
} |
|
34 |
}); |
|
35 |
|
|
36 |
}); |