From cccba25edaa1fef712b01ebbe5c4a474ffc8a27f Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 9 Jul 2009 01:58:57 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=80=E3=83=9F=E3=83=BC=E3=81=AE=E3=82=BF?= =?UTF-8?q?=E3=83=96=E3=82=92=E9=99=A4=E5=A4=96=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4687 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 30 +++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 8dbbf3de..66dbccec 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -1066,10 +1066,10 @@ var TreeStyleTabService = { ).numberValue; }, - isGroupTab : function(aTab) + isGroupTab : function(aTab, aLazyCheck) { return ( - aTab.linkedBrowser.sessionHistory.count == 1 && + (aLazyCheck || aTab.linkedBrowser.sessionHistory.count == 1) && aTab.linkedBrowser.currentURI.spec.indexOf('about:treestyletab-group') > -1 ); }, @@ -2170,27 +2170,29 @@ catch(e) { tabs = [aTabOrTabs]; } - var b = this.getTabBrowserFromChild(tabs[0]); - var bookmarkedTabs = []; - for (var i = 0, maxi = tabs.length; i < maxi; i++) - { - bookmarkedTabs.push(tabs[i]); - bookmarkedTabs = bookmarkedTabs.concat(b.treeStyleTab.getDescendantTabs(tabs[i])); + var folderName = null; + if (this.isGroupTab(tabs[0], true)) { + folderName = tabs[0].label; + tabs.splice(0, 1); } - if (this.isGroupTab(bookmarkedTabs[0])) - bookmarkedTabs[0].splice(0, 1); + var b = this.getTabBrowserFromChild(tabs[0]); + var bookmarkedTabs = []; + tabs.forEach(function(aTab) { + if (!this.isGroupTab(aTab)) bookmarkedTabs.push(aTab); + bookmarkedTabs = bookmarkedTabs.concat(b.treeStyleTab.getDescendantTabs(aTab)); + }, this); if ('MultipleTabService' in window && 'addBookmarkFor' in MultipleTabService) { - MultipleTabService.addBookmarkFor(bookmarkedTabs); + MultipleTabService.addBookmarkFor(bookmarkedTabs, folderName); } else { - this._addBookmarkFor(bookmarkedTabs); + this._addBookmarkFor(bookmarkedTabs, folderName); } }, - _addBookmarkFor : function(aTabs) // from Multiple Tab Handler + _addBookmarkFor : function(aTabs, aFolder) // from Multiple Tab Handler { if (!aTabs) return; @@ -2236,7 +2238,7 @@ catch(e) { (aTabs.length == 1 ? tabsInfo[0] : { - name : gNavigatorBundle.getString('bookmarkAllTabsDefault'), + name : (aFolderName || gNavigatorBundle.getString('bookmarkAllTabsDefault')), bBookmarkAllTabs : true, objGroup : tabsInfo }