No AYS or autosave for attachments on post.php. Reverts part of [22725]. fixes #22491.

git-svn-id: http://core.svn.wordpress.org/trunk@22858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-27 02:02:32 +00:00
parent 3fd9321c91
commit 902314ad3c
2 changed files with 1 additions and 28 deletions

View File

@ -434,29 +434,3 @@ if ( post_type_supports( $post_type, 'comments' ) )
try{document.post.title.focus();}catch(e){}
</script>
<?php endif; ?>
<?php if ( 'attachment' == $post_type ) { ?>
<script type="text/javascript">
(function($){
function getFieldsContent() {
return [ $('#title').val() || '',
$('#attachment_caption').val() || '',
$('#attachment_alt').val() || '',
$('#attachment_content').val() || '',
$('#post_name').val() || '' ];
}
var initial = getFieldsContent();
window.onbeforeunload = function() {
var i, changed, current = getFieldsContent();
for ( var i = 0; i < initial.length; i++ ) {
if ( changed = ( initial[i] !== current[i]) )
break;
}
if ( changed )
return '<?php _e('The changes you made will be lost if you navigate away from this page.'); ?>';
};
})(jQuery);
</script>
<?php } ?>

View File

@ -46,8 +46,7 @@ if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_
if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
if ( 'attachment' !== $post_type )
wp_enqueue_script('autosave');
wp_enqueue_script( 'autosave' );
// Show post form.
$post = get_default_post_to_edit( $post_type, true );