getLastTab()

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3538 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-01-26 06:37:29 +00:00
parent 58bb4f5c88
commit f362343c48
2 changed files with 31 additions and 25 deletions

View File

@ -509,25 +509,6 @@ var TreeStyleTabService = {
return frame;
},
getTabs : function(aTabBrowser)
{
return this.evaluateXPath(
'descendant::xul:tab',
aTabBrowser.mTabContainer
);
},
getTabsArray : function(aTabBrowser)
{
var tabs = this.getTabs(aTabBrowser);
var array = [];
for (var i = 0, maxi = tabs.snapshotLength; i < maxi; i++)
{
array.push(tabs.snapshotItem(i));
}
return array;
},
makeNewId : function()
{
return 'tab-<'+Date.now()+'-'+parseInt(Math.random() * 65000)+'>';
@ -592,6 +573,34 @@ var TreeStyleTabService = {
).singleNodeValue;
},
getTabs : function(aTabBrowser)
{
return this.evaluateXPath(
'descendant::xul:tab',
aTabBrowser.mTabContainer
);
},
getTabsArray : function(aTabBrowser)
{
var tabs = this.getTabs(aTabBrowser);
var array = [];
for (var i = 0, maxi = tabs.snapshotLength; i < maxi; i++)
{
array.push(tabs.snapshotItem(i));
}
return array;
},
getLastTab : function(aTabBrowser)
{
return this.evaluateXPath(
'descendant::xul:tab[last()]',
aTabBrowser.mTabContainer,
XPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue;
},
getNextTab : function(aTab)
{
return this.evaluateXPath(

View File

@ -133,8 +133,7 @@ TreeStyleTabBrowser.prototype = {
'{',
<![CDATA[$&
if (!val) {
var tabs = TreeStyleTabService.getTabs(this)
val = tabs.snapshotItem(tabs.snapshotLength-1);
val = TreeStyleTabService.getLastTab(this);
}
]]>.toString()
));
@ -1339,8 +1338,7 @@ TreeStyleTabBrowser.prototype = {
var attach = this.getTreePref('attachChildrenToGrandParentOnRemoveTab');
var processTab = !attach ? function(aTab) {
self.partTab(aTab, true);
var tabs = self.getTabs(b);
self.moveTabSubTreeTo(aTab, tabs.snapshotItem(tabs.snapshotLength-1)._tPos);
self.moveTabSubTreeTo(aTab, self.getLastTab(b)._tPos);
} :
parentTab ? function(aTab) {
self.attachTabTo(aTab, parentTab, {
@ -2738,8 +2736,7 @@ TreeStyleTabBrowser.prototype = {
b.moveTabTo(b.mCurrentTab, nextTab._tPos - 1);
}
else {
var tabs = this.getTabs(b);
b.moveTabTo(b.mCurrentTab, tabs.snapshotItem(tabs.snapshotLength-1)._tPos);
b.moveTabTo(b.mCurrentTab, this.getLastTab(b)._tPos);
}
this.internallyTabMoving = false;
b.mCurrentTab.focus();