diff options
| author | Phil Crosby | 2012-05-05 15:40:35 -0700 |
|---|---|---|
| committer | Phil Crosby | 2012-05-05 18:32:13 -0700 |
| commit | 5f946f23d453bcde40a0de2dc7f83db3fb0bf723 (patch) | |
| tree | 3623afd31f32b11220f3a65a70f0db0252af9b81 /fuzzyMode.js | |
| parent | 8bbdcd53d87f3504853405d6e20c11759666e487 (diff) | |
| download | vimium-5f946f23d453bcde40a0de2dc7f83db3fb0bf723.tar.bz2 | |
Move createActionOpenUrl and company to the frontend page. Stop requiring completion.js from the frontend
Diffstat (limited to 'fuzzyMode.js')
| -rw-r--r-- | fuzzyMode.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/fuzzyMode.js b/fuzzyMode.js index 2d53431e..f7514276 100644 --- a/fuzzyMode.js +++ b/fuzzyMode.js @@ -195,6 +195,33 @@ var fuzzyMode = (function() { } }); + /** Creates an action that opens :url in the current tab by default or in a new tab as an alternative. */ + function createActionOpenUrl(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) ]; + } + + /** Returns an action that switches to the tab with the given :id. */ + function createActionSwitchToTab(id) { + var open = function() { + chrome.extension.sendRequest({ handler: 'selectSpecificTab', id: id }); + } + return [open, open, open]; + } + + // public interface return { activateAll: function() { start("omni", false, 100); }, |
