http://www.linuxplanet.com/linuxplanet/tips/6573/1

Back to article

Quick Firefox Tip: Word Count Bookmarklet

Firefox Bookmarklet Counts Words, Not Tags

November 5, 2008

Articles written for Linux Planet have to meet a specified word count. Articles must also be HTML-tagged.

That means we authors need a way to count words. It would be easy in emacs ... if you don't mind counting all the HTML tags as words. Otherwise, not so easy. I can view the HTML in a browser, copy, then paste into a terminal where I'm running wc -w. But Firefox sometimes has some issues pasting large chunks of text (I thought it was bug 56219, but that's marked fixed; perhaps it's related to bug 84973) and anyway, it's a hassle to have to use two windows like that.

When I was writing my second bookmarklet article, I ran across a neat word frequency bookmarklet from wizard Jesse Ruderman. It counted words but also did a bunch of other stuff I don't need.

I've pared it down to make a simple but neat little Count Words bookmarklet. To use it, right-click on the link and Copy Link Location. Then paste it into Firefox when you're pointed at a page where you want to count words. To keep it, make a new bookmark and paste the bookmarklet into the URL field, and you'll be able to call it up on any page. Or give it a Keyword, like countwords, when you're saving the bookmark, then when you're on any page, type countwords in the URLbar to run the bookmarklet.

 

Resources

Roll Your Own Custom Bookmarklets In Firefox, part 2
Stupid Firefox Tricks, Part I

Akkana Peck is a freelance programmer whose credits include a tour as a Mozilla developer. She's also the author of Beginning GIMP: From Novice to Professional.

Sitemap | Contact Us