aboutsummaryrefslogtreecommitdiffstats
path: root/pages/completion_engines.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-06-06 12:01:23 +0100
committerStephen Blott2015-06-06 12:01:25 +0100
commit4eda19de339212f86a9b008a4f3142a61d62829e (patch)
treedc9c314b327baf8cdebb05062087413431090cab /pages/completion_engines.coffee
parent2d5a01c9791a81aa87eaa935a1183f10950bdc84 (diff)
downloadvimium-4eda19de339212f86a9b008a4f3142a61d62829e.tar.bz2
Re-work completions: extend engine wrapper to handle prefixes.
This commit contains the bulk og the material changes for which the previous commits established the basis. 1) Add a general framework for detecting query prefixes in search URLs, adding them to query sent to the completion engine, and stripping them from the resulting suggestions. This allows the user to have a search engine... j: http://www.google.com/search?q=javascript+%s Javascript and have the prefix "javascript" included (automatically) in queries sent to completion engines, which results in substantially better suggestions. 2) Re-work completion for Google Maps in a simpler form.
Diffstat (limited to 'pages/completion_engines.coffee')
-rw-r--r--pages/completion_engines.coffee7
1 files changed, 5 insertions, 2 deletions
diff --git a/pages/completion_engines.coffee b/pages/completion_engines.coffee
index d744b3b3..790f2968 100644
--- a/pages/completion_engines.coffee
+++ b/pages/completion_engines.coffee
@@ -11,12 +11,15 @@ DomUtils.documentReady ->
engine = new engine
html.push "<h4>#{engine.constructor.name}</h4>\n"
html.push "<div class=\"engine\">"
+ if engine.example.explanation
+ html.push "<p>#{engine.example.explanation}</p>"
if engine.regexps
+ html.push "<p>"
+ html.push "Regular expression#{if 1 < engine.regexps.length then 's' else ''}:"
html.push "<pre>"
html.push "#{cleanUpRegexp re}\n" for re in engine.regexps
html.push "</pre>"
- if engine.prefix
- html.push "<p>This uses the general Google completion engine, but adds the prefix \"<tt>#{engine.prefix.trim()}</tt>\" to the query.</p>"
+ html.push "</p>"
if engine.example.searchUrl and engine.example.keyword
engine.example.description ||= engine.constructor.name
html.push "<p>"