Skip to content

Instantly share code, notes, and snippets.

@Dykam
Created June 1, 2009 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dykam/121402 to your computer and use it in GitHub Desktop.
Save Dykam/121402 to your computer and use it in GitHub Desktop.
CmdeUtils.CreateCommand({
name: "execute",
icon: "http://example.com/example.png",
homepage: "http://Dykam.nl",
author: {name: "Dykam", email: "dev@dykam.nl"},
license: "GPL",
description: "Execute javascript.",
help: "Enter a javascript snippet.",
takes: {"code": /.*/},
preview: function(pblock, code) {
//executer = new Execute();
//executer.In = CmdUtils.getSelection();
pblock.innerHTML = "Result:\n" + eval(code.text);
},
execute: function(code) {
CmdUtils.setSelection(eval(code.text));
}
});
CmdUtils.CreateCommand({
name: "execute-ubiq",
icon: "http://example.com/example.png",
homepage: "http://Dykam.nl",
author: {name: "Dykam", email: "dev@dykam.nl"},
license: "GPL",
description: "Execute javascript.",
help: "Enter a javascript snippet.",
takes: {"code": /.*//*},
preview: function(pblock, code) {
pblock.innerHTML = "Code to execute:\n" + code.text;
},
execute: function(input) {
eval(code.text);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment