mw.special.preferences.timezone: Remove some very old unnecessary code
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 25 Sep 2017 18:34:30 +0000 (20:34 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Mon, 25 Sep 2017 18:34:51 +0000 (20:34 +0200)
The first two removed blocks date to the pre-HTMLForm versions of the
preferences form (rSVN44915 / c672ce603272d5206f0967f70f2474b4c09ce43a),
where the dual dropdown/textbox field was implemented specially for
this form. Its behavior currently is handled by HTMLSelectOrOtherField
and selectorother.js, and this code is entirely unnecessary.

The third removed block was added as a workaround for an issue caused
by the second block, in e8d94f433c43982003fb0d008e1fc8ee04ed7744.
Looks like we didn't realize at the time that we can just delete the
buggy line.

This fixes a minor issue where no warning would be displayed when
exiting the preferences page without saving the changes after the user
changed the "Time zone" field from "Other" to "Fill in from the
browser" and the guessed value was different from the saved one.

Change-Id: I9b5317111aaf7f6039d476b263ee9e54c4b4cf52

resources/src/mediawiki.special/mediawiki.special.preferences.timezone.js

index 58a5f84..03656ee 100644 (file)
                                        minuteDiff = -( new Date().getTimezoneOffset() );
                                        $tzTextbox.val( minutesToHours( minuteDiff ) );
                                        $tzSelect.val( 'other' );
-                                       $tzTextbox.prop( 'disabled', false );
                                } else {
                                        // Grab data from the $tzSelect value
                                        minuteDiff = parseInt( type.split( '|' )[ 1 ], 10 ) || 0;
-                                       $tzTextbox.val( minutesToHours( minuteDiff ) );
                                }
-
-                               // Set defaultValue prop on the generated box so we don't trigger the
-                               // unsaved preferences check
-                               $tzTextbox.prop( 'defaultValue', $tzTextbox.val() );
                        }
 
                        // Determine local time from server time and minutes difference, for display.