Wordcount bookmarklet
Drag this link Word Count to your bookmark bar to get a basic word count for any page by clicking on it. update: Thanks to Nathan's suggestion it will count the selected words. Getting the silly thing into a link was far more pain than it was worth. update 2: now everything exists inside a function as suggested by Gus.
Comments
Oliver
hehe... that's elegant :D
Brehaut
Hah :P the new version certainly isn't. I pinched the selection logic from quirksmode. and proceeded to flatten the if block down into ternarys. i think it has 3 in a row now. :)
Greg
I just have icons along my bookmarks toolbar to save space... any idea how to get an icon alongside that one so I can delete the text (and still identify it)? I'm using ffx.
Greg
Currently I've called it 'WC'... but that has unwanted connotations...
Matt
The unix command-line tool for the same purpose is called `wc`, so you're in good company.
Angus
Nice :). I've written a few cool bookmarks (mostly of the "fixing unreadable pages" variety) but here's one you guys might find useful -- one-click autoscrolling support, even in frames. Linkage: win.document.documentElement.offsetHeight) win = frames[f]; window._aScr = { win: win, timer: null }; } if (_aScr.timer) { _aScr.win.clearInterval(_aScr.timer); _aScr.timer = null } else { _aScr.timer = _aScr.win.setInterval('scrollBy(0, 1)', 50); } })();">Scroll (actually if that works, you most likely have a cross-site scripting vulnerability here!).
Angus
Meh, here's the code by itself (your blog needs a Preview button, foo'!): javascript:(function(){ if (!window._aScr) { var win = window, f = frames.length; while (f--) if (frames[f].document.documentElement.offsetHeight > win.document.documentElement.offsetHeight) win = frames[f]; window._aScr = { win: win, timer: null }; } if (_aScr.timer) { _aScr.win.clearInterval(_aScr.timer); _aScr.timer = null } else { _aScr.timer = _aScr.win.setInterval('scrollBy(0, 1)', 50); } })(); Handy tip: with bookmarklets, create and execute an anonymous function in one step like that, it saves stomping on page variables and worrying about return values,
Brehaut
good call about the func. i'll go change mine now
Paul
nice!
