pratham (owner)

Forks

Revisions

gist: 10706 Download_button fork
public
Description:
Ubiquity - Google Trends.
Public Clone URL: git://gist.github.com/10706.git
Embed All Files: show embed
JavaScript #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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: "pratham@pratham.name"},
  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: "pratham@pratham.name"},
  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);
  }
});
}