@@ -228,14 +228,8 @@ tabutils._stackTabs = function() {
228
228
if ( tabs . length == 0 )
229
229
return ;
230
230
231
- if ( typeof aTab == "string" || ! aTab . selected && ! aTab . hasAttribute ( "group-selected" ) ) {
231
+ if ( typeof aTab == "string" ) {
232
232
aTab = tabs [ 0 ] ;
233
- for ( let tab of tabs ) {
234
- if ( tab . hasAttribute ( "group-selected" ) ) {
235
- aTab = tab ;
236
- break ;
237
- }
238
- }
239
233
}
240
234
241
235
let group = options . id ? Services . nsIUUIDGenerator . generateUUID ( ) . toString ( )
@@ -251,21 +245,23 @@ tabutils._stackTabs = function() {
251
245
tab . removeAttribute ( "group-first" ) ;
252
246
tab . removeAttribute ( "group-last" ) ;
253
247
tab . collapsed = collapsed ;
248
+
249
+ if ( tab . _lastAccessed > aTab . _lastAccessed )
250
+ aTab = tab ;
254
251
}
255
252
tabutils . _tabPrefObserver . updateStackColor ( group , color ) ;
256
253
257
- if ( ! aTab . selected && tabs . indexOf ( this . mCurrentTab ) > - 1 )
258
- aTab = this . mCurrentTab ;
259
-
260
254
aTab . collapsed = false ;
261
255
tabutils . setAttribute ( aTab , "group-selected" , true ) ;
262
256
aTab . setAttribute ( "group-counter" , tabs . length ) ;
263
257
tabs [ 0 ] . setAttribute ( "group-first" , true ) ;
264
258
tabs [ tabs . length - 1 ] . setAttribute ( "group-last" , true ) ;
265
259
266
- let tabcontent = document . getAnonymousElementByAttribute ( aTab , "class" , "tab-content" ) ;
267
- if ( tabcontent )
268
- tabcontent . setAttribute ( "group-counter" , "(" + tabs . length + ")" ) ;
260
+ if ( collapsed ) {
261
+ let tabcontent = document . getAnonymousElementByAttribute ( aTab , "class" , "tab-content" ) ;
262
+ if ( tabcontent )
263
+ tabcontent . setAttribute ( "group-counter" , "(" + tabs . length + ")" ) ;
264
+ }
269
265
} ;
270
266
271
267
tabutils . addEventListener ( gBrowser . mTabContainer , "dragover" , function ( event ) {
@@ -492,19 +488,6 @@ tabutils._stackTabs = function() {
492
488
this . detachTab ( aTab ) ;
493
489
} ) ;
494
490
495
- TU_hookCode ( "gBrowser.showOnlyTheseTabs" , "{" , function ( ) { // Ensure selected tab keeps when switching group
496
- Array . reduceRight ( this . mTabs , function ( self , aTab ) {
497
- if ( aTabs . indexOf ( aTab ) == - 1 )
498
- this . hideTab ( aTab ) ;
499
- } . bind ( this ) , this ) ;
500
- Array . reduce ( this . mTabs , function ( self , aTab ) {
501
- if ( aTabs . indexOf ( aTab ) > - 1 )
502
- this . showTab ( aTab ) ;
503
- } . bind ( this ) , this ) ;
504
- this . tabContainer . mTabstrip . ensureElementIsVisible ( this . selectedTab , false ) ;
505
- return ;
506
- } ) ;
507
-
508
491
TU_hookCode ( "gBrowser.onTabHide" , "}" , function ( ) {
509
492
if ( aTab . hasAttribute ( "group" ) ) {
510
493
this . updateStack ( aTab . getAttribute ( "group" ) ) ;
0 commit comments