Revisions

gist: 154575 Download_button fork
public
Public Clone URL: git://gist.github.com/154575.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
CmdUtils.CreateCommand({
  names: ["go to"],
  arguments: [{role: 'object', nountype: noun_type_awesomebar, label:"search term"}],
  preview: function preview(pblock, args) {
    pblock.innerHTML = "Opens <b><a href='" + args.object.text + "'>" + args.object.html + "</a></b> on a new tab";
  },
  execute: function execute(args) {
    if(args.object.text){
       Utils.openUrlInBrowser(args.object.text);
    }
  }
});
 
CmdUtils.CreateCommand({
  names: ["copy link"],
  arguments: [{role: 'object', nountype: noun_type_awesomebar}],
  preview: function preview(pblock, args) {
    pblock.innerHTML = "Copies <b><a href='" + args.object.text + "'>" + args.object.html + "</a></b> to the clipboard";
  },
  execute: function execute(args) {
    if(args.object.text){
       Utils.clipboard.text = args.object.text;
       displayMessage("Copied " + args.object.text);
    }
  }
});
 
 
 
CmdUtils.CreateCommand({
  names: ["insert link"],
  arguments: [{role: 'object', nountype: noun_type_awesomebar}],
  preview: function preview(pblock, args) {
    pblock.innerHTML = "Inserts <b><a href='" + args.object.text + "'>" + args.object.html + "</a></b> on the current textarea";
  },
  execute: function execute(args) {
    if(args.object.text){
       CmdUtils.setSelection(args.object.text);
    }
  }
});