Changeset 34022 for trunk/src/wp-admin/options-general.php
- Timestamp:
- 09/10/2015 09:44:29 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/options-general.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/options-general.php
r33774 r34022 21 21 $timezone_format = _x('Y-m-d H:i:s', 'timezone date format'); 22 22 23 /**24 * Display JavaScript on the page.25 *26 * @since 3.5.027 */28 function options_general_add_js() {29 ?>30 <script type="text/javascript">31 jQuery(document).ready(function($){32 var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),33 homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );34 35 $( '#blogname' ).on( 'input', function() {36 var title = $.trim( $( this ).val() ) || homeURL;37 38 // Truncate to 40 characters.39 if ( 40 < title.length ) {40 title = title.substring( 0, 40 ) + '\u2026';41 }42 43 $siteName.text( title );44 });45 46 $("input[name='date_format']").click(function(){47 if ( "date_format_custom_radio" != $(this).attr("id") )48 $( "input[name='date_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).text() );49 });50 $("input[name='date_format_custom']").focus(function(){51 $( '#date_format_custom_radio' ).prop( 'checked', true );52 });53 54 $("input[name='time_format']").click(function(){55 if ( "time_format_custom_radio" != $(this).attr("id") )56 $( "input[name='time_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).text() );57 });58 $("input[name='time_format_custom']").focus(function(){59 $( '#time_format_custom_radio' ).prop( 'checked', true );60 });61 $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {62 var format = $(this);63 format.siblings( '.spinner' ).addClass( 'is-active' );64 $.post(ajaxurl, {65 action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format',66 date : format.val()67 }, function(d) { format.siblings( '.spinner' ).removeClass( 'is-active' ); format.siblings('.example').text(d); } );68 });69 70 var languageSelect = $( '#WPLANG' );71 $( 'form' ).submit( function() {72 // Don't show a spinner for English and installed languages,73 // as there is nothing to download.74 if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {75 $( '#submit', this ).after( '<span class="spinner language-install-spinner" />' );76 }77 });78 });79 </script>80 <?php81 }82 23 add_action('admin_head', 'options_general_add_js'); 83 24
Note: See TracChangeset
for help on using the changeset viewer.