From c93270dff61daae5f22965b2b3188de81104bdb3 Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Mon, 2 Mar 2015 01:53:24 +0900 Subject: [PATCH] Better compatibility with Duplicate in Tab Context Menu addon #835 https://addons.mozilla.org/firefox/duplicate-in-tab-context-menu/ --- content/treestyletab/windowHelperHacks.js | 14 ++++++++++++++ defaults/preferences/treestyletab.js | 1 + 2 files changed, 15 insertions(+) diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js index b70c6630..167de96c 100644 --- a/content/treestyletab/windowHelperHacks.js +++ b/content/treestyletab/windowHelperHacks.js @@ -352,6 +352,20 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte dump(e+'\n'); } } + + // Duplicate in Tab Context Menu + // https://addons.mozilla.org/firefox/duplicate-in-tab-context-menu/ + if (TreeStyleTabUtils.getTreePref('compatibility.DuplicateInTabContext') && + 'SchuzakJp' in window && + 'DuplicateInTabContext' in SchuzakJp && + typeof SchuzakJp.DuplicateInTabContext.Duplicate == 'function') { + TreeStyleTabUtils.doPatching(SchuzakJp.DuplicateInTabContext.Duplicate, 'SchuzakJp.DuplicateInTabContext.Duplicate', function(aName, aSource) { + return eval(aName+' = '+aSource.replace( + '{', + '{ gBrowser.treeStyleTab.onBeforeTabDuplicate(oriTab); ' + )); + }, 'treeStyleTab'); + } }; TreeStyleTabWindowHelper.overrideExtensionsBeforeBrowserInit = function TSTWH_overrideExtensionsBeforeBrowserInit() { diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 53c77598..a4b81f93 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -652,6 +652,7 @@ pref("extensions.treestyletab.compatibility.DomainTab", true); pref("extensions.treestyletab.compatibility.DragDeGo", true); pref("extensions.treestyletab.compatibility.DragIt", true); pref("extensions.treestyletab.compatibility.DragNDropToolbars", true); +pref("extensions.treestyletab.compatibility.DuplicateInTabContext", true); pref("extensions.treestyletab.compatibility.DuplicateThisTab", true); pref("extensions.treestyletab.compatibility.FirefoxSync", true); pref("extensions.treestyletab.compatibility.FireGestures", true);