removed code which handles collapsible tabs

This commit is contained in:
giomba 2021-05-09 21:45:58 +02:00
parent cf34ef1acb
commit 7f87f040c0
4 changed files with 1 additions and 53 deletions

View File

@ -193,34 +193,6 @@
} ) } )
); );
}, },
/**
* Get the amount of horizontal distance between the two tabs groups in pixels.
*
* Uses `#left-navigation` and `#right-navigation`. If negative, this
* means that the tabs overlap, and the value is the width of overlapping
* parts.
*
* Used in default `expandCondition` and `collapseCondition` options.
*
* @return {number} distance/overlap in pixels
*/
calculateTabDistance: function () {
var leftTab, rightTab, leftEnd, rightStart;
// In RTL, #right-navigation is actually on the left and vice versa.
// Hooray for descriptive naming.
if ( !isRTL ) {
leftTab = document.getElementById( 'left-navigation' );
rightTab = document.getElementById( 'right-navigation' );
} else {
leftTab = document.getElementById( 'right-navigation' );
rightTab = document.getElementById( 'left-navigation' );
}
leftEnd = leftTab.getBoundingClientRect().right;
rightStart = rightTab.getBoundingClientRect().left;
return rightStart - leftEnd;
}
}; };
/** /**

View File

@ -5,6 +5,5 @@
"--warnings-exit-nonzero": true, "--warnings-exit-nonzero": true,
"--warnings": ["-nodoc(class,public)"], "--warnings": ["-nodoc(class,public)"],
"--": [ "--": [
"collapsibleTabs.js"
] ]
} }

View File

@ -64,7 +64,6 @@
}, },
"skins.vector.js": { "skins.vector.js": {
"scripts": [ "scripts": [
"collapsibleTabs.js",
"vector.js" "vector.js"
], ],
"dependencies": [ "dependencies": [

View File

@ -66,29 +66,7 @@ jQuery( function ( $ ) {
} }
}, },
collapseCondition: function () { collapseCondition: function () {
var collapsibleWidth = 0; return false;
// This looks a bit awkward because we're doing expensive queries as late
// as possible.
// TODO: The dropdown itself should probably "fold" to just the down-arrow
// (hiding the text) if it can't fit on the line?
// Never collapse if there is no overlap.
if ( $.collapsibleTabs.calculateTabDistance() >= 0 ) {
return false;
}
// Always collapse if the "More" button is already shown.
if ( !$cactions.hasClass( 'emptyPortlet' ) ) {
return true;
}
$tabContainer.children( 'li.collapsible' ).each( function ( index, element ) {
collapsibleWidth += $( element ).width();
// Stop this possibly expensive loop the moment the condition is met.
return !( collapsibleWidth > initialCactionsWidth() );
} );
return collapsibleWidth > initialCactionsWidth();
} }
} ); } );
} ); } );