diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js new file mode 100644 index 00000000..8934c12b --- /dev/null +++ b/content/treestyletab/hacks.js @@ -0,0 +1,146 @@ +TreeStyleTabService.overrideExtensions = function() { + if ('MultipleTabService' in window) { + eval('MultipleTabService.showHideMenuItems = '+ + MultipleTabService.showHideMenuItems.toSource().replace( + /var separators = /, + <> + ) + ); + } + + if ('autoHIDE' in window) { + eval('autoHIDE.ShowMenu = '+ + autoHIDE.ShowMenu.toSource().replace( + '{', + '{ var treeStyleTabPos = TreeStyleTabService.getPref("extensions.treestyletab.tabbar.position");' + ).replace( + 'e.screenY <= autoHIDE.Win.boxObject.screenY + autoHIDE.space', + <>= autoHIDE.Win.boxObject.screenX + autoHIDE.Win.boxObject.width - autoHIDE.space) : + treeStyleTabPos == 'bottom' ? + (e.screenY >= autoHIDE.Win.boxObject.screenY + autoHIDE.Win.boxObject.height - autoHIDE.space) : + false + ))]]> + ).replace( + 'e.screenY > getBrowser().mCurrentBrowser.boxObject.screenY + 25', + <> getBrowser().mCurrentBrowser.boxObject.screenY + 25 && + ( + treeStyleTabPos == 'left' ? + (e.screenX > getBrowser().mCurrentBrowser.boxObject.screenX + 25) : + treeStyleTabPos == 'right' ? + (e.screenX < getBrowser().mCurrentBrowser.boxObject.screenX + getBrowser().mCurrentBrowser.boxObject.width - 25) : + treeStyleTabPos == 'bottom' ? + (e.screenY < getBrowser().mCurrentBrowser.boxObject.screenY + getBrowser().mCurrentBrowser.boxObject.height - 25) : + true + ))]]> + ) + ); + eval('autoHIDE.HideToolbar = '+ + autoHIDE.HideToolbar.toSource().replace( + 'if (this.Show) {', + <> + ) + ); + eval('autoHIDE.EndFull = '+ + autoHIDE.EndFull.toSource().replace( + '{', + <> + ) + ); + eval('autoHIDE.SetMenu = '+ + autoHIDE.SetMenu.toSource().replace( + '{', + <> + ) + ); + eval('autoHIDE.MoveC = '+ + autoHIDE.MoveC.toSource().replace( + '{', + <> + ).replace( + '.move(0, - this.delta)', + '.move((treeStyleTabPos == "left" ? -this.__treestyletab__tabBarWidth : 0 ), -this.delta)' + ) + ); + } +}; diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 3a3ddf54..bb54c8c6 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -305,7 +305,7 @@ var TreeStyleTabService = { this.observe(null, 'nsPref:changed', 'extensions.treestyletab.levelMargin'); this.overrideGlobalFunctions(); - this.overrideExtensions(); + this.overrideExtensions(); // hacks.js this.initTabBrowser(gBrowser); }, @@ -776,155 +776,7 @@ catch(e) { ) ); }, - - overrideExtensions : function() - { - if ('MultipleTabService' in window) { - eval('MultipleTabService.showHideMenuItems = '+ - MultipleTabService.showHideMenuItems.toSource().replace( - /var separators = /, - <> - ) - ); - } - - if ('autoHIDE' in window) { - eval('autoHIDE.ShowMenu = '+ - autoHIDE.ShowMenu.toSource().replace( - '{', - '{ var treeStyleTabPos = TreeStyleTabService.getPref("extensions.treestyletab.tabbar.position");' - ).replace( - 'e.screenY <= autoHIDE.Win.boxObject.screenY + autoHIDE.space', - <>= autoHIDE.Win.boxObject.screenX + autoHIDE.Win.boxObject.width - autoHIDE.space) : - treeStyleTabPos == 'bottom' ? - (e.screenY >= autoHIDE.Win.boxObject.screenY + autoHIDE.Win.boxObject.height - autoHIDE.space) : - false - ))]]> - ).replace( - 'e.screenY > getBrowser().mCurrentBrowser.boxObject.screenY + 25', - <> getBrowser().mCurrentBrowser.boxObject.screenY + 25 && - ( - treeStyleTabPos == 'left' ? - (e.screenX > getBrowser().mCurrentBrowser.boxObject.screenX + 25) : - treeStyleTabPos == 'right' ? - (e.screenX < getBrowser().mCurrentBrowser.boxObject.screenX + getBrowser().mCurrentBrowser.boxObject.width - 25) : - treeStyleTabPos == 'bottom' ? - (e.screenY < getBrowser().mCurrentBrowser.boxObject.screenY + getBrowser().mCurrentBrowser.boxObject.height - 25) : - true - ))]]> - ) - ); - eval('autoHIDE.HideToolbar = '+ - autoHIDE.HideToolbar.toSource().replace( - 'if (this.Show) {', - <> - ) - ); - eval('autoHIDE.EndFull = '+ - autoHIDE.EndFull.toSource().replace( - '{', - <> - ) - ); - eval('autoHIDE.SetMenu = '+ - autoHIDE.SetMenu.toSource().replace( - '{', - <> - ) - ); - eval('autoHIDE.MoveC = '+ - autoHIDE.MoveC.toSource().replace( - '{', - <> - ).replace( - '.move(0, - this.delta)', - '.move((treeStyleTabPos == "left" ? -this.__treestyletab__tabBarWidth : 0 ), -this.delta)' - ) - ); - } - }, - + destroy : function() { this.destroyTabBrowser(gBrowser); diff --git a/content/treestyletab/treestyletab.xul b/content/treestyletab/treestyletab.xul index d4501af8..46b3c781 100644 --- a/content/treestyletab/treestyletab.xul +++ b/content/treestyletab/treestyletab.xul @@ -7,6 +7,7 @@ xmlns:html="http://www.w3.org/1999/xhtml">