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

props avryl.
see #28682.

git-svn-id: https://develop.svn.wordpress.org/trunk@30597 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-11-28 08:11:52 +00:00
parent 980ca1471b
commit 03cb69d8e2

View File

@ -30,10 +30,11 @@ function options_general_add_js() {
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first();
var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
$( '#blogname' ).on( 'input', function() {
var title = $( this ).val();
var title = $.trim( $( this ).val() ) || homeURL;
// Truncate to 40 characters.
if ( 40 < title.length ) {