Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.js |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | /* JavaScript for EditWarning extension */ |
3 | 3 | |
4 | 4 | $( document ).ready( function() { |
5 | | - // Checks if the skin is not vector |
| 5 | + // Only use this function in conjuction with the Vector skin |
6 | 6 | if( skin != 'vector' ) |
7 | | - // Exits |
8 | 7 | return; |
9 | | - // Gets the original values of some form elements |
| 8 | + |
| 9 | + // Get the original values of some form elements |
10 | 10 | $( '#wpTextbox1, #wpSummary' ).each( function() { |
11 | 11 | $(this).data( 'origtext', $(this).val() ); |
12 | 12 | }); |
— | — | @@ -13,29 +13,29 @@ |
14 | 14 | fallbackWindowOnBeforeUnload = window.onbeforeunload; |
15 | 15 | window.onbeforeunload = function() { |
16 | 16 | var fallbackResult = null; |
17 | | - // Checks if someone already set on onbeforunload hook |
| 17 | + // Check if someone already set on onbeforunload hook |
18 | 18 | if ( fallbackWindowOnBeforeUnload ) { |
19 | | - // Gets the result of their onbeforeunload hook |
| 19 | + // Get the result of their onbeforeunload hook |
20 | 20 | fallbackResult = fallbackWindowOnBeforeUnload(); |
21 | 21 | } |
22 | | - // Checks if their onbeforeunload hook returned something |
| 22 | + // Check if their onbeforeunload hook returned something |
23 | 23 | if ( fallbackResult !== null ) { |
24 | | - // Exits here, returning their message |
| 24 | + // Exit here, returning their message |
25 | 25 | return fallbackResult; |
26 | 26 | } |
27 | | - // Checks if the current values of some form elements are the same as |
| 27 | + // Check if the current values of some form elements are the same as |
28 | 28 | // the original values |
29 | 29 | if( |
30 | 30 | $( '#wpTextbox1' ).data( 'origtext' ) != $( '#wpTextbox1' ).val() || |
31 | 31 | $( '#wpSummary' ).data( 'origtext' ) != $( '#wpSummary' ).val() |
32 | 32 | ) { |
33 | | - // Returns our message |
| 33 | + // Return our message |
34 | 34 | return gM( 'editwarning-warning' ); |
35 | 35 | } |
36 | 36 | } |
37 | | - // Adds form submission handler |
| 37 | + // Add form submission handler |
38 | 38 | $( 'form' ).submit( function() { |
39 | | - // Restores whatever previous onbeforeload hook existed |
| 39 | + // Restore whatever previous onbeforeload hook existed |
40 | 40 | window.onbeforeunload = fallbackWindowOnBeforeUnload; |
41 | 41 | }); |
42 | 42 | }); |