aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/main.coffee
diff options
context:
space:
mode:
authorStephen Blott2017-09-25 10:53:33 +0100
committerGitHub2017-09-25 10:53:33 +0100
commitf0c90f39b463593b6f2d6c71a938f7dc9d93b345 (patch)
tree89b359d6dfb28c0f6484bfbb76cbe5109338d39b /background_scripts/main.coffee
parent4099067f7c03551bea20b6cf6504e4c15d6e7506 (diff)
parent92d2b4058a378c276d52ecc53409603679c3865c (diff)
downloadvimium-f0c90f39b463593b6f2d6c71a938f7dc9d93b345.tar.bz2
Merge pull request #2602 from mrmr1993/ff-link-hints-new-tabs
Firefox: Simulate default action for clicking links with link hints
Diffstat (limited to 'background_scripts/main.coffee')
-rw-r--r--background_scripts/main.coffee12
1 files changed, 12 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 379239ae..8afecd4f 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -106,6 +106,7 @@ TabOperations =
index: request.tab.index + 1
active: true
windowId: request.tab.windowId
+ tabConfig.active = request.active if request.active?
# Firefox does not support "about:newtab" in chrome.tabs.create.
delete tabConfig["url"] if tabConfig["url"] == Settings.defaults.newTabUrl
chrome.tabs.create tabConfig, (tab) ->
@@ -116,6 +117,16 @@ TabOperations =
catch
callback.apply this, arguments
+ # Opens request.url in new window and switches to it.
+ openUrlInNewWindow: (request, callback = (->)) ->
+ winConfig =
+ url: Utils.convertToUrl request.url
+ active: true
+ winConfig.active = request.active if request.active?
+ # Firefox does not support "about:newtab" in chrome.tabs.create.
+ delete tabConfig["url"] if tabConfig["url"] == Settings.defaults.newTabUrl
+ chrome.windows.create winConfig, callback
+
toggleMuteTab = do ->
muteTab = (tab) -> chrome.tabs.update tab.id, {muted: !tab.mutedInfo.muted}
@@ -415,6 +426,7 @@ sendRequestHandlers =
# with Chrome-specific URLs like "view-source:http:..".
getCurrentTabUrl: ({tab}) -> tab.url
openUrlInNewTab: (request) -> TabOperations.openUrlInNewTab request
+ openUrlInNewWindow: (request) -> TabOperations.openUrlInNewWindow request
openUrlInIncognito: (request) -> chrome.windows.create incognito: true, url: Utils.convertToUrl request.url
openUrlInCurrentTab: TabOperations.openUrlInCurrentTab
openOptionsPageInNewTab: (request) ->