* セッション復元時に現在のタブの位置がおかしくなる問題を修正(対処)
* 変数スコープのエラーを修正 git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4674 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
286a583752
commit
28a91a3a86
@ -776,6 +776,7 @@ var TreeStyleTabService = {
|
|||||||
|
|
||||||
getNextTab : function(aTab)
|
getNextTab : function(aTab)
|
||||||
{
|
{
|
||||||
|
if (!aTab) return null;
|
||||||
return this.evaluateXPath(
|
return this.evaluateXPath(
|
||||||
'following-sibling::xul:tab[1]',
|
'following-sibling::xul:tab[1]',
|
||||||
aTab,
|
aTab,
|
||||||
@ -785,6 +786,7 @@ var TreeStyleTabService = {
|
|||||||
|
|
||||||
getPreviousTab : function(aTab)
|
getPreviousTab : function(aTab)
|
||||||
{
|
{
|
||||||
|
if (!aTab) return null;
|
||||||
return this.evaluateXPath(
|
return this.evaluateXPath(
|
||||||
'preceding-sibling::xul:tab[1]',
|
'preceding-sibling::xul:tab[1]',
|
||||||
aTab,
|
aTab,
|
||||||
@ -794,6 +796,7 @@ var TreeStyleTabService = {
|
|||||||
|
|
||||||
getNextVisibleTab : function(aTab)
|
getNextVisibleTab : function(aTab)
|
||||||
{
|
{
|
||||||
|
if (!aTab) return null;
|
||||||
return this.evaluateXPath(
|
return this.evaluateXPath(
|
||||||
'following-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")][1]',
|
'following-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")][1]',
|
||||||
aTab,
|
aTab,
|
||||||
@ -803,6 +806,7 @@ var TreeStyleTabService = {
|
|||||||
|
|
||||||
getPreviousVisibleTab : function(aTab)
|
getPreviousVisibleTab : function(aTab)
|
||||||
{
|
{
|
||||||
|
if (!aTab) return null;
|
||||||
return this.evaluateXPath(
|
return this.evaluateXPath(
|
||||||
'preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")][1]',
|
'preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")][1]',
|
||||||
aTab,
|
aTab,
|
||||||
@ -812,6 +816,7 @@ var TreeStyleTabService = {
|
|||||||
|
|
||||||
getLastVisibleTab : function(aTab)
|
getLastVisibleTab : function(aTab)
|
||||||
{
|
{
|
||||||
|
if (!aTab) return null;
|
||||||
return this.evaluateXPath(
|
return this.evaluateXPath(
|
||||||
'child::xul:tab[not(@'+this.kCOLLAPSED+'="true")][last()]',
|
'child::xul:tab[not(@'+this.kCOLLAPSED+'="true")][last()]',
|
||||||
aTab.parentNode,
|
aTab.parentNode,
|
||||||
@ -830,7 +835,7 @@ var TreeStyleTabService = {
|
|||||||
|
|
||||||
getVisibleIndex : function(aTab)
|
getVisibleIndex : function(aTab)
|
||||||
{
|
{
|
||||||
if (aTab.getAttribute(this.kCOLLAPSED) == 'true') return -1;
|
if (!aTab || aTab.getAttribute(this.kCOLLAPSED) == 'true') return -1;
|
||||||
return this.evaluateXPath(
|
return this.evaluateXPath(
|
||||||
'count(preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")])',
|
'count(preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")])',
|
||||||
aTab,
|
aTab,
|
||||||
|
@ -514,54 +514,49 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
aTabBrowser.treeStyleTab.onPrefChange('extensions.treestyletab.tabbar.autoHide.mode');
|
aTabBrowser.treeStyleTab.onPrefChange('extensions.treestyletab.tabbar.autoHide.mode');
|
||||||
}, 0, b);
|
}, 0, b);
|
||||||
|
|
||||||
let (tabContextMenu) {
|
var tabContextMenu = document.getAnonymousElementByAttribute(b, 'anonid', 'tabContextMenu');
|
||||||
tabContextMenu = document.getAnonymousElementByAttribute(b, 'anonid', 'tabContextMenu');
|
tabContextMenu.addEventListener('popupshowing', this, false);
|
||||||
tabContextMenu.addEventListener('popupshowing', this, false);
|
if (!('MultipleTabService' in window)) {
|
||||||
if (!('MultipleTabService' in window)) {
|
window.setTimeout(function(aSelf, aTabBrowser, aPopup) {
|
||||||
window.setTimeout(function(aSelf, aTabBrowser, aPopup) {
|
let suffix = '-tabbrowser-'+(aTabBrowser.id || 'instance-'+parseInt(Math.random() * 65000));
|
||||||
let suffix = '-tabbrowser-'+(aTabBrowser.id || 'instance-'+parseInt(Math.random() * 65000));
|
[
|
||||||
[
|
aSelf.kMENUITEM_RELOADSUBTREE,
|
||||||
aSelf.kMENUITEM_RELOADSUBTREE,
|
aSelf.kMENUITEM_RELOADCHILDREN,
|
||||||
aSelf.kMENUITEM_RELOADCHILDREN,
|
aSelf.kMENUITEM_REMOVESUBTREE,
|
||||||
aSelf.kMENUITEM_REMOVESUBTREE,
|
aSelf.kMENUITEM_REMOVECHILDREN,
|
||||||
aSelf.kMENUITEM_REMOVECHILDREN,
|
aSelf.kMENUITEM_COLLAPSEEXPAND_SEPARATOR,
|
||||||
aSelf.kMENUITEM_COLLAPSEEXPAND_SEPARATOR,
|
aSelf.kMENUITEM_COLLAPSE,
|
||||||
aSelf.kMENUITEM_COLLAPSE,
|
aSelf.kMENUITEM_EXPAND,
|
||||||
aSelf.kMENUITEM_EXPAND,
|
aSelf.kMENUITEM_AUTOHIDE_SEPARATOR,
|
||||||
aSelf.kMENUITEM_AUTOHIDE_SEPARATOR,
|
aSelf.kMENUITEM_AUTOHIDE,
|
||||||
aSelf.kMENUITEM_AUTOHIDE,
|
aSelf.kMENUITEM_FIXED,
|
||||||
aSelf.kMENUITEM_FIXED,
|
aSelf.kMENUITEM_POSITION,
|
||||||
aSelf.kMENUITEM_POSITION,
|
aSelf.kMENUITEM_BOOKMARKSUBTREE
|
||||||
aSelf.kMENUITEM_BOOKMARKSUBTREE
|
].forEach(function(aID) {
|
||||||
].forEach(function(aID) {
|
let item = document.getElementById(aID).cloneNode(true);
|
||||||
let item = document.getElementById(aID).cloneNode(true);
|
item.setAttribute('id', item.getAttribute('id')+suffix);
|
||||||
item.setAttribute('id', item.getAttribute('id')+suffix);
|
|
||||||
|
|
||||||
let refNode = void(0);
|
let refNode = void(0);
|
||||||
let insertAfter = item.getAttribute('multipletab-insertafter');
|
let insertAfter = item.getAttribute('multipletab-insertafter');
|
||||||
if (insertAfter) {
|
if (insertAfter) {
|
||||||
try {
|
try {
|
||||||
eval('refNode = ('+insertAfter+').nextSibling');
|
eval('refNode = ('+insertAfter+').nextSibling');
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let insertBefore = item.getAttribute('multipletab-insertbefore');
|
catch(e) {
|
||||||
if (refNode === void(0) && insertBefore) {
|
|
||||||
try {
|
|
||||||
eval('refNode = '+insertBefore);
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
aPopup.insertBefore(item, refNode || null);
|
}
|
||||||
});
|
let insertBefore = item.getAttribute('multipletab-insertbefore');
|
||||||
tabContextMenu = null;
|
if (refNode === void(0) && insertBefore) {
|
||||||
}, 0, this, b, tabContextMenu);
|
try {
|
||||||
}
|
eval('refNode = '+insertBefore);
|
||||||
else {
|
}
|
||||||
|
catch(e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aPopup.insertBefore(item, refNode || null);
|
||||||
|
});
|
||||||
tabContextMenu = null;
|
tabContextMenu = null;
|
||||||
}
|
}, 0, this, b, tabContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (allTabPopup) {
|
let (allTabPopup) {
|
||||||
@ -1008,11 +1003,15 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
|
|
||||||
var tabs = this.getTabs(b);
|
var tabs = this.getTabsArray(b);
|
||||||
for (var i = 0, maxi = tabs.snapshotLength; i < maxi; i++)
|
tabs.forEach(function(aTab) {
|
||||||
{
|
let next = this.getNextSiblingTab(aTab);
|
||||||
this.destroyTab(tabs.snapshotItem(i));
|
if (next)
|
||||||
}
|
this.setTabValue(aTab, this.kINSERT_BEFORE, next.getAttribute(this.kID));
|
||||||
|
}, this);
|
||||||
|
tabs.forEach(function(aTab) {
|
||||||
|
this.destroyTab(aTab);
|
||||||
|
}, this);
|
||||||
|
|
||||||
b.removeEventListener('TabOpen', this, true);
|
b.removeEventListener('TabOpen', this, true);
|
||||||
b.removeEventListener('TabClose', this, true);
|
b.removeEventListener('TabClose', this, true);
|
||||||
@ -1760,9 +1759,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nextTab = this.getTabValue(tab, this.kINSERT_BEFORE);
|
var nextTab = this.getTabValue(tab, this.kINSERT_BEFORE);
|
||||||
if (nextTab && maybeDuplicated) {
|
if (nextTab && maybeDuplicated) nextTab = this.redirectId(nextTab);
|
||||||
nextTab = this.redirectId(nextTab);
|
nextTab = this.getTabById(nextTab);
|
||||||
}
|
|
||||||
|
|
||||||
var ancestors = (this.getTabValue(tab, this.kANCESTOR) || this.getTabValue(tab, this.kPARENT)).split('|');
|
var ancestors = (this.getTabValue(tab, this.kANCESTOR) || this.getTabValue(tab, this.kPARENT)).split('|');
|
||||||
var parent = null;
|
var parent = null;
|
||||||
@ -1783,7 +1781,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (parent) {
|
if (parent) {
|
||||||
this.attachTabTo(tab, parent, {
|
this.attachTabTo(tab, parent, {
|
||||||
dontExpand : true,
|
dontExpand : true,
|
||||||
insertBefore : (nextTab ? this.getTabById(nextTab) : null ),
|
insertBefore : nextTab,
|
||||||
dontUpdateIndent : true
|
dontUpdateIndent : true
|
||||||
});
|
});
|
||||||
this.updateTabsIndent([tab], undefined, undefined, aWithoutAnimation);
|
this.updateTabsIndent([tab], undefined, undefined, aWithoutAnimation);
|
||||||
@ -1799,7 +1797,6 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
nextTab = this.getTabById(nextTab);
|
|
||||||
if (!nextTab) nextTab = this.getNextTab(tab);
|
if (!nextTab) nextTab = this.getNextTab(tab);
|
||||||
var parentOfNext = this.getParentTab(nextTab);
|
var parentOfNext = this.getParentTab(nextTab);
|
||||||
var newPos = -1;
|
var newPos = -1;
|
||||||
@ -2839,7 +2836,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var insertBefore = aInfo.insertBefore;
|
var insertBefore = aInfo.insertBefore;
|
||||||
var beforeTab = insertBefore ? insertBefore.getAttribute(this.kID) : null ;
|
var beforeTab = insertBefore ? insertBefore.getAttribute(this.kID) : null ;
|
||||||
var beforeIndex;
|
var beforeIndex;
|
||||||
|
Application.console.log('insertBefore '+insertBefore);
|
||||||
|
Application.console.log('beforeTab '+beforeTab);
|
||||||
if (beforeTab && (beforeIndex = children.indexOf(beforeTab)) > -1) {
|
if (beforeTab && (beforeIndex = children.indexOf(beforeTab)) > -1) {
|
||||||
|
Application.console.log('beforeIndex '+beforeIndex);
|
||||||
children.splice(beforeIndex, 0, id);
|
children.splice(beforeIndex, 0, id);
|
||||||
newIndex = insertBefore._tPos;
|
newIndex = insertBefore._tPos;
|
||||||
}
|
}
|
||||||
@ -2858,6 +2858,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.inheritTabIndent(aChild, aParent);
|
this.inheritTabIndent(aChild, aParent);
|
||||||
|
|
||||||
if (newIndex > aChild._tPos) newIndex--;
|
if (newIndex > aChild._tPos) newIndex--;
|
||||||
|
Application.console.log('newIndex '+newIndex);
|
||||||
this.moveTabSubTreeTo(aChild, newIndex);
|
this.moveTabSubTreeTo(aChild, newIndex);
|
||||||
|
|
||||||
if (!aInfo.dontExpand) {
|
if (!aInfo.dontExpand) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user