From: Geoffrey Mon Date: Fri, 27 Nov 2015 16:53:39 +0000 (-0500) Subject: Disable Preferences save button if settings have not changed X-Git-Tag: 1.31.0-rc.0~8554 X-Git-Url: http://git.cyclocoop.org//%22%22._DIR_PLUGIN_FULLCALENDAR.%22prive/themes/spip/images/event_edit.png/%22?a=commitdiff_plain;h=e0b421aec323b196a9c2ca1c050f09d93177a342;p=lhc%2Fweb%2Fwiklou.git Disable Preferences save button if settings have not changed Disable the Special:Preferences 'Save' button if no settings have been changed. This prevents unnecessary saving when you can't remember if you saved the settings or not. Uses new check for preference change to prevent disabling the button if the user makes preferences changes before JS is done loading. Bug: T89457 Change-Id: I1064c5e76a3c1f856b9b9288baaf39cc102edf8a --- diff --git a/resources/src/mediawiki.special/mediawiki.special.preferences.js b/resources/src/mediawiki.special/mediawiki.special.preferences.js index 7f3de3899d..c2b9a4ff1d 100644 --- a/resources/src/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/src/mediawiki.special/mediawiki.special.preferences.js @@ -295,6 +295,15 @@ return false; } + // 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 ); + } ); + } + // Set up a message to notify users if they try to leave the page without // saving. allowCloseWindow = mw.confirmCloseWindow( {