Docs: Improve JSDoc for language-chooser.js.

Props ireneyoast, manuelaugustin.
Fixes #43950.


git-svn-id: https://develop.svn.wordpress.org/trunk@43334 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Anton Timmermans 2018-06-07 15:07:31 +00:00
parent 8a9bf2a08b
commit a14e4f1c86

View File

@ -1,5 +1,8 @@
jQuery( function($) {
/*
* Set the correct translation to the continue button and show a spinner
* when downloading a language.
*/
var select = $( '#language' ),
submit = $( '#language-continue' );
@ -8,6 +11,10 @@ if ( ! $( 'body' ).hasClass( 'language-chooser' ) ) {
}
select.focus().on( 'change', function() {
/*
* When a language is selected, set matching translation to continue button
* and attach the language attribute.
*/
var option = select.children( 'option:selected' );
submit.attr({
value: option.data( 'continue' ),
@ -16,8 +23,7 @@ select.focus().on( 'change', function() {
});
$( 'form' ).submit( function() {
// Don't show a spinner for English and installed languages,
// as there is nothing to download.
// Show spinner for languages that need to be downloaded.
if ( ! select.children( 'option:selected' ).data( 'installed' ) ) {
$( this ).find( '.step .spinner' ).css( 'visibility', 'visible' );
}