From: Geoffrey Mon Date: Sun, 7 Jun 2015 01:03:37 +0000 (-0400) Subject: Disable Preferences save button before setting change X-Git-Tag: 1.31.0-rc.0~11082^2 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=b5d46d22b5e49b76fb51fdd7e666c69efb4e1afe;p=lhc%2Fweb%2Fwiklou.git Disable Preferences save button before setting change Disable the Special:Preferences 'Save' button if no settings have been changed (uses keydown and mousedown events as an alternative to change event, so is not perfect) This prevents unnecessary saving when you can't remember if you saved the settings or not. Bug: T89457 Change-Id: I7c2e11302099280c561e435425b23afb9fb760b5 --- diff --git a/resources/src/mediawiki.special/mediawiki.special.preferences.js b/resources/src/mediawiki.special/mediawiki.special.preferences.js index fa9e45275a..a385ad31af 100644 --- a/resources/src/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/src/mediawiki.special/mediawiki.special.preferences.js @@ -110,6 +110,12 @@ jQuery( function ( $ ) { $preftoc.append( $li ); } ); + // Disable the button to save preferences unless preferences have changed + $( '#prefcontrol' ).prop( 'disabled', true ); + $( '.prefsection' ).one( 'change keydown mousedown', function () { + $( '#prefcontrol' ).prop( 'disabled', false); + } ); + // Enable keyboard users to use left and right keys to switch tabs $preftoc.on( 'keydown', function ( event ) { var keyLeft = 37,