Revert "Special:Preferences: Use OOjs UI" and follow-ups
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.preferences.confirmClose.js
index fe127eb..45df37f 100644 (file)
@@ -4,11 +4,9 @@
  */
 ( function ( mw, $ ) {
        $( function () {
-               var allowCloseWindow, saveButton, restoreButton;
+               var allowCloseWindow;
 
-               // Check if all of the form values are unchanged.
-               // (This function could be changed to infuse and check OOUI widgets, but that would only make it
-               // slower and more complicated. It works fine to treat them as HTML elements.)
+               // Check if all of the form values are unchanged
                function isPrefsChanged() {
                        var inputs = $( '#mw-prefs-form :input[name]' ),
                                input, $input, inputType,
                        return false;
                }
 
-               saveButton = OO.ui.infuse( $( '#prefcontrol' ) );
-               restoreButton = OO.ui.infuse( $( '#mw-prefs-restoreprefs' ) );
-
                // Disable the button to save preferences unless preferences have changed
                // Check if preferences have been changed before JS has finished loading
                if ( !isPrefsChanged() ) {
-                       saveButton.setDisabled( true );
-                       $( '#preferences .oo-ui-fieldsetLayout' ).one( 'change keydown mousedown', function () {
-                               saveButton.setDisabled( false );
+                       $( '#prefcontrol' ).prop( 'disabled', true );
+                       $( '#preferences > fieldset' ).one( 'change keydown mousedown', function () {
+                               $( '#prefcontrol' ).prop( 'disabled', false );
                        } );
                }
 
                        namespace: 'prefswarning'
                } );
                $( '#mw-prefs-form' ).submit( $.proxy( allowCloseWindow, 'release' ) );
-               restoreButton.on( 'click', function () {
-                       allowCloseWindow.release();
-                       // The default behavior of events in OOUI is always prevented. Follow the link manually.
-                       // Note that middle-click etc. still works, as it doesn't emit a OOUI 'click' event.
-                       location.href = restoreButton.getHref();
-               } );
+               $( '#mw-prefs-restoreprefs' ).click( $.proxy( allowCloseWindow, 'release' ) );
        } );
 }( mediaWiki, jQuery ) );