Last active
December 15, 2015 09:38
-
-
Save andykent/5239448 to your computer and use it in GitHub Desktop.
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
# name: Google Search | |
# description: Search Google for stuff. | |
# keyword: google | |
# homepage: http://google.com | |
bolt.run -> | |
if command.hasQuery | |
url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+command.query+"&callback=?" | |
http.getJSON url, (data) -> | |
if data.responseData | |
for item in data.responseData.results | |
result | |
title: utils.sanitize(item.title) | |
description: utils.sanitize(item.content) | |
action: actions.open(item.url) | |
else | |
result | |
title: "Query Failed!" | |
description: "Google Failed to serve this query. Try Again?" | |
action: actions.repeat() | |
else | |
result | |
title: meta.name | |
description: "Type your query to continue" |
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
// name: Google Search | |
// description: Search Google for stuff. | |
// keyword: google | |
// homepage: http://google.com | |
bolt.run(function(){ | |
if(command.hasQuery) { | |
var url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+command.query+"&callback=?" | |
http.getJSON(url, function(data) { | |
if(data.responseData) { | |
for(i in data.responseData.results) { | |
var item = data.responseData.results[i]; | |
result({ | |
title: utils.sanitize(item.title), | |
description: utils.sanitize(item.content), | |
action: actions.open(item.url) | |
}); | |
} | |
} else { | |
result({ | |
title: "Query Failed!", | |
description: "Google Failed to serve this query. Try Again?", | |
action: actions.repeat() | |
}); | |
} | |
}); | |
} else { | |
result({ | |
title: meta.name, | |
description: "Type your query to continue" | |
}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment