[Duncan's Home] Duncan's Jotter
faq -  feedback -  home 
Members
Logon   -   Sign Up

Weblogger Bookmarklet

Msg#41 - Weblogger Bookmarklet

In response to: Top of Thread. | <<Back | Next>> | Top of Thread | View Full Thread | Reply | Edit

Posted: 6/15/2000 by Duncan
Modified: 12/10/2000 by Duncan

HowTo

For the moment it will be assumed that you know how to copy bookmarklets into your favorites bar or folder. For example, Mac IE5 users can just highlight the bookmark text and copy it to the clipboard. Then command-K will bring up the favorites editor. Enter a suitable name - I used Snipper - and then paste the text of the javascript into the Address field. Now's a good time to change the action URL.

Once the favorite has been saved it can be dragged to the Favorites Bar. Here's what mine looks like now:

Submission of a snippet to your weblog can obviously only be actioned if you are already logged in as administrator for your site. Forgetting to log-in will cause the server to complain like so:

You will get a similar error message if you forget to change the /YOURSITE/YOURWEBLOGPATH/weblog_post part of the script or make a mistake in the path. The best way to check is to go to your weblog page and submit a posting in the usual way and make a note of the URL there.

Weblogger in Action

Here is a screen shot of the Weblogger Bookmarklet in action.

You can see the result in the December 11th entry of Duncan's Jotter.



Here are the bookmarklets. The IE version can easily be customised for your own particular style of quoting, etc. The Netscape version is a cut-down version due to the 500 character limit for bookmarklets.

Enjoy!

Mac IE5 version

javascript:var t=document.title;var u=document.location.href;var s=document.getSelection();if (s!='') s='\n<blockquote>'+s+'</blockquote>';var cta='<a href=\''+u+'\'>'+t+'</a>'+s;var wf='width=640,height=480,toolbar=0,location=0,directories=0,status=1,menuBar=0,scrollBars=1,resizable=1'; var snipper=window.open ('', 'Snipper', wf);with(snipper.document){write('<form method=\'POST\' action=\'http://www.free-conversant.com/YOURSITE/YOURWEBLOGPATH/weblog_post\'><input type=\'text\' name=\'subject\' value=\''+t+'\' size=\'80\'><br><textarea name=\'body\' rows=\'15\' cols=\'80\' wrap=\'virtual\'>'+cta+'</textarea><br><input type=\'submit\' name=\'newmessage\' value=\'Create New Message\'></form>');void(close())}

PC IE5 version

javascript:var t=document.title;var u=document.location.href;var s=document.selection.createRange().text;if (s!='') s='\n<blockquote>'+s+'</blockquote>';var cta='<a href=\''+u+'\'>'+t+'</a>'+s;var wf='width=640,height=480,toolbar=0,location=0,directories=0,status=1,menuBar=0,scrollBars=1,resizable=1'; var snipper=window.open ('', 'Snipper', wf);with(snipper.document){write('<form method=\'POST\' action=\'http://www.free-conversant.com/YOURSITE/YOURWEBLOGPATH/weblog_post\'><input type=\'text\' name=\'subject\' value=\''+t+'\' size=\'80\'><br><textarea name=\'body\' rows=\'15\' cols=\'80\' wrap=\'virtual\'>'+cta+'</textarea><br><input type=\'submit\' name=\'newmessage\' value=\'Create New Message\'></form>');void(close())}

Netscape 4 version

The following bookmarklet has been tested with Mac NN4.08. I've no reason to believe it won't work on a PC.

Please note that I've found the Mac NN4.08 to have a limit of 500 characters in a javascript bookmarklet. Hence the sparsity of the following code which as it stands is 498 characters in length. When you modify the www.free-conversant.com/YOURSITE/YOURWEBLOGPATH/ portion make sure you don't exceed the limit, i.e. you have only two more characters in hand.

Please let me know if it works in a Win version of the Netscape browser(s).

javascript:var t=document.title;var u=document.location.href;var s=document.getSelection();var cta='<a href=\''+u+'\'>'+t+'</a> '+s;var d=window.open('','d');with(d.document){write('<form method=\'POST\' action=\'http://www.free-conversant.com/YOURSITE/YOURWEBLOGPATH/weblog_post\'><input type=\'text\' name=\'subject\' value=\''+t+'\' size=80><br><textarea name=\'body\' rows=15 cols=80 wrap>'+cta+'</textarea><br><input type=\'submit\' name=\'newmessage\' value=\'Post\'></form>');void(close())}

Enclosures:
favebar.gif (2K)
favedit.gif (11K)
guesterror.gif (3K)
weblogger.gif (8K)

Replies:
RE: Weblogger bookmarklet ( 6/21/2000 by Jim Roepcke, Label: None. )
Hi Duncan, I tried to use the weblogger bookmarklet in IE5 for Windows,
RE: Weblogger Bookmarklet ( 2/26/2001 by Jim Roepcke, Label: None. )
Hi Duncan, As you know, I've been using your weblogger bookmarklet since
RE: Weblogger Bookmarklet ( 7/19/2006 by lavalab vlad, Label: None. )
Some more info on bookmarklets available at: Bookmarklet Resource Archive

Tell ICANN to keep their hands off .org!


Run the HTML validator for this page
Webmaster: web at smeed.org