Make WordPress Core


Ignore:
Timestamp:
11/28/2014 08:11:52 AM (10 years ago)
Author:
SergeyBiryukov
Message:

When live-updating site title in toolbar, fall back to the site url if the title is empty.

props avryl.
see #28682.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options-general.php

    r30335 r30597  
    3131//<![CDATA[
    3232    jQuery(document).ready(function($){
    33         var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first();
     33        var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
     34            homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
    3435
    3536        $( '#blogname' ).on( 'input', function() {
    36             var title = $( this ).val();
     37            var title = $.trim( $( this ).val() ) || homeURL;
    3738
    3839            // Truncate to 40 characters.
Note: See TracChangeset for help on using the changeset viewer.