File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 $appIconPreview = $ ( '#app-icon-preview' ) ,
1515 $hiddenDataField = $ ( '#site_icon_hidden_field' ) ,
1616 $removeButton = $ ( '#js-remove-site-icon' ) ,
17+ $adminBarSiteName = $ ( '#wp-admin-bar-site-name' ) ,
18+ $adminBarSiteNameLink = $adminBarSiteName . children ( 'a' ) . first ( ) ,
1719 frame ;
1820
1921 /**
194196 'url(' + attributes . url + ')'
195197 ) ;
196198
199+ // Replace the site icon in the admin bar.
200+ $adminBarSiteNameLink . children ( 'img.site-icon' ) . remove ( ) ;
201+ $ ( '<img />' )
202+ . attr ( {
203+ class : 'site-icon' ,
204+ src : attributes . url ,
205+ alt : '' ,
206+ width : 20 ,
207+ height : 20 ,
208+ } )
209+ . prependTo ( $adminBarSiteNameLink ) ;
210+ $adminBarSiteName . addClass ( 'has-site-icon' ) ;
211+
197212 // If the choose button is not in the update state, swap the classes.
198213 if ( $chooseButton . attr ( 'data-state' ) !== '1' ) {
199214 $chooseButton . attr ( {
225240 alt : '' ,
226241 } ) ;
227242
243+ // Remove the site icon from the admin bar.
244+ $adminBarSiteNameLink . children ( 'img.site-icon' ) . remove ( ) ;
245+ $adminBarSiteName . removeClass ( 'has-site-icon' ) ;
246+
228247 /**
229248 * Resets state to the button, for correct visual style and state.
230249 * Updates the text of the button.
Original file line number Diff line number Diff line change @@ -40,14 +40,15 @@ function options_general_add_js() {
4040 homeURL = ( <?php echo wp_json_encode ( get_home_url (), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
4141
4242 $( '#blogname' ).on( 'input', function() {
43- var title = $.trim( $( this ).val() ) || homeURL;
43+ var title = $.trim( $( this ).val() ) || homeURL,
44+ $siteIcon = $siteName.children();
4445
4546 // Truncate to 40 characters.
4647 if ( 40 < title.length ) {
4748 title = title.substring( 0, 40 ) + '\u2026';
4849 }
4950
50- $siteName.text( title );
51+ $siteName.text( title ).prepend( $siteIcon ) ;
5152 $siteIconPreview.text( title );
5253 });
5354
You can’t perform that action at this time.
0 commit comments