walmart pharmacy morton il passing urine drug test
Home + News + Speaking + Connect + About

Submitting stories to Netscape

June 28, 2006 @ 11:01pm

I've always tried to make bookmarklets for my sites -- little JavaScript helper functions that you can run to make your life easier. In the original Blogsmith CMS I had a couple of them. One of them let you easily blog about a web page you were on. You could select some text, click the favelet button and we'd open a post editing screen with the related link, related page title and the contents you wanted to quote already filled out.

I sent my development team a bookmarklet for the new Netscape, but it had a bug in it so they put up a stripped-down version of it. I figured out the problem and I've got a better one for them:

Netscape This

All you have to do is drag that link up to your browser's toolbar or add it as a bookmark.

Then go to a web page you want to submit to Netscape, select the text you want to quote and press the button or choose the bookmark and you'll have a Netscape story submission form all filled out.

One person wrote me and said "your bookmarklet rules!" and that was back when it was the simple version.

There is one more little thing I'd like to do in it though.

I trim the selected text to 350 characters since there is a 350-character limit on excerpts for submitted, but it trims a selection that includes HTML like hyperlinks. When the text gets into the textarea all of the HTML is stripped, so you end up with a 250-character excerpt when you could have had 100 more.

So what is an easy way to get just the selected text and not the selected HTML into the form? Like using innerText versus innerHTML or some regex strategy?

The first person to come up with a solution gets a free one-year subscription to Slashfood's RSS feed.

Newer: Family Ties

Older: Where's the beef?