From d07d08935f8a4342255fbea2579c5c20b9f50ed1 Mon Sep 17 00:00:00 2001 From: piro Date: Sun, 20 Dec 2009 19:11:14 +0000 Subject: [PATCH] =?UTF-8?q?=E3=81=B2=E3=81=A8=E3=81=A4=E3=81=AE=E3=83=96?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=83=9E=E3=83=BC=E3=82=AF=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=80=E3=81=AE=E4=B8=AD=E3=81=AB2=E3=81=A4?= =?UTF-8?q?=E4=BB=A5=E4=B8=8A=E8=A6=AA=E3=82=BF=E3=83=96=E3=81=8C=E5=AE=9A?= =?UTF-8?q?=E7=BE=A9=E3=81=95=E3=82=8C=E3=81=A6=E3=81=8A=E3=82=8A=E3=80=81?= =?UTF-8?q?=E3=81=99=E3=81=B9=E3=81=A6=E3=81=AE=E8=A6=AA=E3=82=BF=E3=83=96?= =?UTF-8?q?=E3=81=8C=E5=AD=90=E3=82=92=E6=8C=81=E3=81=A3=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=82=8B=E5=A0=B4=E5=90=88=E3=80=81=E3=83=80=E3=83=9F=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E3=82=BF=E3=83=96=E3=82=92=E9=96=8B=E3=81=8B=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= 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@5569 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/bookmarksOverlay.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/content/treestyletab/bookmarksOverlay.js b/content/treestyletab/bookmarksOverlay.js index 6b6f5607..ea92282c 100644 --- a/content/treestyletab/bookmarksOverlay.js +++ b/content/treestyletab/bookmarksOverlay.js @@ -204,12 +204,22 @@ var TreeStyleTabBookmarksService = { TreeStyleTabBookmarksService.getTreeStructureFromItems(ids) ; if ( treeStructure && - openGroupBookmarkBehavior & TreeStyleTabBookmarksService.kGROUP_BOOKMARK_USE_DUMMY && - treeStructure.filter(function(aParent, aIndex) { return aParent == -1; }).length > 1 + openGroupBookmarkBehavior & TreeStyleTabBookmarksService.kGROUP_BOOKMARK_USE_DUMMY ) { - ids.unshift(-1); - treeStructure = TreeStyleTabBookmarksService.getTreeStructureFromItems(ids, 0); - urls.unshift(TreeStyleTabBookmarksService.getGroupTabURI(aFolderTitle)); + let parentCount = 0; + let childCount = 0; + treeStructure.forEach(function(aParent, aIndex) { + if (aParent == -1) + parentCount++; + else + childCount++; + }); + // when there is any orphan, then all of parents and orphans should be grouped under a dummy tab. + if (parentCount > 1 && childCount < parentCount) { + ids.unshift(-1); + treeStructure = TreeStyleTabBookmarksService.getTreeStructureFromItems(ids, 0); + urls.unshift(TreeStyleTabBookmarksService.getGroupTabURI(aFolderTitle)); + } } TreeStyleTabBookmarksService.readyToOpenNewTabGroup(null, treeStructure); replaceCurrentTab = false;