]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/autosave.js
WordPress 4.7
[autoinstalls/wordpress.git] / wp-includes / js / autosave.js
index b5a8c6c0e66f7a8fa7ff25a350b23aaa3f82df49..e88943d6d482dbc76f1278cec552c2ca5c1caafb 100644 (file)
@@ -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 ) {