-
-
Save rrichards/212613 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
if (CmdUtils.parserVersion == 2) { | |
CmdUtils.CreateCommand({ | |
names: ["trends", "google trends", "google search trends"], | |
icon: "http://www.google.com/favicon.ico", | |
author: {name: "Pratham Kumar", email: "[email protected]"}, | |
description: "Google Trends.", | |
homepage: "http://pratham.name/", | |
arguments: [{role: 'object', nountype: noun_arb_text, label: 'query'}], | |
preview: function (html, args) { | |
html.innerHTML = 'Getting Google Trends for <b>'+args.object.text+'</b>'; | |
if (args.object.text == '') | |
return; | |
html.innerHTML = '<img style="width:490px;height:240px" src="http://www.google.com/trends/viz?q='+args.object.text+'&graph=weekly_img&sa=N"><br>'; | |
}, | |
execute: function (args) { | |
var url = "http://www.google.com/trends?q="+args.object.text; | |
Utils.openUrlInBrowser (url); | |
} | |
}); | |
} else { | |
CmdUtils.CreateCommand({ | |
name: "trends", | |
icon: "http://www.google.com/favicon.ico", | |
author: {name: "Pratham Kumar", email: "[email protected]"}, | |
description: "Google Trends.", | |
homepage: "http://pratham.name/", | |
takes: {"query": noun_arb_text}, | |
preview: function (html, q) { | |
var params = {q: q.text}; | |
html.innerHTML = 'Getting Google Trends for <b>'+q.text+'</b>'; | |
html.innerHTML = '<img style="width:490px;height:240px" src="http://www.google.com/trends/viz?q='+q.text+'&graph=weekly_img&sa=N"><br>'; | |
}, | |
execute: function (q) { | |
var url = "http://www.google.com/trends?q="+q.text; | |
Utils.openUrlInBrowser (url); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment