From 330fcd301a751ce8cf9f3968fd71356360bd6c77 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Thu, 9 Feb 2012 02:22:25 +0900 Subject: [PATCH 01/12] update library --- modules/lib/confirmWithPopup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lib/confirmWithPopup.js b/modules/lib/confirmWithPopup.js index 24a31be6..3d36bef2 100644 --- a/modules/lib/confirmWithPopup.js +++ b/modules/lib/confirmWithPopup.js @@ -222,7 +222,7 @@ var confirmWithPopup; accessKey = match[2]; } else if (match = aLabel.match(/^\s*(.*[^&])?\&(([^&]).*$)/)) { - aLabel = (match[1] + match[2]).replace(/\&\&/g, '&'); + aLabel = ((match[1] || '') + match[2]).replace(/\&\&/g, '&'); accessKey = match[3]; } else { From 06eef3c87d1d21febf4f580986ca1c003a901ca2 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Thu, 9 Feb 2012 02:23:44 +0900 Subject: [PATCH 02/12] specify accesskey --- locale/ru/treestyletab/treestyletab.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ru/treestyletab/treestyletab.properties b/locale/ru/treestyletab/treestyletab.properties index dde1bfea..8336be96 100755 --- a/locale/ru/treestyletab/treestyletab.properties +++ b/locale/ru/treestyletab/treestyletab.properties @@ -27,9 +27,9 @@ bookmarkDroppedTabs.bookmarkAll=&Все вкладки в дереве bookmarkDroppedTabs.bookmarkOnlyParent=Только &родительскую вкладку undoCloseTabSetBehavior.label=Эта вкладка была закрыта вместе с другими вкладками (%S шт.). Восстановить другие вкладки? -undoCloseTabSetBehavior.restoreOnce=Восстановить вкладки -undoCloseTabSetBehavior.restoreForever=Всегда восстанавливать вкладки -undoCloseTabSetBehavior.ignoreForever=Больше не показывать это сообщение +undoCloseTabSetBehavior.restoreOnce=&Восстановить вкладки +undoCloseTabSetBehavior.restoreForever=В&сегда восстанавливать вкладки +undoCloseTabSetBehavior.ignoreForever=Больше &не показывать это сообщение openSelectedPlaces.bookmarks=из %2$S закладок, включая "%1$S" openSelectedPlaces.history=из %2$S из истории ссылок, включая "%1$S" From db70b7f469a86d3581dd38ff0614c257dda1b88c Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Thu, 9 Feb 2012 02:52:10 +0900 Subject: [PATCH 03/12] for horizontal tab bar, failed to reset z index --- modules/browser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/browser.js b/modules/browser.js index 902dda10..e78c4ef7 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -532,7 +532,7 @@ TreeStyleTabBrowser.prototype = { { let tab = tabs[i]; if (aStacked) - tab.style.zIndex = count * 1000 - index; + tab.style.zIndex = count * 1000 - i; else tab.style.zIndex = ''; } From b885bb8f02722a08b2fcac37aeec29f4d2de234f Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 01:36:48 +0900 Subject: [PATCH 04/12] Twisties couldn't be hidden by user preference (regression) ( https://github.com/piroor/treestyletab/issues/235 ) --- content/treestyletab/treestyletab.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index 1db685b4..68694fa3 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -10,7 +10,7 @@ .treestyletab-twisty { visibility: hidden; } -.tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"] +.tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"]:not([treestyletab-twisty-style="none"]) .tabbrowser-tab[treestyletab-children][treestyletab-allow-subtree-collapse="true"] .treestyletab-twisty { visibility: visible; From 5d1ebb9867c390b8e24ab61b891ac2f4476bd452 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 01:59:37 +0900 Subject: [PATCH 05/12] With Tab Mix Plus, failed to save session data. (regression) --- content/treestyletab/windowHelperHacks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js index 84cb8377..f1cdf9e8 100644 --- a/content/treestyletab/windowHelperHacks.js +++ b/content/treestyletab/windowHelperHacks.js @@ -130,7 +130,7 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte From b796513d4b6da40dd919fb799b3c8df747a22c05 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 02:44:35 +0900 Subject: [PATCH 06/12] Favicon of collapsed tabs in the horizontal tree were not hidden. (regression) ( https://github.com/piroor/treestyletab/issues/233 ) --- content/treestyletab/treestyletab.css | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index 68694fa3..2b791c77 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -59,9 +59,7 @@ mask: url("res/tabEffects.svg#fadein-mask"); } .tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"][treestyletab-stack-collapsed-tabs="true"] - .tabbrowser-tab[treestyletab-collapsed-done="true"] .tab-image-middle > *, -.tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"][treestyletab-stack-collapsed-tabs="true"] - .tabbrowser-tab[treestyletab-collapsed-done="true"] .tab-close-button { + .tabbrowser-tab[treestyletab-collapsed-done="true"] .tab-content > * { visibility: collapse; } From b42df2780f205de7395bffb55fd1d84f33d673b8 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 02:59:50 +0900 Subject: [PATCH 07/12] User preference of "When a tab gets focus, expand its tree and collapse others automatically" was wrongly ignored if focusMode = 0 ( https://github.com/piroor/treestyletab/issues/232 ) --- modules/browser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/browser.js b/modules/browser.js index e78c4ef7..cf908cbb 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -3906,7 +3906,8 @@ TreeStyleTabBrowser.prototype = { { this.collapseExpandSubtree(parentTab, false); } - this.collapseExpandTreesIntelligentlyForNewActiveTab(tab); + if (this.getTreePref('autoCollapseExpandSubtreeOnSelect')) + this.collapseExpandTreesIntelligentlyForNewActiveTab(tab); } else { b.selectedTab = this.getRootTab(tab); From bae7c30238d271661f64fbe78515c8a48a5800b9 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 03:59:13 +0900 Subject: [PATCH 08/12] even if "auto collapse/expand of focused tree" is disabled, long time pressing of Ctrl key should expand the tree. --- defaults/preferences/treestyletab.js | 13 +-- modules/browser.js | 114 +++++++++++++++++---------- modules/window.js | 16 +++- 3 files changed, 92 insertions(+), 51 deletions(-) diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index d1f21587..3bddf4b2 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -422,17 +422,18 @@ pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect", true); pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove", true); /** * When you press Ctrl-Tab/Shift-Ctrl-Tab, Firefox advances focus of tabs. - * If this is "true", TST collapses/expands focused tree after a delay specified - * by another preference "autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay". - * (If the delay is "0", TST dynamiclaly collapses/expands focused tree even if + * If this is "true", TST expands focused tree after a delay specified + * by another preference "autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay". + * (If the delay is "0", TST dynamiclaly expands focused tree even if * you are browsing tabs by those shortcuts.) - * If this is "false", TST doesn't collapse/expand trees while you are switching + * If this is "false", TST doesn't expand trees while you are switching * tab focus by those keyboard shortcuts. And then, after you release the Ctrl * key, TST will expand the tree if the newly selected tab have its collapsed * tree. */ -pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut", true); -pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay", 800); +pref("extensions.treestyletab.autoExpandSubtreeOnSelect.whileFocusMovingByShortcut", true); +pref("extensions.treestyletab.autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers", true); +pref("extensions.treestyletab.autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay", 800); /** * If this is "true", TST expands/collapses tree by double-clicking on tabs. * Otherwise TST simply ignores such actions. diff --git a/modules/browser.js b/modules/browser.js index cf908cbb..f714d4f6 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -3899,6 +3899,11 @@ TreeStyleTabBrowser.prototype = { ) return; + var shouldCollapseExpandNow = this.getTreePref('autoCollapseExpandSubtreeOnSelect'); + var newActiveTabOptions = { + canCollapseTree : shouldCollapseExpandNow, + canExpandTree : shouldCollapseExpandNow + }; if (this.isCollapsed(tab)) { if (this.getTreePref('autoExpandSubtreeOnCollapsedChildFocused')) { let parentTab = tab; @@ -3906,48 +3911,61 @@ TreeStyleTabBrowser.prototype = { { this.collapseExpandSubtree(parentTab, false); } - if (this.getTreePref('autoCollapseExpandSubtreeOnSelect')) - this.collapseExpandTreesIntelligentlyForNewActiveTab(tab); + this.handleNewActiveTab(tab, newActiveTabOptions); } else { b.selectedTab = this.getRootTab(tab); } } else if ( - this.getTreePref('autoCollapseExpandSubtreeOnSelect') && ( - !this._focusChangedByCurrentTabRemove || - this.getTreePref('autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove') + /** + * Focus movings by arrow keys should not be handled on TabSelect, + * because they are already handled by handleAdvanceSelectedTab(). + */ + this.windowService.arrowKeyEventOnTab && + this.windowService.arrowKeyEventOnTab.advanceFocus + ) || + ( + /** + * Focus movings by closing of the old current tab should be handled + * only when it is activated by user preference expressly. + */ + this._focusChangedByCurrentTabRemove && + !this.getTreePref('autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove') ) + ) { + // do nothing! + } + else if (this.hasChildTabs(tab) && this.isSubtreeCollapsed(tab)) { + if ( + this._focusChangedByShortcut && + this.windowService.accelKeyPressed ) { - if (!this.hasChildTabs(tab) || !this.isSubtreeCollapsed(tab)) - tab = null; - - let event = this.windowService.arrowKeyEventOnTab; - let byArrowKey = event && event.advanceFocus; - let byShortcut = this._focusChangedByShortcut && this.windowService.accelKeyPressed; - if (!byArrowKey) { - if (byShortcut) { - if (!this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut')) { - this.windowService.expandTreeAfterKeyReleased(tab); + if (this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut')) { + newActiveTabOptions.canExpandTree = true; + newActiveTabOptions.canCollapseTree = ( + newActiveTabOptions.canCollapseTree && + this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers') + ); + let delay = this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay'); + if (delay > 0) { + this._autoExpandOnTabSelectTimer = this.window.setTimeout(function(aSelf) { + if (tab && tab.parentNode) + aSelf.handleNewActiveTab(tab, newActiveTabOptions); + }, delay, this); } else { - let delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay'); - if (delay > 0) { - this._autoExpandOnTabSelectTimer = this.window.setTimeout(function(aSelf) { - if (tab && tab.parentNode) - aSelf.collapseExpandTreesIntelligentlyForNewActiveTab(tab); - }, delay, this); - } - else { - this.collapseExpandTreesIntelligentlyForNewActiveTab(tab); - } + this.handleNewActiveTab(tab, newActiveTabOptions); } } - else { - this.collapseExpandTreesIntelligentlyForNewActiveTab(tab); + else if (newActiveTabOptions.canExpandTree) { + this.windowService.expandTreeAfterKeyReleased(tab); } } + else { + this.handleNewActiveTab(tab, newActiveTabOptions); + } } this._focusChangedByCurrentTabRemove = false; @@ -3966,6 +3984,32 @@ TreeStyleTabBrowser.prototype = { this._autoExpandOnTabSelectTimer = null; } }, + handleNewActiveTab : function TSTBrowser_handleNewActiveTab(aTab, aOptions) + { + if (this.doingCollapseExpand || !aTab) return; + + aOptions = aOptions || {}; + + if (this._handleNewActiveTabTimer) + this.window.clearTimeout(this._handleNewActiveTabTimer); + + /** + * First, we wait until all event listeners for the TabSelect + * event were processed. + */ + this._handleNewActiveTabTimer = this.window.setTimeout(function(aSelf) { + aSelf.window.clearTimeout(aSelf._handleNewActiveTabTimer); + aSelf._handleNewActiveTabTimer = null; + + if (aOptions.canExpandTree) { + if (aOptions.canCollapseTree) + aSelf.collapseExpandTreesIntelligentlyFor(aTab); + else + aSelf.collapseExpandSubtree(aTab, false); + } + }, 0, this); + }, + _handleNewActiveTabTimer : null, handleAdvanceSelectedTab : function TSTBrowser_handleAdvanceSelectedTab(aDir, aWrap) { @@ -5658,22 +5702,6 @@ TreeStyleTabBrowser.prototype = { this.collapseExpandSubtree(aTab, false, aJustNow); }, - collapseExpandTreesIntelligentlyForNewActiveTab : function TSTBrowser_collapseExpandTreesIntelligentlyForNewActiveTab(aTab) - { - if (this.doingCollapseExpand) return; - if (this._cETIFNATTimer) - this.window.clearTimeout(this._cETIFNATTimer); - /** - * First, we wait until all event listeners for the TabSelect - * event were processed. - */ - this._cETIFNATTimer = this.window.setTimeout(function(aSelf) { - aSelf.window.clearTimeout(aSelf._cETIFNATTimer); - aSelf._cETIFNATTimer = null; - aSelf.collapseExpandTreesIntelligentlyFor(aTab); - }, 0, this); - }, - _cETIFNATTimer : null, collapseExpandAllSubtree : function TSTBrowser_collapseExpandAllSubtree(aCollapse, aJustNow) { diff --git a/modules/window.js b/modules/window.js index fb50f4b2..7b3b744e 100644 --- a/modules/window.js +++ b/modules/window.js @@ -322,7 +322,7 @@ TreeStyleTabWindow.prototype = { }, preInitialized : false, - kPREF_VERSION : 7, + kPREF_VERSION : 8, migratePrefs : function TSTWindow_migratePrefs() { // migrate old prefs @@ -413,6 +413,18 @@ TreeStyleTabWindow.prototype = { if (search !== null) this.setTreePref('autoAttach.searchResult', search); } + case 7: + let ( + enabled = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut'), + delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay') + ) { + if (enabled !== null) { + this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut', enabled); + this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers', enabled); + } + if (delay !== null) + this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay', delay); + } default: for (let i = 0, maxi = orientalPrefs.length; i < maxi; i++) { @@ -887,7 +899,7 @@ TreeStyleTabWindow.prototype = { { return !this.ctrlTabPreviewsEnabled && ( - this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut') || + this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut') || this.getTreePref('autoCollapseExpandSubtreeOnSelect') ); }, From 9e8993cfdd3b31bb67459a1b8b679ec310a325dd Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 04:01:13 +0900 Subject: [PATCH 09/12] pref migration should be done by globally at first. --- modules/utils.js | 118 +++++++++++++++++++++++++++++++++++++++++++ modules/window.js | 124 +--------------------------------------------- 2 files changed, 120 insertions(+), 122 deletions(-) diff --git a/modules/utils.js b/modules/utils.js index 928af867..52b13606 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -355,6 +355,7 @@ var TreeStyleTabUtils = { this.isMac = this.XULAppInfo.OS == 'Darwin'; this.applyPlatformDefaultPrefs(); + this.migratePrefs(); this.addPrefListener(this); @@ -411,6 +412,123 @@ var TreeStyleTabUtils = { this.setDefaultPref(key, this.getPref(originalKey)); } }, + kPREF_VERSION : 8, + migratePrefs : function TSTUtils_migratePrefs() + { + // migrate old prefs + var orientalPrefs = []; + switch (this.getTreePref('prefsVersion')) + { + case 0: + orientalPrefs = orientalPrefs.concat([ + 'extensions.treestyletab.tabbar.fixed', + 'extensions.treestyletab.enableSubtreeIndent', + 'extensions.treestyletab.allowSubtreeCollapseExpand' + ]); + case 2: + if (this.getTreePref('urlbar.loadSameDomainToNewChildTab') !== null) { + let value = this.getTreePref('urlbar.loadSameDomainToNewChildTab'); + this.setTreePref('urlbar.loadSameDomainToNewTab', value); + this.setTreePref('urlbar.loadSameDomainToNewTab.asChild', value); + if (value) this.setTreePref('urlbar.loadDifferentDomainToNewTab', value); + this.clearTreePref('urlbar.loadSameDomainToNewChildTab'); + } + case 3: + if (this.getTreePref('loadDroppedLinkToNewChildTab') !== null) { + this.setTreePref('dropLinksOnTab.behavior', + this.getTreePref('loadDroppedLinkToNewChildTab.confirm') ? + this.kDROPLINK_ASK : + this.getTreePref('loadDroppedLinkToNewChildTab') ? + this.kDROPLINK_NEWTAB : + this.kDROPLINK_LOAD + ); + this.clearTreePref('loadDroppedLinkToNewChildTab.confirm'); + this.clearTreePref('loadDroppedLinkToNewChildTab'); + } + if (this.getTreePref('openGroupBookmarkAsTabSubTree') !== null) { + let behavior = 0; + if (this.getTreePref('openGroupBookmarkAsTabSubTree.underParent')) + behavior += this.kGROUP_BOOKMARK_USE_DUMMY; + if (!this.getTreePref('openGroupBookmarkBehavior.confirm')) { + behavior += ( + this.getTreePref('openGroupBookmarkAsTabSubTree') ? + this.kGROUP_BOOKMARK_SUBTREE : + this.getTreePref('browser.tabs.loadFolderAndReplace') ? + this.kGROUP_BOOKMARK_REPLACE : + this.kGROUP_BOOKMARK_SEPARATE + ); + } + this.setTreePref('openGroupBookmark.behavior', behavior); + this.clearTreePref('openGroupBookmarkBehavior.confirm'); + this.clearTreePref('openGroupBookmarkAsTabSubTree'); + this.clearTreePref('openGroupBookmarkAsTabSubTree.underParent'); + this.setPref('browser.tabs.loadFolderAndReplace', !!(behavior & this.kGROUP_BOOKMARK_REPLACE)); + } + case 4: + let (prefs = [ + 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect', + 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove', + 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut', + 'extensions.treestyletab.autoExpandSubTreeOnAppendChild', + 'extensions.treestyletab.autoExpandSubTreeOnCollapsedChildFocused', + 'extensions.treestyletab.collapseExpandSubTree.dblclick', + 'extensions.treestyletab.createSubTree.underParent', + 'extensions.treestyletab.show.context-item-reloadTabSubTree', + 'extensions.treestyletab.show.context-item-removeTabSubTree', + 'extensions.treestyletab.show.context-item-bookmarkTabSubTree', + 'extensions.multipletab.show.multipletab-selection-item-removeTabSubTree', + 'extensions.multipletab.show.multipletab-selection-item-createSubTree' + ]) { + for (let i = 0, maxi = pref.length; i < maxi; i++) + { + let pref = prefs[i]; + let value = this.getPref(pref); + if (value === null) continue; + this.setPref(pref.replace('SubTree', 'Subtree'), value); + this.clearPref(pref); + } + } + case 5: + let (behavior = this.getTreePref('openGroupBookmark.behavior')) { + behavior = behavior | 2048; + this.setTreePref('openGroupBookmark.behavior', behavior); + } + case 6: + let ( + general = this.getTreePref('autoAttachNewTabsAsChildren'), + search = this.getTreePref('autoAttachSearchResultAsChildren') + ) { + if (general !== null) + this.setTreePref('autoAttach', general); + if (search !== null) + this.setTreePref('autoAttach.searchResult', search); + } + case 7: + let ( + enabled = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut'), + delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay') + ) { + if (enabled !== null) { + this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut', enabled); + this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers', enabled); + } + if (delay !== null) + this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay', delay); + } + default: + for (let i = 0, maxi = orientalPrefs.length; i < maxi; i++) + { + let pref = orientalPrefs[i]; + let value = this.getPref(pref); + if (value === null) continue; + this.setPref(pref+'.horizontal', value); + this.setPref(pref+'.vertical', value); + this.clearPref(pref); + } + break; + } + this.setTreePref('prefsVersion', this.kPREF_VERSION); + }, updateAeroPeek : function TSTUtils_updateAeroPeek() { diff --git a/modules/window.js b/modules/window.js index 7b3b744e..e58f8859 100644 --- a/modules/window.js +++ b/modules/window.js @@ -209,7 +209,7 @@ TreeStyleTabWindow.prototype = { return toolbox && toolbox.customizing; }, - get maximized() + get maximized() { var sizemode = this.document.documentElement.getAttribute('sizemode'); return ( @@ -315,131 +315,11 @@ TreeStyleTabWindow.prototype = { w.TreeStyleTabWindowHelper.preInit(); - this.migratePrefs(); - // initialize theme this.onPrefChange('extensions.treestyletab.tabbar.style'); }, preInitialized : false, - - kPREF_VERSION : 8, - migratePrefs : function TSTWindow_migratePrefs() - { - // migrate old prefs - var orientalPrefs = []; - switch (this.getTreePref('prefsVersion')) - { - case 0: - orientalPrefs = orientalPrefs.concat([ - 'extensions.treestyletab.tabbar.fixed', - 'extensions.treestyletab.enableSubtreeIndent', - 'extensions.treestyletab.allowSubtreeCollapseExpand' - ]); - case 2: - if (this.getTreePref('urlbar.loadSameDomainToNewChildTab') !== null) { - let value = this.getTreePref('urlbar.loadSameDomainToNewChildTab'); - this.setTreePref('urlbar.loadSameDomainToNewTab', value); - this.setTreePref('urlbar.loadSameDomainToNewTab.asChild', value); - if (value) this.setTreePref('urlbar.loadDifferentDomainToNewTab', value); - this.clearTreePref('urlbar.loadSameDomainToNewChildTab'); - } - case 3: - if (this.getTreePref('loadDroppedLinkToNewChildTab') !== null) { - this.setTreePref('dropLinksOnTab.behavior', - this.getTreePref('loadDroppedLinkToNewChildTab.confirm') ? - this.kDROPLINK_ASK : - this.getTreePref('loadDroppedLinkToNewChildTab') ? - this.kDROPLINK_NEWTAB : - this.kDROPLINK_LOAD - ); - this.clearTreePref('loadDroppedLinkToNewChildTab.confirm'); - this.clearTreePref('loadDroppedLinkToNewChildTab'); - } - if (this.getTreePref('openGroupBookmarkAsTabSubTree') !== null) { - let behavior = 0; - if (this.getTreePref('openGroupBookmarkAsTabSubTree.underParent')) - behavior += this.kGROUP_BOOKMARK_USE_DUMMY; - if (!this.getTreePref('openGroupBookmarkBehavior.confirm')) { - behavior += ( - this.getTreePref('openGroupBookmarkAsTabSubTree') ? - this.kGROUP_BOOKMARK_SUBTREE : - this.getTreePref('browser.tabs.loadFolderAndReplace') ? - this.kGROUP_BOOKMARK_REPLACE : - this.kGROUP_BOOKMARK_SEPARATE - ); - } - this.setTreePref('openGroupBookmark.behavior', behavior); - this.clearTreePref('openGroupBookmarkBehavior.confirm'); - this.clearTreePref('openGroupBookmarkAsTabSubTree'); - this.clearTreePref('openGroupBookmarkAsTabSubTree.underParent'); - this.setPref('browser.tabs.loadFolderAndReplace', !!(behavior & this.kGROUP_BOOKMARK_REPLACE)); - } - case 4: - let (prefs = [ - 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect', - 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove', - 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut', - 'extensions.treestyletab.autoExpandSubTreeOnAppendChild', - 'extensions.treestyletab.autoExpandSubTreeOnCollapsedChildFocused', - 'extensions.treestyletab.collapseExpandSubTree.dblclick', - 'extensions.treestyletab.createSubTree.underParent', - 'extensions.treestyletab.show.context-item-reloadTabSubTree', - 'extensions.treestyletab.show.context-item-removeTabSubTree', - 'extensions.treestyletab.show.context-item-bookmarkTabSubTree', - 'extensions.multipletab.show.multipletab-selection-item-removeTabSubTree', - 'extensions.multipletab.show.multipletab-selection-item-createSubTree' - ]) { - for (let i = 0, maxi = pref.length; i < maxi; i++) - { - let pref = prefs[i]; - let value = this.getPref(pref); - if (value === null) continue; - this.setPref(pref.replace('SubTree', 'Subtree'), value); - this.clearPref(pref); - } - } - case 5: - let (behavior = this.getTreePref('openGroupBookmark.behavior')) { - behavior = behavior | 2048; - this.setTreePref('openGroupBookmark.behavior', behavior); - } - case 6: - let ( - general = this.getTreePref('autoAttachNewTabsAsChildren'), - search = this.getTreePref('autoAttachSearchResultAsChildren') - ) { - if (general !== null) - this.setTreePref('autoAttach', general); - if (search !== null) - this.setTreePref('autoAttach.searchResult', search); - } - case 7: - let ( - enabled = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut'), - delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay') - ) { - if (enabled !== null) { - this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut', enabled); - this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers', enabled); - } - if (delay !== null) - this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay', delay); - } - default: - for (let i = 0, maxi = orientalPrefs.length; i < maxi; i++) - { - let pref = orientalPrefs[i]; - let value = this.getPref(pref); - if (value === null) continue; - this.setPref(pref+'.horizontal', value); - this.setPref(pref+'.vertical', value); - this.clearPref(pref); - } - break; - } - this.setTreePref('prefsVersion', this.kPREF_VERSION); - }, - + init : function TSTWindow_init() { var w = this.window; From 36fbfa6566a4c73803a5ec2d55a9f9343c72bcde Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 04:07:40 +0900 Subject: [PATCH 10/12] update comment --- defaults/preferences/treestyletab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 3bddf4b2..e7804e5b 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -509,7 +509,7 @@ pref("extensions.treestyletab.autoAttach.goButton", 1); * 0 = Focus to both visible and collapsed tabs. (If a collapsed tab is * focused, the tree will be expanded by another pref "autoExpandSubtreeOnCollapsedChildFocused". * 1 = Focus to visible tabs. Collapsed tabs will be skipped. (But if the tree - * is expanded by "autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut", + * is expanded by "autoExpandSubtreeOnSelect.whileFocusMovingByShortcut", * visible tabs in the tree can be focused.) */ pref("extensions.treestyletab.focusMode", 1); From 1471fbd8da3c9baf0d4c57332eb3cf961db329c9 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 04:47:59 +0900 Subject: [PATCH 11/12] a link dropped onto the last parent tab was wrongly opened as the first child tab even if it should be opened as the last child. --- modules/tabbarDNDObserver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tabbarDNDObserver.js b/modules/tabbarDNDObserver.js index 3f484c7f..449a2ab1 100644 --- a/modules/tabbarDNDObserver.js +++ b/modules/tabbarDNDObserver.js @@ -320,7 +320,7 @@ catch(e) { info.parent = tab; info.insertBefore = sv.getTreePref('insertNewChildAt') == sv.kINSERT_FISRT ? (sv.getFirstChildTab(tab) || visible) : - (sv.getNextSiblingTab(tab) || sv.getNextTab(sv.getLastDescendantTab(tab)) || visible); + (sv.getNextSiblingTab(tab) || sv.getNextTab(sv.getLastDescendantTab(tab))); break; case sv.kDROP_BEFORE: From 9267538830cd872b1890b063ee794ef30fa9b7b4 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 10 Feb 2012 04:59:37 +0900 Subject: [PATCH 12/12] version up --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index bd03288f..86ac0756 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@