garyhodgson (owner)

Revisions

gist: 21258 Download_button fork
public
Public Clone URL: git://gist.github.com/21258.git
Embed All Files: show embed
selection_modifier_question.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* This is a template command */
CmdUtils.CreateCommand({
  name: "example",
  icon: "http://example.com/example.png",
  homepage: "http://example.com/",
  author: { name: "Your Name", email: "you@example.com"},
  license: "GPL",
  description: "A short description of your command",
  help: "how to use your command",
  takes: {"input": noun_arb_text},
  modifiers: {
    a: noun_arb_text,
    b: noun_arb_text
  },
  preview: function( pblock, input, mods ) {
    var template = "Input: ${input}";
    template += "<br/>First modifier: ${a}";
    template += "<br/>Second modifier: ${b}";
    pblock.innerHTML = CmdUtils.renderTemplate(template, {"input": input.text, "a": mods.a.text, "b": mods.b.text});
  },
  execute: function(input) {
    CmdUtils.setSelection("You selected: "+input.html);
  }
});