CoreFiles by mySites.guru
language-chooser.js36 lines, 873 bytes, from wordpress-5.2.21.zip
Raw History Compare with 5.2.20
md5
bc08d5fe72ba491b870cbb590ff93a88
sha1
61aff1e01c78d88197536a0e342501534bbf9362
sha256
fe7dd5f414bcaa4c4af942fbb5932ab860d73b3488de8f08290c4ce6049347df
/**
 * @output wp-admin/js/language-chooser.js
 */

jQuery( function($) {
/*
 * Set the correct translation to the continue button and show a spinner
 * when downloading a language.
 */
var select = $( '#language' ),
	submit = $( '#language-continue' );

if ( ! $( 'body' ).hasClass( 'language-chooser' ) ) {
	return;
}

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' ),
		lang: option.attr( 'lang' )
	});
});

$( 'form' ).submit( function() {
	// Show spinner for languages that need to be downloaded.
	if ( ! select.children( 'option:selected' ).data( 'installed' ) ) {
		$( this ).find( '.step .spinner' ).css( 'visibility', 'visible' );
	}
});

});

The same content is in 224 releases, WordPress 5.1-beta1 to 5.7-beta3. See them all, or every version of this file.