X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/b22765f41bf0b2021b9beb9120ee0ac91fa89292..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-includes/js/autosave.js diff --git a/wp-includes/js/autosave.js b/wp-includes/js/autosave.js index b5a8c6c0..e88943d6 100644 --- a/wp-includes/js/autosave.js +++ b/wp-includes/js/autosave.js @@ -315,7 +315,8 @@ window.autosave = function() { var content, post_title, excerpt, $notice, postData = getSavedPostData(), cookie = wpCookies.get( 'wp-saving-post' ), - $newerAutosaveNotice = $( '#has-newer-autosave' ).parent( '.notice' ); + $newerAutosaveNotice = $( '#has-newer-autosave' ).parent( '.notice' ), + $headerEnd = $( '.wp-header-end' ); if ( cookie === post_id + '-saved' ) { wpCookies.remove( 'wp-saving-post' ); @@ -338,8 +339,16 @@ window.autosave = function() { return; } + /* + * If '.wp-header-end' is found, append the notices after it otherwise + * after the first h1 or h2 heading found within the main content. + */ + if ( ! $headerEnd.length ) { + $headerEnd = $( '.wrap h1, .wrap h2' ).first(); + } + $notice = $( '#local-storage-notice' ) - .insertAfter( $( '.wrap h1, .wrap h2' ).first() ) + .insertAfter( $headerEnd ) .addClass( 'notice-warning' ); if ( $newerAutosaveNotice.length ) {