Last active
August 29, 2015 14:02
-
-
Save ueokande/c5ea82911b3dc69802a6 to your computer and use it in GitHub Desktop.
Vimium Search Engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (query) { | |
engines = { | |
'g' : function (q) { return 'https://www.google.com/search?q=' + q }, | |
'd' : function (q) { return 'https://duckduckgo.com/?q=' + q }, | |
'y' : function (q) { return 'http://search.yahoo.com/search?p=' + q }, | |
'w' : function (q) { return 'http://en.wikipedia.org/wiki/' + q }, | |
't' : function (q) { return 'https://twitter.com/search?q=' + q }, | |
'b' : function (q) { return 'http://www.bing.com/search?q=' + q }, | |
}; | |
defEngine = Object.keys(engines)[0]; | |
first = query.split('%20')[0]; | |
args = query.slice(first.length + 3); | |
openurl = first in engines ? engines[first](args) | |
: engines[defEngine](query); | |
window.open(openurl, '_self'); | |
})('%s') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment