Skip to content

Instantly share code, notes, and snippets.

@bellbind
Created July 10, 2009 04:07
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 bellbind/144237 to your computer and use it in GitHub Desktop.
Save bellbind/144237 to your computer and use it in GitHub Desktop.
[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