mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-16 15:46:04 +01:00
b65d83b872
This includes many minor adjustments to a wide array of core files to replace shorthands with full declarations. Follow-up to [50001], [50270], [50367]. Props Clorith, hellofromTonya, peterwilsoncc, adamsilverstein, aristath. See #51812. Built from https://develop.svn.wordpress.org/trunk@50420 git-svn-id: http://core.svn.wordpress.org/trunk@50031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
37 lines
890 B
JavaScript
37 lines
890 B
JavaScript
/**
|
|
* @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.trigger( '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' ).on( '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' );
|
|
}
|
|
});
|
|
|
|
});
|