diff --git a/content/treestyletab/config.xul b/content/treestyletab/config.xul index fe71f680..95553043 100644 --- a/content/treestyletab/config.xul +++ b/content/treestyletab/config.xul @@ -15,24 +15,24 @@ - - + - - - - + + + diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index c682c387..02dc0b91 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -4,7 +4,7 @@ var TreeStyleTabService = { kID : 'treestyletab-id', kCHILDREN : 'treestyletab-children', - levelMargin : 16, + levelMargin : 12, NSResolver : { lookupNamespaceURI : function(aPrefix) @@ -78,8 +78,26 @@ var TreeStyleTabService = { return (target.localName == 'tab') ? target : null ; }, + getTabFromFrame : function(aFrame, aTabBrowser) + { + var b = aTabBrowser || this.browser; + var docShell = aFrame.top + .QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIWebNavigation) + .QueryInterface(Components.interfaces.nsIDocShell); + var tabs = b.mTabContainer.childNodes; + for (var i = 0, maxi = tabs.length; i < maxi; i++) + { + if (tabs[i].linkedBrowser.docShell == docShell) + return tabs[i]; + } + return null; + }, + getTabBrowserFromChildren : function(aTab) { + if (!aTab) return null; + if (aTab.__treestyletab__linkedTabBrowser) return aTab.__treestyletab__linkedTabBrowser; @@ -180,6 +198,27 @@ var TreeStyleTabService = { this.addPrefListener(this); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.'); + + eval('window.nsBrowserAccess.prototype.openURI = '+ + window.nsBrowserAccess.prototype.openURI.toSource().replace( + /switch\s*\(aWhere\)/, + <> + ) + ); + window.QueryInterface(Components.interfaces.nsIDOMChromeWindow).browserDOMWindow = null; + window.QueryInterface(Components.interfaces.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess(); + + this.initTabBrowser(gBrowser); }, @@ -261,6 +300,8 @@ var TreeStyleTabService = { this.destroyTabBrowser(gBrowser); window.removeEventListener('unload', this, false); + + var appcontent = document.getElementById('appcontent'); appcontent.removeEventListener('SubBrowserAdded', this, false); appcontent.removeEventListener('SubBrowserRemoveRequest', this, false); diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 28323fa7..27a80b6c 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -1,2 +1,5 @@ +pref("browser.link.open_newwindow.restriction", 0); + + pref("extensions.treestyletab@piro.sakura.ne.jp.name", "chrome://treestyletab/locale/treestyletab.properties"); pref("extensions.treestyletab@piro.sakura.ne.jp.description", "chrome://treestyletab/locale/treestyletab.properties"); diff --git a/locale/en-US/treestyletab/treestyletab.dtd b/locale/en-US/treestyletab/treestyletab.dtd index 6a9e577b..a1c4a2a5 100644 --- a/locale/en-US/treestyletab/treestyletab.dtd +++ b/locale/en-US/treestyletab/treestyletab.dtd @@ -2,3 +2,7 @@ + + + + diff --git a/locale/ja/treestyletab/treestyletab.dtd b/locale/ja/treestyletab/treestyletab.dtd index 01b9ae62..1764b3b9 100644 --- a/locale/ja/treestyletab/treestyletab.dtd +++ b/locale/ja/treestyletab/treestyletab.dtd @@ -1,3 +1,7 @@ + + + +