Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit 7109d5a

Browse files
committed
Merge pull request #266 from my-password-is-password/patch-2
Changed ����gotoExtensionURL to work with '#'
2 parents 1ec3dcc + 8bb3c79 commit 7109d5a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

js/async.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,19 @@ function gotoExtensionURL(url) {
146146
// to the right of the active tab
147147
chrome.tabs.query({ active: true }, function(tabs) {
148148
var index = tabs.length ? tabs[0].index : 9999;
149-
chrome.tabs.query({ url: url }, function(tabs) {
150-
// Activate found matching tab
151-
if ( tabs.length ) {
152-
// Commented out as per:
153-
// https://github.com/gorhill/httpswitchboard/issues/150#issuecomment-32683726
154-
// chrome.tabs.move(tabs[0].id, { index: index + 1 });
155-
chrome.tabs.update(tabs[0].id, { active: true });
156-
}
157-
// If it doesn't exist, create new tab
158-
else {
159-
chrome.tabs.create({ 'url': url, index: index + 1 });
149+
chrome.tabs.query({ currentWindow: true }, function(tabs) {
150+
var i = tabs.length;
151+
while ( i-- ) {
152+
if ( tabs[i].url === url ) {
153+
// Activate found matching tab
154+
// Commented out as per:
155+
// https://github.com/gorhill/httpswitchboard/issues/150#issuecomment-32683726
156+
// chrome.tabs.move(tabs[0].id, { index: index + 1 });
157+
chrome.tabs.update(tabs[i].id, { active: true });
158+
return;
159+
}
160160
}
161+
chrome.tabs.create({ 'url': url, index: index + 1 });
161162
});
162163
});
163164
}

0 commit comments

Comments
 (0)