pratham (owner)

Forks

Revisions

gist: 10707 Download_button fork
public
Description:
Ubiquity - Web Traffic Stats.
Public Clone URL: git://gist.github.com/10707.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: ["traffic"],
    icon: "http://siteanalytics.compete.com/favicon.ico",
    author: {name: "Pratham Kumar", email: "pratham@pratham.name"},
    description: "Get Compete traffic statistics.",
    homepage: "http://pratham.name/",
    arguments: [{role: 'object', nountype: noun_arb_text, label: 'example.com'}],
 
    preview: function (html, q) {
      var params = {};
     html.innerHTML = 'Getting Compete traffic stats for <b>'+q.object.text+'</b>';
 
      if (q.object.text == '')
        return;
 
      html.innerHTML = '<img style="width:490px;height:200px" src="http://grapher.compete.com/'+q.object.text+'_uv.png"><br>';
    },
 
    execute: function (args) {
      var url = "http://siteanalytics.compete.com/"+args.object.text+"/?metric=uv";
      Utils.openUrlInBrowser (url);
    }
  });
} else {
  CmdUtils.CreateCommand({
   name: "traffic",
    icon: "http://siteanalytics.compete.com/favicon.ico",
    author: {name: "Pratham Kumar", email: "pratham@pratham.name"},
    description: "Get Compete traffic statistics.",
    homepage: "http://pratham.name/",
    takes: {"example.com": noun_arb_text},
 
    preview: function (html, q) {
      var params = {};
 
      html.innerHTML = '<img style="width:490px;height:200px" src="http://grapher.compete.com/'+q.text+'_uv.png"><br>';
    },
 
    execute: function (q) {
      var url = "http://siteanalytics.compete.com/"+q.text+"/?metric=uv";
      Utils.openUrlInBrowser (url);
    }
  });
}