I noticed the Movable Type community has a couple of great resources out there to help with this blogging software, so I thought I'd help out with a tip of my own.
There's this thing called a bookmarlet, it makes it very easy to post an entry into the blog from any page you are surfing from. So if you are on say Yahoo's most popular stories page and want to link to it, you simply select some text and click on the bookmark and it will automatically pop up a box with a link to the site you were just on. And to make it even nicer, the text you selected will be there too.
The thing is, when I'm quoting I always like to slip in blockquotes and this has to be added manually. So I came up with a way to have it inserted automatically.
Edit the bookmarklet. The original version should look something like this (I had to break it up a bit because the width was messing up the layout):
javascript:t=document.selection?document.selection.createRange()
.text:document.getSelection();void(window.open
('http://www.YOURDOMAIN.com/PATH_TO_mt/mt.cgi?is_bm=1&
bm_show=trackback,category,allow_comments,allow_pings,
convert_breaks,excerpt,
text_more&__mode=view&_type=entry&link_title='+escape
(document.title)+'&link_href='+escape(window.location.href)
+'&text='+escape(t),'_blank','scrollbars=no,width=400,height=760,
status=yes,resizable=yes,scrollbars=yes'))
depending on your settings of course. But what you want to look for is this "escape(t)" because that is the part that stores the text you have selected on the page. So you need to add blockquote before and after. But you need to watch out because there is some special javascript syntax to worry about. So directly before the single quote:
'
and directly after:
text=
you want to add:
<blockquote>
then directly after:
escape(t)
and before the comma:
,
you want to add:
+'</blockquote>'
so the end result will be:
javascript:t=document.selection?document.selection.createRange()
.text:document.getSelection();void(window.open
('http://www.YOURDOMAIN.com/PATH_TO_mt/mt.cgi?is_bm=1&bm_show=trackback,
category,allow_comments,allow_pings,convert_breaks,excerpt,
text_more&__mode=view&_type=entry&link_title='+escape(document.title)+'&link_href='+escape
(window.location.href)+'&text=<blockquote>'+escape(t)+'</blockquote>','_blank',
'scrollbars=no,width=400,height=760,status=yes,resizable=yes,
scrollbars=yes'))
and your selected text will then always be surrounded by blockquotes.
The downside is that if you have selected no text on that bookmark, you will have an empty tag in the page. So you'll either have to manually remove or leave it in, which won't hurt much other than having a little extra html markup in your page.
Posted by GilbertZ at 11:11 AM
| TrackBack
Comments:
Thanks for the tip. I was adding the blockquote tags manually also, until I found your post. Cheers,
Posted by: jmelton on December 2, 2002 01:05 PM
Very interesting, I think I recollect something like that in the past, I'll have to look after that.
Posted by: Apahcer on February 4, 2004 07:59 AM
Post a comment:
|