Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Ubiquity] show coloring pane
/*
* Ubiquity 0.5 example
* changes from 0.1.8:
* - name:String -> names:[String]
* - takes:{String:RegExp} -> arguments:[{role:String, nountype:RegExp}]
* - preview&execute:function(Element, arg)
* -> preview&execute:function(Element, {argname:arg,...})
*/
CmdUtils.CreateCommand({
names: ["color"],
icon: "chrome://ubiquity/skin/icons/favicon.ico",
homepage: "http://d.hatena.ne.jp/bellbind/",
author: {name: "bellbind", email: "bellbind@gmail.com"},
license: "GPL",
description: "display colors",
help: "display colors",
arguments: [{role: "input", nountype: noun_arb_text}],
preview: function (pblock, args) {
var pnode = jQuery(pblock);
var color = args.input.text;
pnode.empty();
try {
pnode.html(
["<div style='",
"width: 450px; height: 450px;",
"background-color: ",
color,
";'></div>"].join(""));
} catch (ex) {;}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment