From 7fa22da6954d28dbd578b0cd490ada638d98b373 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Thu, 21 Sep 2017 21:46:39 +0100 Subject: Add openUrlInNewWindow command --- background_scripts/main.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index eeda263a..8afecd4f 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -117,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} @@ -416,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) -> -- cgit v1.2.3