Wednesday, January 11, 2006

Writely Bookmarklet

This one is for the users of Writely, a great online documents editor and document sharing service. Inspired by Writely Quick Note Bookmarklet I've created a Add to Writely bookmarklet that will append selected text to existing document. (If you just want to add a short note, don't select anything.)
javascript:q = %22%22 + 
(window.getSelection ? window.getSelection() :
document.getSelection ? document.getSelection() :
document.selection.createRange().text);
if(!q){void(q=prompt('Add to Writely',''))};
if(q)location.href='http://www.writely.com/MiscCommands.aspx?
command=appendtext&docid=DOCUMENT_ID&appendtext=
<br /><br />'+escape(q);void(0)

The URL of Writely document is in format http://www.writely.com/Doc.aspx?id=DOCUMENT_ID and you should edit Add to Writely bookmarklet and change DOCUMENT_ID to ID of your desired document.
When you click the bookmarklet you will get blank page. That's OK. Your document has been modified, but Writely does not have any kind of notification that the modification was successful when adding notes this way.
If you share that document with others, they can append to it too. Unfortunately, you can't append snippets of HTML code.

No comments: