diff options
| author | Stephen Blott | 2015-05-29 10:58:34 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-05-29 11:46:02 +0100 | 
| commit | 087f7e8d180c9048ee32bdb243eabe2c15021fc7 (patch) | |
| tree | e4241d450120b25b38b6f535402dadc1eb23fb48 | |
| parent | bd3cf0386a88d5878ee352c4d0c80005eaf2a93a (diff) | |
| download | vimium-087f7e8d180c9048ee32bdb243eabe2c15021fc7.tar.bz2 | |
Implement pre-population of custom-search keywords.
Now, a mapping of the form:
   map s vomnibar.activate keyword=g
makes the vomnibar open (on "s") with the Google custom-search engine
activated immediately (assuming it's configured).
The corresponding custom search-engine configuration would be:
   g: http://www.google.com/search?q=%s Google
| -rw-r--r-- | content_scripts/vomnibar.coffee | 20 | 
1 files changed, 14 insertions, 6 deletions
| diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 2529c077..76698634 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -4,14 +4,22 @@  Vomnibar =    vomnibarUI: null +  getOptions: (registryEntry = { extras: [] }) -> +    extras = {} +    for extra in registryEntry.extras +      [ key, value ] = extra.split "=" +      extras.query = "#{value} " if key? and key == "keyword" and value? and 0 < value.length +    extras +    # sourceFrameId here (and below) is the ID of the frame from which this request originates, which may be different    # from the current frame. -  activate: (sourceFrameId) -> @open sourceFrameId, {completer:"omni"} -  activateInNewTab: (sourceFrameId) -> @open sourceFrameId, { -    completer: "omni" -    selectFirst: false -    newTab: true -  } + +  activate: (sourceFrameId, registryEntry) -> +    @open sourceFrameId, extend @getOptions(registryEntry), completer:"omni" + +  activateInNewTab: (sourceFrameId, registryEntry) -> +    @open sourceFrameId, extend @getOptions(registryEntry), completer: "omni", newTab: true +    activateTabSelection: (sourceFrameId) -> @open sourceFrameId, {      completer: "tabs"      selectFirst: true | 
