I've written a Ubiquity script (command "project name") for my
coworkers to look up some workflow-related information. Sometimes, a
lookup will bring back more than one result, e.g. "project name Foo"
will bring back results Foo, Foobar, Foobaz etc.
I would like to add a keyboard shortcut to display the next/previous
result, Alt-Down and Alt-Up. The meat of the command as it currently
stands (only displaying the first result):
preview: function preview(pblock, args) {
pblock.innerHTML = "Enter a partial name for results...";
if (args.object.text.length < 5) return;
var searchText = escape(args.object.text + "%");
var url = "http://example.com/detail.php?type=name&value=" +
searchText;
CmdUtils.previewGet(pblock, url, function(json) {
var response = Utils.json.decode(json);
var output = "";
var project = response.projects[0];
output += "<b>" + project.projectId + "</b> - " +
project.projectName + "<br />";
output += "Owner: " + (null == project.owner ? "Nobody" :
project.owner) + "<br />";
output += "Status: " + (null == project.status ? "No action
yet" : project.status);
var numResults = 0;
for (i in response.projects) { numResults++; }
if (numResults > 1) { output += "<br /><br />" + numResults + "
matches available."; }
pblock.innerHTML = output;
});
},
execute: function execute(args) {
// no execute
}
--
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/ubiquity-firefox?hl=en.