Changeset 22858 for trunk/wp-admin/edit-form-advanced.php
- Timestamp:
- 11/27/2012 02:02:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r22854 r22858 435 435 </script> 436 436 <?php endif; ?> 437 438 <?php if ( 'attachment' == $post_type ) { ?>439 <script type="text/javascript">440 (function($){441 function getFieldsContent() {442 return [ $('#title').val() || '',443 $('#attachment_caption').val() || '',444 $('#attachment_alt').val() || '',445 $('#attachment_content').val() || '',446 $('#post_name').val() || '' ];447 }448 449 var initial = getFieldsContent();450 451 window.onbeforeunload = function() {452 var i, changed, current = getFieldsContent();453 for ( var i = 0; i < initial.length; i++ ) {454 if ( changed = ( initial[i] !== current[i]) )455 break;456 }457 if ( changed )458 return '<?php _e('The changes you made will be lost if you navigate away from this page.'); ?>';459 };460 })(jQuery);461 </script>462 <?php } ?>
Note: See TracChangeset
for help on using the changeset viewer.