aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/completion.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/completion.js b/lib/completion.js
index 67d8b219..d0e9e32a 100644
--- a/lib/completion.js
+++ b/lib/completion.js
@@ -170,10 +170,20 @@ var completion = (function() {
/** Creates an action that opens :url in the current tab by default or in a new tab as an alternative. */
function createActionOpenUrl(url) {
- return [
- function() { window.location = url; },
- function() { window.open(url); },
- ]
+ var open = function(newTab, selected) {
+ return function() {
+ chrome.extension.sendRequest({
+ handler: newTab ? "openUrlInNewTab" : "openUrlInCurrentTab",
+ url: url,
+ selected: selected
+ });
+ }
+ }
+
+ if (url.indexOf("javascript:") == 0)
+ return [ open(false), open(false), open(false) ];
+ else
+ return [ open(false), open(true, true), open(true, false) ];
}
/** Creates a completion that renders by marking fuzzy-matched parts. */