Ubiquity command: share-on-reader and share-on-reader-secure
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{}" });
Posted le jeudi, janvier 8 2009, 01:58 - Programming - Lien permanent
Commentaires
Nice article !!!!
Thnk's bro!!!
Vivda open source software
The benefit for us CFML developers is in the greater adoption that Railo and OpenBD can bring to CFML as a language and community. For Adobe http://rapid4me.com/?q=Adobe, I think the profit lies in Bolt (or whatever it will be called). Assuming a greater number of CF users, the need for a standard IDE increases (no knock on CFEclipse...I love and use it daily).
Hey, nice command. Just wanted you to let you know to update the Ubiquity command for the latest v0.5 parser 2.
Here's the link:https://wiki.mozilla.org/Labs/Ubiqu... . I have Ubiquity 0.5 and want to include your command but can't as of now.
For a command that is updated for Ubiquity 0.5, this is the link: http://www.subtlysimple.com/?page_i...
Thanks for the links. I noticed that the command doesn't work anymore and I'll try to see if I can do a version with the "share using reader" format.