Henning Snater has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/188040

Change subject: SnakTypeSelector: Removed unnecessary code
......................................................................

SnakTypeSelector: Removed unnecessary code

Change-Id: I0d92bf0889b04de32e24e0a13b2b1f505f8dc292
---
M lib/resources/jquery.wikibase/snakview/snakview.SnakTypeSelector.js
1 file changed, 16 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/40/188040/1

diff --git 
a/lib/resources/jquery.wikibase/snakview/snakview.SnakTypeSelector.js 
b/lib/resources/jquery.wikibase/snakview/snakview.SnakTypeSelector.js
index e17787b..ee326fe 100644
--- a/lib/resources/jquery.wikibase/snakview/snakview.SnakTypeSelector.js
+++ b/lib/resources/jquery.wikibase/snakview/snakview.SnakTypeSelector.js
@@ -59,19 +59,15 @@
 
                        this._menu = $menu.data( 'menu' );
 
+                       this._hoverable( this.element );
+
                        // TODO: add a title message
                        this.element
                        .addClass( 'ui-state-default ' + this.widgetBaseClass )
-                       .on( 'mouseover.' + widgetName, function( event ) {
-                               self.element.addClass( 'ui-state-hover' );
-                       } )
-                       .on( 'mouseout.' + widgetName, function( event ) {
-                               self.element.removeClass( 'ui-state-hover' );
-                       } )
                        .on( 'click.' + widgetName, function( event ) {
                                // don't show menu if selector is disabled!
                                // otherwise, simply toggle menu's visibility
-                               if( self.isDisabled() || $menu.is( ':visible' ) 
) {
+                               if( self.options.disabled || $menu.is( 
':visible' ) ) {
                                        $menu.hide();
                                        return;
                                }
@@ -127,7 +123,7 @@
 
                        this._$icon.remove();
 
-                       this.element.removeClass( 'ui-state-default 
ui-state-hover ' + this.widgetBaseClass );
+                       this.element.removeClass( 'ui-state-default ' + 
this.widgetBaseClass );
 
                        // remove event listeners responsible for closing this 
instance's menu:
                        this._unbindGlobalListenersFn();
@@ -136,28 +132,19 @@
                },
 
                /**
-                * @see jQuery.Widget.disable
+                * @see jQuery.Widget._setOption
+                * @protected
+                *
+                * @param {string} key
+                * @param {*} value
+                * @return {jQuery.Widget}
                 */
-               disable: function() {
-                       this._menu.element.hide();
-                       this.element.removeClass( 'ui-state-active 
ui-state-hover' );
-                       this.element.addClass( 'ui-state-disabled' );
-                       return PARENT.prototype.disable.call( this );
-               },
-
-               /**
-                * @see jQuery.Widget.enable
-                */
-               enable: function() {
-                       this.element.removeClass( 'ui-state-disabled' );
-                       return PARENT.prototype.enable.call( this );
-               },
-
-               /**
-                * Returns whether the widget is currently disabled.
-                */
-               isDisabled: function() {
-                       return this.option( 'disabled' );
+               _setOption: function( key, value ) {
+                       if( key === 'disabled' ) {
+                               this._menu.element.hide();
+                               this.element.removeClass( 'ui-state-active' );
+                       }
+                       return PARENT.prototype._setOption.apply( this, 
arguments );
                },
 
                /**

-- 
To view, visit https://gerrit.wikimedia.org/r/188040
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d92bf0889b04de32e24e0a13b2b1f505f8dc292
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to