No AYS or autosave for attachments on post.php. Reverts part of [22725]. fixes #22491.
git-svn-id: https://develop.svn.wordpress.org/trunk@22858 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
afb0b8627b
commit
a2535a19b9
@ -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 } ?>
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user