Merge "Special:Preference: Check for changes before enabling Save button"
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.preferences.confirmClose.js
index 45df37f..1b8d6d9 100644 (file)
 
                // Disable the button to save preferences unless preferences have changed
                // Check if preferences have been changed before JS has finished loading
-               if ( !isPrefsChanged() ) {
-                       $( '#prefcontrol' ).prop( 'disabled', true );
-                       $( '#preferences > fieldset' ).one( 'change keydown mousedown', function () {
-                               $( '#prefcontrol' ).prop( 'disabled', false );
-                       } );
-               }
+               $( '#prefcontrol' ).prop( 'disabled', !isPrefsChanged() );
+               $( '#preferences > fieldset' ).on( 'change keyup mouseup', function () {
+                       $( '#prefcontrol' ).prop( 'disabled', !isPrefsChanged() );
+               } );
 
                // Set up a message to notify users if they try to leave the page without
                // saving.