Live-update site title in toolbar when changing the corresponding field in General Settings.

props celloexpressions, avryl.
fixes #28682.

git-svn-id: https://develop.svn.wordpress.org/trunk@29963 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-10-19 09:12:11 +00:00
parent 5ab446aab7
commit 512ea93ae4

View File

@ -27,6 +27,19 @@ function options_general_add_js() {
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first();
$( '#blogname' ).on( 'input', function() {
var title = $( this ).val();
// Truncate to 40 characters.
if ( 40 < title.length ) {
title = title.substring( 0, 40 ) + '\u2026';
}
$siteName.text( title );
});
$("input[name='date_format']").click(function(){
if ( "date_format_custom_radio" != $(this).attr("id") )
$("input[name='date_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );