Merge "Fix i18n message tog-watchlistunwatchlinks"
[lhc/web/wiklou.git] / resources / lib / oojs-ui / oojs-ui-toolbars.js
index d1688ee..937af9d 100644 (file)
@@ -1,12 +1,12 @@
 /*!
- * OOUI v0.25.1
+ * OOUI v0.26.2
  * https://www.mediawiki.org/wiki/OOUI
  *
  * Copyright 2011–2018 OOUI Team and other contributors.
  * Released under the MIT license
  * http://oojs.mit-license.org
  *
- * Date: 2018-01-17T01:47:15Z
+ * Date: 2018-04-04T17:22:44Z
  */
 ( function ( OO ) {
 
@@ -402,7 +402,7 @@ OO.ui.Toolbar.prototype.onPointerDown = function ( e ) {
 OO.ui.Toolbar.prototype.onWindowResize = function () {
        this.$element.toggleClass(
                'oo-ui-toolbar-narrow',
-               this.$bar.width() <= this.getNarrowThreshold()
+               this.$bar[ 0 ].clientWidth <= this.getNarrowThreshold()
        );
 };
 
@@ -415,7 +415,7 @@ OO.ui.Toolbar.prototype.onWindowResize = function () {
  */
 OO.ui.Toolbar.prototype.getNarrowThreshold = function () {
        if ( this.narrowThreshold === null ) {
-               this.narrowThreshold = this.$group.width() + this.$actions.width();
+               this.narrowThreshold = this.$group[ 0 ].offsetWidth + this.$actions[ 0 ].offsetWidth;
        }
        return this.narrowThreshold;
 };
@@ -790,13 +790,8 @@ OO.ui.Tool.prototype.isActive = function () {
  */
 OO.ui.Tool.prototype.setActive = function ( state ) {
        this.active = !!state;
-       if ( this.active ) {
-               this.$element.addClass( 'oo-ui-tool-active' );
-               this.setFlags( { progressive: true } );
-       } else {
-               this.$element.removeClass( 'oo-ui-tool-active' );
-               this.setFlags( { progressive: false } );
-       }
+       this.$element.toggleClass( 'oo-ui-tool-active', this.active );
+       this.updateThemeClasses();
 };
 
 /**
@@ -1956,6 +1951,15 @@ OO.ui.PopupToolGroup.prototype.onHandleMouseKeyDown = function ( e ) {
        }
 };
 
+/**
+ * Check if the tool group is active.
+ *
+ * @return {boolean} Tool group is active
+ */
+OO.ui.PopupToolGroup.prototype.isActive = function () {
+       return this.active;
+};
+
 /**
  * Switch into 'active' mode.
  *
@@ -1976,7 +1980,6 @@ OO.ui.PopupToolGroup.prototype.setActive = function ( value ) {
                        this.$clippable.css( 'left', '' );
                        // Try anchoring the popup to the left first
                        this.$element.addClass( 'oo-ui-popupToolGroup-active oo-ui-popupToolGroup-left' );
-                       this.setFlags( { progressive: true } );
                        this.toggleClipping( true );
                        if ( this.isClippedHorizontally() ) {
                                // Anchoring to the left caused the popup to clip, so anchor it to the right instead
@@ -2005,11 +2008,11 @@ OO.ui.PopupToolGroup.prototype.setActive = function ( value ) {
                        this.getElementDocument().removeEventListener( 'mouseup', this.onBlurHandler, true );
                        this.getElementDocument().removeEventListener( 'keyup', this.onBlurHandler, true );
                        this.$element.removeClass(
-                               'oo-ui-popupToolGroup-active oo-ui-popupToolGroup-left  oo-ui-popupToolGroup-right'
+                               'oo-ui-popupToolGroup-active oo-ui-popupToolGroup-left oo-ui-popupToolGroup-right'
                        );
-                       this.setFlags( { progressive: false } );
                        this.toggleClipping( false );
                }
+               this.updateThemeClasses();
        }
 };
 
@@ -2220,10 +2223,16 @@ OO.ui.ListToolGroup.prototype.onMouseKeyUp = function ( e ) {
 };
 
 OO.ui.ListToolGroup.prototype.updateCollapsibleState = function () {
-       var i, len;
+       var i, icon, len;
+
+       if ( this.toolbar.position !== 'bottom' ) {
+               icon = this.expanded ? 'collapse' : 'expand';
+       } else {
+               icon = this.expanded ? 'expand' : 'collapse';
+       }
 
        this.getExpandCollapseTool()
-               .setIcon( this.expanded ? 'collapse' : 'expand' )
+               .setIcon( icon )
                .setTitle( OO.ui.msg( this.expanded ? 'ooui-toolgroup-collapse' : 'ooui-toolgroup-expand' ) );
 
        for ( i = 0, len = this.collapsibleTools.length; i < len; i++ ) {