Skip to content

Instantly share code, notes, and snippets.

@Dykam
Created May 9, 2009 09:18
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/109196 to your computer and use it in GitHub Desktop.
Save Dykam/109196 to your computer and use it in GitHub Desktop.
Dykam's best Ubiqs.
CmdUtils.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) {
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