diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 6a0fce3b..dc7e56d1 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -141,7 +141,7 @@ var TreeStyleTabService = { return ownerBrowser.__treestyletab__readyToAttachNewTab || ownerBrowser.__treestyletab__readyToAttachNewTabGroup ? true : false ; }, - checkReadyToOpenNewChildTab : function(aInfo) + checkReadyToOpenNewTab : function(aInfo) { /* ̐ @@ -184,29 +184,40 @@ var TreeStyleTabService = { var b = this.getTabBrowserFromFrame(frame); var nextTab = this.getNextSiblingTab(currentTab); - return ( - ( - internal.newTab && - currentHost == targetHost && - currentURI != 'about:blank' && - currentURI.split('#')[0] != info.uri.split('#')[0] && - (this.readyToOpenChildTab( - (parentHost == targetHost && !internal.forceChild ? parentTab : frame), - false, - (parentHost == targetHost && !internal.forceChild && ( - this.getTabById(currentTab.__treestyletab__next, b) || - (nextTab ? (currentTab.__treestyletab__next = nextTab.getAttribute(this.kID), nextTab) : null ) - )) - ), - true) - ) || - ( - external.newTab && - currentHost != targetHost && - currentURI != 'about:blank' && - (external.forceChild ? (this.readyToOpenChildTab(frame), true) : true ) - ) - ); + var openTab = false; + var parent = null; + var insertBefore = null; + + if (info.modifier) openTab = true; + + if ( + internal.newTab && + currentHost == targetHost && + currentURI != 'about:blank' && + currentURI.split('#')[0] != info.uri.split('#')[0] + ) { + openTab = info.modifier && info.invert ? !openTab : true ; + parent = parentHost == targetHost && !internal.forceChild ? parentTab : frame ; + insertBefore = parentHost == targetHost && !internal.forceChild && ( + this.getTabById(currentTab.__treestyletab__next, b) || + (nextTab ? (currentTab.__treestyletab__next = nextTab.getAttribute(this.kID), nextTab) : null ) + ); + } + else if ( + external.newTab && + currentHost != targetHost && + currentURI != 'about:blank' + ) { + openTab = info.modifier && info.invert ? !openTab : true ; + if (external.forceChild) { + parent = frame; + } + } + + if (openTab && parent) { + this.readyToOpenChildTab(parent, false, insertBefore); + } + return openTab; }, /* Utilities */ @@ -827,22 +838,13 @@ catch(e) { window.BrowserLoadURL.toSource().replace( 'aTriggeringEvent && aTriggeringEvent.altKey', <> ) ); @@ -906,32 +908,22 @@ catch(e) { ).replace( /(event.ctrlKey|event.metaKey)/, <> ).replace( 'return false;case 1:', <>