Ticket #22491: 22491.2.diff
File 22491.2.diff, 1.1 KB (added by , 12 years ago) |
---|
-
wp-admin/edit-form-advanced.php
423 423 <script type="text/javascript"> 424 424 (function($){ 425 425 function getFieldsContent() { 426 return ($('#title').val() || '') + ($('#attachment_caption').val() || '') + 427 ($('#attachment_alt').val() || '') + ($('#attachment_content').val() || '') + ($('#post_name').val() || ''); 426 return [ $('#title').val() || '', 427 $('#attachment_caption').val() || '', 428 $('#attachment_alt').val() || '', 429 $('#attachment_content').val() || '', 430 $('#post_name').val() || '' ]; 428 431 } 429 432 430 433 var initial = getFieldsContent(); 431 434 432 435 window.onbeforeunload = function() { 433 if ( initial != getFieldsContent() ) 436 var i, changed, current = getFieldsContent(); 437 for ( var i = 0; i < initial.length; i++ ) { 438 if ( changed = ( inital[i] !== current[i]) ) 439 break; 440 } 441 if ( changed ) 434 442 return '<?php _e('The changes you made will be lost if you navigate away from this page.'); ?>'; 435 443 }; 436 444 })(jQuery);