~canonical-sysadmins/wordpress/4.7.2

« back to all changes in this revision

Viewing changes to wp-admin/js/language-chooser.js

  • Committer: Jacek Nykis
  • Date: 2015-01-05 16:17:05 UTC
  • Revision ID: jacek.nykis@canonical.com-20150105161705-w544l1h5mcg7u4w9
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
jQuery( function($) {
 
2
 
 
3
var select = $( '#language' ),
 
4
        submit = $( '#language-continue' );
 
5
 
 
6
if ( ! $( 'body' ).hasClass( 'language-chooser' ) ) {
 
7
        return;
 
8
}
 
9
 
 
10
select.focus().on( 'change', function() {
 
11
        var option = select.children( 'option:selected' );
 
12
        submit.attr({
 
13
                value: option.data( 'continue' ),
 
14
                lang: option.attr( 'lang' )
 
15
        });
 
16
});
 
17
 
 
18
$( 'form' ).submit( function() {
 
19
        // Don't show a spinner for English and installed languages,
 
20
        // as there is nothing to download.
 
21
        if ( ! select.children( 'option:selected' ).data( 'installed' ) ) {
 
22
                $( this ).find( '.step .spinner' ).css( 'visibility', 'visible' );
 
23
        }
 
24
});
 
25
 
 
26
});