From 67abd209027d7150e104cab8004a3b924f6053d8 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Thu, 5 Mar 2015 06:32:39 +0000 Subject: Tidy up #1507. --- background_scripts/main.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index aa46dec0..a217ad91 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -164,9 +164,13 @@ openUrlInCurrentTab = (request) -> # Opens request.url in new tab and switches to it if request.selected is true. # openUrlInNewTab = (request, callback) -> - chrome.tabs.getSelected(null, (tab) -> - chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true, windowId: tab.windowId }, - (tab) -> callback())) + chrome.tabs.getSelected null, (tab) -> + tabConfig = + url: Utils.convertToUrl request.url + index: tab.index + 1 + selected: true + windowId: tab.windowId + chrome.tabs.create tabConfig, callback openUrlInIncognito = (request) -> chrome.windows.create({ url: Utils.convertToUrl(request.url), incognito: true}) @@ -232,7 +236,7 @@ moveTab = (callback, direction) -> # These are commands which are bound to keystroke which must be handled by the background page. They are # mapped in commands.coffee. BackgroundCommands = - createTab: (callback) -> openUrlInNewTab({ url: Settings.get("newTabUrl") }, (tab) -> callback()) + createTab: (callback) -> openUrlInNewTab { url: Settings.get("newTabUrl") }, callback duplicateTab: (callback) -> chrome.tabs.getSelected(null, (tab) -> chrome.tabs.duplicate(tab.id) -- cgit v1.2.3