aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNiklas Baumstark2012-01-22 22:10:31 +0100
committerNiklas Baumstark2012-04-10 23:54:37 +0200
commit2c5b91634f7748e70730265c0fe7bb54d91fd213 (patch)
tree754ada1190f74e68cd82896f70df6159857c7751 /lib
parent469147824fd2fb8d83d16a28f3d3c613e69b4573 (diff)
downloadvimium-2c5b91634f7748e70730265c0fe7bb54d91fd213.tar.bz2
use background page to open URLs
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. */