Tag: ubiquity
Ubiquity for Firefox, and WordPress
by Daniel on Dec.28, 2009, under General
I’ve just discovered Ubiquity from the Mozilla Labs, and it’s showing a lot of promise for changing the way the we us the web.
From the site===
Ubiquity is an extension Ubiquity is an extension that allows you to enter commands that have knowledge of page content and return new information.
===via Labs/Ubiquity – MozillaWiki.
In essence it is a firefox extension that enables users to interact with webpages in different ways. For example, I tried my hand at writing a Ubiquity Command “Press This”, the same as the wordpress button from the admin tools page, to that I could quickly grab interesting articles for later posting.
The code is pretty straight forward
CmdUtils.CreateCommand({
names: ["press this", "blog this"],
icon: “http://www.wordpress.com/favicon.ico”,
description: _(“Launch a wordpress page so you can write an article about the current website”),
help: “.”,
author: {name: “Daniel Thomas”, email: “danielt@networklighthouse.com”},
license: “GPL”,
homepage: “http://www.networklighthouse.com/”,
arguments: [{role: 'object', nountype: noun_arb_text},
{role: "url", nountype: noun_type_url, label: "url to reference"} ],
preview: function preview(pblock, args) {
pblock.innerHTML = “Loads a new tab for wordpress”;
},
execute: function execute(args) {
var doc = CmdUtils.getDocumentInsecure();
f=’http://www.networklighthouse.com/wp-admin/press-this.php’;
e=encodeURIComponent;
u=f+’?u=’+e(args.url.text)+’&t=’+e(doc.title)+’&s=’+e(args.object.text)+’&v=4′;
Application.activeWindow.open(Utils.url(u));
}
});
Thats it, and most of that can be stripped out. Now that I’ve registered my code into Ubiquity all I need to do to bring up wordpress is select some text and either right click and select “press this” from the context menu or type “press this” into the ubiquity website.
Now if you want to use this code yourself, there’s a few things you need to do:
- Install Ubiquity (check out the link above)
- After restarting firefox browse to “about:ubiquity”
- click on “Hack Ubiquity”
- Paste the above code into the window, making sure you replace www.networklighthouse.com with your Blog’s URL
- Click Save to File and save it somewhere safe
- Thats it your done, try it out by selecting this article, pressing ctrl+space and typing “press this”
-Daniel
