diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index 404da3a9..2d9b45dd 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -230,7 +230,6 @@ TreeStyleTabService.overrideExtensions = function() { window.TM_BrowserHome.toSource().replace( /(var bgLoad = )/, <> @@ -238,27 +237,15 @@ TreeStyleTabService.overrideExtensions = function() { /(\})(\)?)$/, <> ) ); - eval('window.TMP_BrowserOpenTab = '+ - window.TMP_BrowserOpenTab.toSource().replace( - /(var newTab = )/, - 'gBrowser.__treestyletab__internallyTabMoving = true; $1' - ).replace( - /(content.focus\(\))/, - 'gBrowser.__treestyletab__internallyTabMoving = false; $1' - ) - ); - eval('window.TMP_openURL = '+ window.TMP_openURL.toSource().replace( /(var firstTab = [^\(]+\([^\)]+\))/, <> @@ -266,7 +253,6 @@ TreeStyleTabService.overrideExtensions = function() { /(anyBrowser.mTabContainer.nextTab)/, <> ) @@ -284,12 +270,6 @@ TreeStyleTabService.overrideExtensions = function() { eval('TMP_Bookmark.openGroup = '+ TMP_Bookmark.openGroup.toSource().replace( - /(var tabToSelect = null;)/, - <> - ).replace( 'index = prevTab._tPos + 1;', <> ) ); @@ -326,9 +305,33 @@ TreeStyleTabService.overrideExtensions = function() { ) ); + eval('gBrowser.TMP_openTabNext = '+ + gBrowser.TMP_openTabNext.toSource().replace( + '{', + '{ var tabs = TreeStyleTabService.getDescendantTabs(TreeStyleTabService.getRootTab(this.mCurrentTab));' + ).replace( + /((this.mCurrentTab._tPos)( \+ this.mTabContainer.nextTab))/, + '((tabs.length ? tabs[tabs.length-1]._tPos : $2 )$3)' + ) + ); + + eval('gBrowser.TMmoveTabTo = '+ + gBrowser.TMmoveTabTo.toSource().replace( + /(aTab.dispatchEvent)/, + 'this.__treestyletab__internallyTabMoving = true; $1' + ).replace( + /(return aTab;\})(\)?)$/, + 'this.__treestyletab__internallyTabMoving = false; $1$2' + ) + ); + window.BrowserHome = window.TM_BrowserHome; window.BrowserOpenTab = window.TMP_BrowserOpenTab; + + gBrowser.__treestyletab__internallyTabMoving = false; }, 0); + + gBrowser.__treestyletab__internallyTabMoving = true; // until "TMmoveTabTo" method is overwritten } }; diff --git a/install.rdf b/install.rdf index d9654797..ae887ab0 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@