Created
January 17, 2015 11:28
-
-
Save caoyue/399553528c1098130d9a to your computer and use it in GitHub Desktop.
v2ex 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
var SEARCH = "https://www.bing.com/search?q=site%3Av2ex.com%2Ft+{{0}}"; | |
document.forms[0].onsubmit = function () { | |
var q = document.getElementById("q"); | |
if (q.value != "") { | |
var url = SEARCH.replace(/\{\{0\}\}/i, q.value); | |
window.open(url, "_blank"); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment