Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | /* Configuration */ |
20 | 20 | |
21 | 21 | // Bump the version number every time you change any of the .css/.js files |
22 | | -$wgEditWarningStyleVersion = 2; |
| 22 | +$wgEditWarningStyleVersion = 3; |
23 | 23 | |
24 | 24 | /* Setup */ |
25 | 25 | |
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.js |
— | — | @@ -1,18 +1,16 @@ |
2 | 2 | /* JavaScript for EditWarning extension */ |
3 | 3 | |
4 | 4 | $( document ).ready( function() { |
5 | | - $( 'textarea#wpTextbox1, input#wpSummary' ) |
6 | | - .bind( |
7 | | - 'change paste cut keydown', |
8 | | - function () { |
9 | | - if ( !( 'onbeforeunload' in window ) ) { |
10 | | - window.onbeforeunload = function() { |
11 | | - return gM('editwarning-warning' ); |
12 | | - } |
13 | | - } |
14 | | - } |
15 | | - ); |
| 5 | + $( '#wpTextbox1, #wpSummary' ).each( function() { |
| 6 | + $(this).data( 'origtext', $(this).val() ); |
| 7 | + }); |
| 8 | + if( !( 'onbeforeunload' in window ) ) |
| 9 | + window.onbeforeunload = function() { |
| 10 | + if( $( '#wpTextbox1' ).data( 'origtext' ) != $( '#wpTextbox1' ).val() || |
| 11 | + $( '#wpSummary' ).data( 'origtext' ) != $( '#wpSummary' ).val() ) |
| 12 | + return gM( 'editwarning-warning' ); |
| 13 | + }; |
16 | 14 | $( 'form' ).submit( function() { |
17 | | - window.onbeforeunload = function () {}; |
| 15 | + window.onbeforeunload = function() {}; |
18 | 16 | }); |
19 | | -}); |
\ No newline at end of file |
| 17 | +}); |