X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/febc815b2c9d85be5717da9e8d164bd2daa97e31..16e7b37c7914d753890c1a05a9335f3b43751eb8:/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 ) {