for => forEach
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4143 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
b5746fac9b
commit
f045e4d4b2
@ -656,32 +656,29 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var close = this.getTabClosebox(aTab);
|
var close = this.getTabClosebox(aTab);
|
||||||
var counter = document.getAnonymousElementByAttribute(aTab, 'class', this.kCOUNTER_CONTAINER);
|
var counter = document.getAnonymousElementByAttribute(aTab, 'class', this.kCOUNTER_CONTAINER);
|
||||||
|
|
||||||
var nodes = document.getAnonymousNodes(aTab);
|
Array.slice(document.getAnonymousNodes(aTab)).reverse()
|
||||||
for (var i = nodes.length-1; i > -1; i--)
|
.forEach(function(aNode, aIndex) {
|
||||||
{
|
aNode.setAttribute('ordinal', (aIndex + 1) * 10);
|
||||||
nodes[i].setAttribute('ordinal', (i + 1) * 10);
|
}, this);
|
||||||
}
|
|
||||||
|
|
||||||
nodes = label.parentNode.childNodes;
|
var nodes = Array.slice(label.parentNode.childNodes);
|
||||||
if (this.mTabBrowser.getAttribute(this.kTABBAR_POSITION) == 'right' &&
|
if (this.mTabBrowser.getAttribute(this.kTABBAR_POSITION) == 'right' &&
|
||||||
this.mTabBrowser.getAttribute(this.kUI_INVERTED) == 'true') {
|
this.mTabBrowser.getAttribute(this.kUI_INVERTED) == 'true') {
|
||||||
for (var i = nodes.length-1; i > -1; i--)
|
nodes.reverse().forEach(function(aNode, aIndex) {
|
||||||
{
|
if (aNode.getAttribute('class') == 'informationaltab-thumbnail-container')
|
||||||
if (nodes[i].getAttribute('class') == 'informationaltab-thumbnail-container')
|
return;
|
||||||
continue;
|
aNode.setAttribute('ordinal', (nodes.length - aIndex + 1) * 10);
|
||||||
nodes[i].setAttribute('ordinal', (nodes.length - i + 1) * 10);
|
}, this);
|
||||||
}
|
|
||||||
if (counter)
|
if (counter)
|
||||||
counter.setAttribute('ordinal', parseInt(label.getAttribute('ordinal')) + 1);
|
counter.setAttribute('ordinal', parseInt(label.getAttribute('ordinal')) + 1);
|
||||||
close.setAttribute('ordinal', parseInt(label.parentNode.getAttribute('ordinal')) - 5);
|
close.setAttribute('ordinal', parseInt(label.parentNode.getAttribute('ordinal')) - 5);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var i = nodes.length-1; i > -1; i--)
|
nodes.reverse().forEach(function(aNode, aIndex) {
|
||||||
{
|
if (aNode.getAttribute('class') == 'informationaltab-thumbnail-container')
|
||||||
if (nodes[i].getAttribute('class') == 'informationaltab-thumbnail-container')
|
return;
|
||||||
continue;
|
aNode.setAttribute('ordinal', (aIndex + 1) * 10);
|
||||||
nodes[i].setAttribute('ordinal', (i + 1) * 10);
|
}, this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1414,11 +1411,9 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_CLOSE ||
|
closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_CLOSE ||
|
||||||
tab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true'
|
tab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true'
|
||||||
) {
|
) {
|
||||||
var descendant = this.getDescendantTabs(tab);
|
this.getDescendantTabs(tab).reverse().forEach(function(aTab) {
|
||||||
for (var i = descendant.length-1; i > -1; i--)
|
b.removeTab(aTab);
|
||||||
{
|
}, this);
|
||||||
b.removeTab(descendant[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.getTabs(b).snapshotLength == 1) { // this is the last tab
|
if (this.getTabs(b).snapshotLength == 1) { // this is the last tab
|
||||||
b.addTab('about:blank');
|
b.addTab('about:blank');
|
||||||
@ -1436,27 +1431,24 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (firstChild) {
|
if (firstChild) {
|
||||||
var backupChildren = this.getTabValue(tab, this.kCHILDREN);
|
var backupChildren = this.getTabValue(tab, this.kCHILDREN);
|
||||||
var children = this.getChildTabs(tab);
|
var children = this.getChildTabs(tab);
|
||||||
var self = this;
|
children.forEach((
|
||||||
var processTab = closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_DETACH ?
|
closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_DETACH ?
|
||||||
function(aTab) {
|
function(aTab) {
|
||||||
self.partTab(aTab, true);
|
this.partTab(aTab, true);
|
||||||
self.moveTabSubTreeTo(aTab, self.getLastTab(b)._tPos);
|
this.moveTabSubTreeTo(aTab, this.getLastTab(b)._tPos);
|
||||||
} :
|
} :
|
||||||
parentTab ?
|
parentTab ?
|
||||||
function(aTab) {
|
function(aTab) {
|
||||||
self.attachTabTo(aTab, parentTab, {
|
this.attachTabTo(aTab, parentTab, {
|
||||||
insertBefore : tab,
|
insertBefore : tab,
|
||||||
dontUpdateIndent : true,
|
dontUpdateIndent : true,
|
||||||
dontExpand : true
|
dontExpand : true
|
||||||
});
|
});
|
||||||
} :
|
} :
|
||||||
function(aTab) {
|
function(aTab) {
|
||||||
self.partTab(aTab, true);
|
this.partTab(aTab, true);
|
||||||
};
|
}
|
||||||
for (var i = 0, maxi = children.length; i < maxi; i++)
|
), this);
|
||||||
{
|
|
||||||
processTab(children[i]);
|
|
||||||
}
|
|
||||||
this.updateTabsIndent(children);
|
this.updateTabsIndent(children);
|
||||||
this.checkTabsIndentOverflow();
|
this.checkTabsIndentOverflow();
|
||||||
if (closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_ATTACH) {
|
if (closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_ATTACH) {
|
||||||
@ -1664,13 +1656,12 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
children = children.map(function(aChild) {
|
children = children.map(function(aChild) {
|
||||||
return this.redirectId(aChild);
|
return this.redirectId(aChild);
|
||||||
}, this);
|
}, this);
|
||||||
for (var i = 0, maxi = children.length; i < maxi; i++)
|
children.forEach(function(aTab) {
|
||||||
{
|
if (aTab && (aTab = this.getTabById(aTab))) {
|
||||||
if (children[i] && (children[i] = this.getTabById(children[i]))) {
|
this.attachTabTo(aTab, tab, { dontExpand : true, dontUpdateIndent : true });
|
||||||
this.attachTabTo(children[i], tab, { dontExpand : true, dontUpdateIndent : true });
|
tabs.push(aTab);
|
||||||
tabs.push(children[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextTab = this.getTabValue(tab, this.kINSERT_BEFORE);
|
var nextTab = this.getTabValue(tab, this.kINSERT_BEFORE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user