The share-on-reader command is the first ubiquity command I've ever coded. I made it just to try ubiquity's command editor, but I wouldn't expect people to use it. It's basically a wrapper of Google Reader's bookmarklet that allows you to select (or not) text from a web page, and share it with a note on your Google Reader Shared Stuff Page (providing you've got a Google Account and activated Google Reader). It's that simple. You can subscribe to that command on that page. Here is the code:
CmdUtils.CreateCommand({ name: "share-on-reader", homepage: "http://abauchu.net/", icon: "http://www.google.com/reader/ui/favicon.ico", author: { name: "Alexis Bauchu", email: "alexis.bauchu@gmail.com"}, license: "MPL", description: "Shares content Google Reader's shared stuff page and allow you to add a note.", help: "This uses Google Reader, so you need a Google account to use this command.", takes: {"your selection": noun_arb_text}, preview: function( pblock, selection ) { pblock.innerHTML = "Shares \"" + selection.html + "\" with Google Reader and allows to add a note"; }, execute: function(selection) { var cmd = "var b=document.body;var GR________bookmarklet_domain='http://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='http://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}"; var doc = Application.activeWindow.activeTab.document; var body = doc.body; void (cript = doc.createElement('script')); void (code = doc.createTextNode(cmd)); void (cript.appendChild(code)); void (body.appendChild(cript)); } });
The code is rather long, because at the time there wasn't any command like CmdUtils.makeBookmarkletCommant(). I could have updated it, but I like it like that. You know, it's my first one.
But this command doesn't work with the https version of Google Reader (I should say the bookmarklet doesn't work, because I virtually didn't code anything). Someone commented about it in this blog: he uses the customizegoogle extension which automatically redirects the normal url to the secured one (https). And it breaks the command. So I tried some stuff, and came with a solution: in fact, on the https version of the website, Google provides ANOTHER bookmarklet, working this time. Simple! You can subscribe here. Here's the code:
CmdUtils.makeBookmarkletCommand({ name: "share-on-reader-secure", url: "javascript:var%20b=document.body;var%20GR________bookmarklet_domain='https://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='https://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}" });

