From a59875bbfd8182c64f3e1673ec1546b751e462b5 Mon Sep 17 00:00:00 2001 From: Julian Naydichev Date: Tue, 28 Dec 2010 20:13:53 -0800 Subject: Made is so that viewing source opens in the next tab, instead of replacing the current tab. --- background_page.html | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'background_page.html') diff --git a/background_page.html b/background_page.html index 264cf299..29dce3c7 100644 --- a/background_page.html +++ b/background_page.html @@ -70,6 +70,7 @@ var sendRequestHandlers = { getCompletionKeys: getCompletionKeys, getLinkHintCss: getLinkHintCss, + toggleViewSourceNewTab: toggleViewSourceNewTab, openUrlInCurrentTab: openUrlInCurrentTab, openOptionsPageInNewTab: openOptionsPageInNewTab, registerFrame: registerFrame, @@ -237,6 +238,14 @@ }); } + /** toggleViewSourceNewTab, opens source in new tab and switches to it + * + */ + function toggleViewSourceNewTab(request) { + chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({ url: request.url, index: tab.index + 1, selected: true }); + }); + } /* * Returns the core CSS used for link hints, along with any user-provided overrides. */ -- cgit v1.2.3 From 2c841be3e87e3fa14d9c4302c15854d2cb71fc5d Mon Sep 17 00:00:00 2001 From: Julian Naydichev Date: Wed, 29 Dec 2010 10:18:46 -0800 Subject: Changing function name, and parameters per Ilya's suggestion. --- background_page.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'background_page.html') diff --git a/background_page.html b/background_page.html index 29dce3c7..9f5c09a5 100644 --- a/background_page.html +++ b/background_page.html @@ -70,7 +70,7 @@ var sendRequestHandlers = { getCompletionKeys: getCompletionKeys, getLinkHintCss: getLinkHintCss, - toggleViewSourceNewTab: toggleViewSourceNewTab, + openUrlInNewTab: openUrlInNewTab, openUrlInCurrentTab: openUrlInCurrentTab, openOptionsPageInNewTab: openOptionsPageInNewTab, registerFrame: registerFrame, @@ -238,12 +238,12 @@ }); } - /** toggleViewSourceNewTab, opens source in new tab and switches to it + /** openUrlInNewTab, opens source in new tab and switches to it * */ - function toggleViewSourceNewTab(request) { + function openUrlInNewTab(request) { chrome.tabs.getSelected(null, function(tab) { - chrome.tabs.create({ url: request.url, index: tab.index + 1, selected: true }); + chrome.tabs.create({ url: request.url, index: tab.index + 1, selected: request.selected }); }); } /* -- cgit v1.2.3 From fdc320339e8cbdf978fe2259f247eec2e182a65f Mon Sep 17 00:00:00 2001 From: Ilya Sukhar Date: Thu, 30 Dec 2010 17:58:06 -0800 Subject: A little cleanup. --- background_page.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'background_page.html') diff --git a/background_page.html b/background_page.html index 9f5c09a5..ac83a0c3 100644 --- a/background_page.html +++ b/background_page.html @@ -238,7 +238,8 @@ }); } - /** openUrlInNewTab, opens source in new tab and switches to it + /** + * Opens request.url in new tab and switches to it if request.selected is true. * */ function openUrlInNewTab(request) { -- cgit v1.2.3