Even simpler then my last Ubiquity example, this one came about from an actual project need to verify a custom character-length based text truncation filter. Select the text in the browser, invoke Ubiquity, and type: charcount
CmdUtils.CreateCommand({
name: "charcount",
takes: {"text to count chars in": noun_arb_text},
preview: function( pblock, argText ) {
pblock.innerHTML = argText.text.length;
}
})
Update: See comments below for Ubiquity 0.5 compatibility updates
Bhagwad Park 8:57 pm on July 21, 2009 Permalink |
I have updated the command for Ubiquity 0.5. Here it is – you can post it on your site:
CmdUtils.CreateCommand({
names: ['char-count'],
arguments: [ {role: 'object', nountype: noun_arb_text, label: 'text to count chars in'}],
preview: function( pblock, args ) {
//pblock.innerHTML = argText.object.length;
pblock.innerHTML = “The number of characters is: “+ args.object.text.length;
}
});
erik 11:03 am on July 22, 2009 Permalink |
Hi, thanks for posting the update!
Bhagwad Park 5:46 pm on July 22, 2009 Permalink
You’re welcome. I’ve created a post with the rel=”command” so users can install it. I’ve linked back to you as well.
Here it is: http://bhagwad.com/blog/2009/07/firefox-ubiquity-character-count-command.html