Add DuckDuckGo shortcut

Added an alias ```alt + d``` to be DuckDuckGo shortcut
pull/847/merge
Natnael Getahun 7 years ago committed by Thibaut Courouble
parent 17964b67d4
commit 1bc380f12d

@ -149,6 +149,9 @@ class app.Shortcuts
when 40 when 40
@trigger 'altDown' @trigger 'altDown'
false false
when 68
@trigger 'altD'
false
when 70 when 70
@trigger 'altF', event @trigger 'altF', event
when 71 when 71

@ -131,6 +131,9 @@ app.templates.helpPage = ->
<dt class="_shortcuts-dt"> <dt class="_shortcuts-dt">
<code class="_shortcut-code">alt + s</code> <code class="_shortcut-code">alt + s</code>
<dd class="_shortcuts-dd">Search on Stack Overflow <dd class="_shortcuts-dd">Search on Stack Overflow
<dt class="_shortcuts-dt">
<code class="_shortcut-code">alt + d</code>
<dd class="_shortcuts-dd">Search on DuckDuckGo
</dl> </dl>
<p class="_note _note-green"> <p class="_note _note-green">
<strong>Tip:</strong> If the cursor is no longer in the search field, press <code class="_label">/</code> or <strong>Tip:</strong> If the cursor is no longer in the search field, press <code class="_label">/</code> or

@ -17,6 +17,7 @@ class app.views.Search extends app.View
typing: 'focus' typing: 'focus'
altG: 'google' altG: 'google'
altS: 'stackoverflow' altS: 'stackoverflow'
altD: 'duckduckgo'
@routes: @routes:
after: 'afterRoute' after: 'afterRoute'
@ -113,6 +114,10 @@ class app.views.Search extends app.View
@externalSearch "https://stackoverflow.com/search?q=" @externalSearch "https://stackoverflow.com/search?q="
return return
duckduckgo: =>
@externalSearch "https://duckduckgo.com/?t=devdocs&q="
return
onResults: (results) => onResults: (results) =>
@hasResults = true if results.length @hasResults = true if results.length
@trigger 'results', results, @flags @trigger 'results', results, @flags

Loading…
Cancel
Save