[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/js/ -> language-chooser.js (source)

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


Generated : Sun Dec 22 08:20:01 2024 Cross-referenced by PHPXref