From: Prateek Saxena Date: Mon, 2 Apr 2018 05:08:22 +0000 (+0530) Subject: Special:Preference: Check for changes before enabling Save button X-Git-Tag: 1.31.0-rc.0~204^2 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=5ba12928c8f69800cbfccae770cc68bc11dce92c;p=lhc%2Fweb%2Fwiklou.git Special:Preference: Check for changes before enabling Save button * Changing mousedown and keydown to mouseup and keyup …so that isPrefsChanged gets the updated value and can return something useful * Changing one to on …so that if a value is updated and then changed back to the original, the button can be disabled again Bug: T180538 Change-Id: I7146f8d3166e09e13b26321e7a6a7c8ac74f9aaf --- diff --git a/resources/src/mediawiki.special/mediawiki.special.preferences.confirmClose.js b/resources/src/mediawiki.special/mediawiki.special.preferences.confirmClose.js index 45df37ffd2..1b8d6d93aa 100644 --- a/resources/src/mediawiki.special/mediawiki.special.preferences.confirmClose.js +++ b/resources/src/mediawiki.special/mediawiki.special.preferences.confirmClose.js @@ -43,12 +43,10 @@ // 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.