From 8427b2f595901173f048423d4ddf7fe3977fe48e Mon Sep 17 00:00:00 2001 From: piro Date: Tue, 14 Sep 2010 07:05:27 +0000 Subject: [PATCH] =?UTF-8?q?Tab=20Panoramas=E3=81=A7=E3=82=BF=E3=83=96?= =?UTF-8?q?=E3=82=92=E3=82=B0=E3=83=AB=E3=83=BC=E3=83=97=E5=88=86=E3=81=91?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E6=99=82=E3=80=81=E3=80=8C?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=81=AE=E4=B8=80=E8=A6=A7=E3=80=8D=E3=81=8C?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E3=81=AB=E6=A9=9F=E8=83=BD=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=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@7199 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- modules/utils.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/modules/utils.js b/modules/utils.js index f172c967..fa80bbe3 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -1020,7 +1020,7 @@ var TreeStyleTabUtils = { { var b = this.getTabBrowserFromChild(aTabBrowserChild); return this.evaluateXPath( - 'descendant::xul:tab', + 'descendant::xul:tab[not(@hidden="true")]', b.mTabContainer ); }, @@ -1028,13 +1028,14 @@ var TreeStyleTabUtils = { getTabsArray : function TSTUtils_getTabsArray(aTabBrowserChild) { var b = this.getTabBrowserFromChild(aTabBrowserChild); - return Array.slice(b.mTabContainer.childNodes); + return b.visibleTabs || Array.slice(b.mTabContainer.childNodes) ; }, getFirstTab : function TSTUtils_getFirstTab(aTabBrowserChild) { var b = this.getTabBrowserFromChild(aTabBrowserChild); - return b.mTabContainer.firstChild; + var tabs = b.visibleTabs; + return tabs ? tabs[0] : b.mTabContainer.firstChild; }, getFirstNormalTab : function TSTUtils_getFirstNormalTab(aTabBrowserChild) @@ -1050,12 +1051,20 @@ var TreeStyleTabUtils = { getLastTab : function TSTUtils_getLastTab(aTabBrowserChild) { var b = this.getTabBrowserFromChild(aTabBrowserChild); - return b.mTabContainer.lastChild; + var tabs = b.visibleTabs; + return tabs ? tabs[tabs.length-1] : b.mTabContainer.lastChild ; }, getNextTab : function TSTUtils_getNextTab(aTab) { if (!aTab) return null; + var b = this.getTabBrowserFromChild(aTab); + var tabs = b.visibleTabs; + if (tabs) { + let index = tabs.indexOf(aTab); + if (index > -1) + return tabs.length > index ? tabs[index+1] : null + } var tab = aTab.nextSibling; return (tab && tab.localName == 'tab') ? tab : null ; }, @@ -1063,6 +1072,13 @@ var TreeStyleTabUtils = { getPreviousTab : function TSTUtils_getPreviousTab(aTab) { if (!aTab) return null; + var b = this.getTabBrowserFromChild(aTab); + var tabs = b.visibleTabs; + if (tabs) { + let index = tabs.indexOf(aTab); + if (index > -1) + return 0 < index ? tabs[index-1] : null + } var tab = aTab.previousSibling; return (tab && tab.localName == 'tab') ? tab : null ; },