ひとつのブックマークフォルダの中に2つ以上親タブが定義されており、すべての親タブが子を持っている場合、ダミーのタブを開かないようにした
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5569 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
89e7ea0a51
commit
d07d08935f
@ -204,12 +204,22 @@ var TreeStyleTabBookmarksService = {
|
|||||||
TreeStyleTabBookmarksService.getTreeStructureFromItems(ids) ;
|
TreeStyleTabBookmarksService.getTreeStructureFromItems(ids) ;
|
||||||
if (
|
if (
|
||||||
treeStructure &&
|
treeStructure &&
|
||||||
openGroupBookmarkBehavior & TreeStyleTabBookmarksService.kGROUP_BOOKMARK_USE_DUMMY &&
|
openGroupBookmarkBehavior & TreeStyleTabBookmarksService.kGROUP_BOOKMARK_USE_DUMMY
|
||||||
treeStructure.filter(function(aParent, aIndex) { return aParent == -1; }).length > 1
|
|
||||||
) {
|
) {
|
||||||
ids.unshift(-1);
|
let parentCount = 0;
|
||||||
treeStructure = TreeStyleTabBookmarksService.getTreeStructureFromItems(ids, 0);
|
let childCount = 0;
|
||||||
urls.unshift(TreeStyleTabBookmarksService.getGroupTabURI(aFolderTitle));
|
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);
|
TreeStyleTabBookmarksService.readyToOpenNewTabGroup(null, treeStructure);
|
||||||
replaceCurrentTab = false;
|
replaceCurrentTab = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user