Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.i18n.php |
— | — | @@ -14,5 +14,5 @@ |
15 | 15 | $messages['en'] = array( |
16 | 16 | 'editwarning' => 'Edit warning', |
17 | 17 | 'editwarning-desc' => 'Show a warning when a user tries to leave the edit form without saving', |
18 | | - 'editwarning-warning' => 'You have unsaved changes. Click OK to leave this page and abandon your changes, or Cancel to stay here and keep them.', |
| 18 | + 'editwarning-warning' => 'Leaving this page will cause you to loose any changes you have made.', |
19 | 19 | ); |
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.js |
— | — | @@ -3,18 +3,14 @@ |
4 | 4 | $( document ).ready( function() { |
5 | 5 | $( 'textarea#wpTextbox1, input#wpSummary' ) |
6 | 6 | .bind( |
7 | | - 'change select paste cut', |
| 7 | + 'change select paste cut keydown', |
8 | 8 | function () { |
9 | | - $( window ).bind( |
10 | | - 'beforeunload', |
11 | | - function( event ) { |
12 | | - if( !confirm( gM('editwarning-warning' ) ) ) { |
13 | | - event.preventDefault(); |
14 | | - } |
15 | | - event.stopImmediatePropagation(); |
| 9 | + if ( !( 'onbeforeunload' in window ) ) { |
| 10 | + window.onbeforeunload = function() { |
| 11 | + return gM('editwarning-warning' ); |
16 | 12 | } |
17 | | - ); |
| 13 | + } |
18 | 14 | } |
19 | 15 | ); |
20 | 16 | } |
21 | | -); |
| 17 | +); |
\ No newline at end of file |