Ticket #22491: 22491-4.patch
File 22491-4.patch, 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 changed; 437 438 $.each( getFieldsContent(), function(i, field) { 439 if ( field != initial[i] ) { 440 changed = true; 441 return; 442 } 443 }); 444 445 if ( changed ) 434 446 return '<?php _e('The changes you made will be lost if you navigate away from this page.'); ?>'; 435 447 }; 436 448 })(jQuery);