aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael SALIHI2015-09-10 07:34:00 +0200
committerMichael SALIHI2015-09-10 07:49:53 +0200
commited863f6fa4cd1006c31f60edb3ad0639c6983e37 (patch)
treeebe43883f4d4a97e07f71459eeea555956dd3ebf
parentced7a47e90e2ba2e1dba9e71c26e1172bd0e7576 (diff)
downloadvimium-ed863f6fa4cd1006c31f60edb3ad0639c6983e37.tar.bz2
Search completion; add support for Qwant completion
-rw-r--r--background_scripts/completion_engines.coffee12
-rw-r--r--lib/settings.coffee1
2 files changed, 13 insertions, 0 deletions
diff --git a/background_scripts/completion_engines.coffee b/background_scripts/completion_engines.coffee
index b572375d..6c2fbf8d 100644
--- a/background_scripts/completion_engines.coffee
+++ b/background_scripts/completion_engines.coffee
@@ -140,6 +140,17 @@ class Webster extends BaseEngine
parse: (xhr) -> JSON.parse(xhr.responseText).suggestions
+class Qwant extends BaseEngine
+ constructor: ->
+ super
+ engineUrl: "https://api.qwant.com/api/suggest?q=%s"
+ regexps: "^https?://www\\.qwant\\.com/"
+ example:
+ searchUrl: "https://www.qwant.com/?q=%s"
+ keyword: "qw"
+
+ parse: (xhr) -> JSON.parse(xhr.responseText)[1]
+
# A dummy search engine which is guaranteed to match any search URL, but never produces completions. This
# allows the rest of the logic to be written knowing that there will always be a completion engine match.
class DummyCompletionEngine extends BaseEngine
@@ -158,6 +169,7 @@ CompletionEngines = [
Bing
Amazon
Webster
+ Qwant
DummyCompletionEngine
]
diff --git a/lib/settings.coffee b/lib/settings.coffee
index 99a20963..0d787036 100644
--- a/lib/settings.coffee
+++ b/lib/settings.coffee
@@ -156,6 +156,7 @@ Settings =
# b: https://www.bing.com/search?q=%s Bing
# d: https://duckduckgo.com/?q=%s DuckDuckGo
# az: http://www.amazon.com/s/?field-keywords=%s Amazon
+ # qw: https://www.qwant.com/?q=%s Qwant
"""
newTabUrl: "chrome://newtab"
grabBackFocus: false