From c21df996cb0ae787b04bd6f749dc32c109c6f6c2 Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Wed, 25 May 2011 13:45:15 +0900 Subject: [PATCH] =?UTF-8?q?with=20Locationbar2=20(=20https://addons.mozill?= =?UTF-8?q?a.org/firefox/addon/locationbar=C2=B2/=20),=20new=20tabs=20from?= =?UTF-8?q?=20path=20segments=20should=20be=20opened=20as=20child=20tabs?= =?UTF-8?q?=20of=20the=20current=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/treestyletab/hacks.js | 51 +++++++++++++++++++++++ defaults/preferences/treestyletab.js | 61 ++++++++++++++-------------- 2 files changed, 82 insertions(+), 30 deletions(-) diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index 7b831e77..f1ae3f6f 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -1041,6 +1041,57 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function TSTService_override ); } + // Locationbar2 + // https://addons.mozilla.org/firefox/addon/locationbarĀ²/ + if ('lb2_alternateStyles' in window && + this.getTreePref('compatibility.Locationbar2')) { + let sv = this; + let listening = false; + let listener = function(aEvent) { + switch (aEvent.type) + { + case 'unload': + window.removeEventListener('unload', listener, false); + window.removeEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false); + window.removeEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false); + case sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION: + if (gURLBar && listening) + gURLBar.removeEventListener('click', listener, true); + listening = false; + return; + + case sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION: + if (gURLBar && !listening) { + gURLBar.addEventListener('click', listener, true); + listening = true; + } + return; + + case 'click': + if (sv.evaluateXPath( + 'ancestor-or-self::*[' + +'contains(concat(" ", normalize-space(@class), " "), " textbox-presentation-segment ")' + +']', + aEvent.originalTarget, + Ci.nsIDOMXPathResult.BOOLEAN_TYPE + ).booleanValue) { + sv.readyToOpenChildTab(gBrowser.selectedTab); + sv.Deferred.next(function() { + // clear with delay, because this action can be ignored by othere reasons. + sv.stopToOpenChildTab(gBrowser.selectedTab); + }); + } + return; + } + }; + window.addEventListener('unload', listener, false); + window.addEventListener(this.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false); + window.addEventListener(this.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false); + if (gURLBar && !listening) { + gURLBar.addEventListener('click', listener, true); + listening = true; + } + } window.setTimeout(function(aSelf) { aSelf.overrideExtensionsDelayed(); diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 496040ca..03471a61 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -562,44 +562,45 @@ pref("extensions.treestyletab.createSubtree.underParent", true); * In other words, add-on authros can disable TST's dirty hack if it is * obsolete. */ -pref("extensions.treestyletab.compatibility.Highlander", true); -pref("extensions.treestyletab.compatibility.PermaTabs", true); -pref("extensions.treestyletab.compatibility.TMP", true); // Tab Mix Plus -pref("extensions.treestyletab.compatibility.SessionManager", true); -pref("extensions.treestyletab.compatibility.FullerScreen", true); -pref("extensions.treestyletab.compatibility.TooManyTabs", true); -pref("extensions.treestyletab.compatibility.DragNDropToolbars", true); -pref("extensions.treestyletab.compatibility.OptimozTweaks", true); -pref("extensions.treestyletab.compatibility.Tabberwocky", true); -pref("extensions.treestyletab.compatibility.SelectionLinks", true); -pref("extensions.treestyletab.compatibility.SuperDragAndGo", true); -pref("extensions.treestyletab.compatibility.DragDeGo", true); +pref("extensions.treestyletab.compatibility.AgingTabs", true); +pref("extensions.treestyletab.compatibility.Autohide", true); pref("extensions.treestyletab.compatibility.ColorfulTabs", true); +pref("extensions.treestyletab.compatibility.DomainTab", true); +pref("extensions.treestyletab.compatibility.DragDeGo", true); +pref("extensions.treestyletab.compatibility.DragNDropToolbars", true); +pref("extensions.treestyletab.compatibility.FirefoxSync", true); +pref("extensions.treestyletab.compatibility.FireGestures", true); pref("extensions.treestyletab.compatibility.FLST", true); pref("extensions.treestyletab.compatibility.FocusLastSelectedTab", true); -pref("extensions.treestyletab.compatibility.LastTab", true); -pref("extensions.treestyletab.compatibility.FireGestures", true); -pref("extensions.treestyletab.compatibility.MouseGesturesRedox", true); -pref("extensions.treestyletab.compatibility.Greasemonkey", true); -pref("extensions.treestyletab.compatibility.SBMCounter", true); -pref("extensions.treestyletab.compatibility.AgingTabs", true); -pref("extensions.treestyletab.compatibility.SnapLinks", true); -pref("extensions.treestyletab.compatibility.MouselessBrowsing", true); -pref("extensions.treestyletab.compatibility.Linky", true); -pref("extensions.treestyletab.compatibility.QuickDrag", true); -pref("extensions.treestyletab.compatibility.Autohide", true); +pref("extensions.treestyletab.compatibility.FullerScreen", true); pref("extensions.treestyletab.compatibility.GoogleToolbar.Sidewiki", true); -pref("extensions.treestyletab.compatibility.SmoothlyCloseTabs", true); -pref("extensions.treestyletab.compatibility.STM", true); // Super Tab Mode -pref("extensions.treestyletab.compatibility.STM.warnForNewTabPosition", true); -pref("extensions.treestyletab.compatibility.TabUtilities", true); -pref("extensions.treestyletab.compatibility.RemoveNewTabButton", true); +pref("extensions.treestyletab.compatibility.Greasemonkey", true); +pref("extensions.treestyletab.compatibility.Highlander", true); pref("extensions.treestyletab.compatibility.IETabPlus", true); +pref("extensions.treestyletab.compatibility.LastTab", true); +pref("extensions.treestyletab.compatibility.Linky", true); +pref("extensions.treestyletab.compatibility.Locationbar2", true); +pref("extensions.treestyletab.compatibility.MouseGesturesRedox", true); +pref("extensions.treestyletab.compatibility.MouselessBrowsing", true); pref("extensions.treestyletab.compatibility.MultiLinks", true); -pref("extensions.treestyletab.compatibility.DomainTab", true); +pref("extensions.treestyletab.compatibility.OptimozTweaks", true); +pref("extensions.treestyletab.compatibility.PermaTabs", true); pref("extensions.treestyletab.compatibility.PersonalTitlebar", true); +pref("extensions.treestyletab.compatibility.QuickDrag", true); +pref("extensions.treestyletab.compatibility.RemoveNewTabButton", true); +pref("extensions.treestyletab.compatibility.SBMCounter", true); +pref("extensions.treestyletab.compatibility.SelectionLinks", true); +pref("extensions.treestyletab.compatibility.SessionManager", true); +pref("extensions.treestyletab.compatibility.SmoothlyCloseTabs", true); +pref("extensions.treestyletab.compatibility.SnapLinks", true); +pref("extensions.treestyletab.compatibility.STM.warnForNewTabPosition", true); +pref("extensions.treestyletab.compatibility.STM", true); // Super Tab Mode +pref("extensions.treestyletab.compatibility.SuperDragAndGo", true); +pref("extensions.treestyletab.compatibility.Tabberwocky", true); +pref("extensions.treestyletab.compatibility.TabUtilities", true); +pref("extensions.treestyletab.compatibility.TMP", true); // Tab Mix Plus +pref("extensions.treestyletab.compatibility.TooManyTabs", true); pref("extensions.treestyletab.compatibility.TotalToolbar", true); -pref("extensions.treestyletab.compatibility.FirefoxSync", true); /** * The internal version of TST preferences. Don't change this by hand, because