I’ve finally gotten around to adding my two JavaScript projects to the code page. Word count adds a little counter to every textarea on a page. There’s also an option, which is just on in the demo, to have it ignore HTML. This script works in all browsers except IE for the time being. If you have tips on how to work around IE’s broken-ass event handling, I’d love to hear them. Specifically, I cannot get it to add the onkeyup attribute to a previously generated element.
Track changes started out as a pure CSS exercise. I thought it would be simple to have a style switcher that would show or hide <del>
and <ins>
tags by changing the display property. It was, but I ran into a problem: when the text was copied to the clipboard, the deleted items were included. After some hair-pulling, I decided the best workaround would be to clone the content and remove the <del>
elements from the DOM when changes were hidden. I’d seen an excellent example of cloning content to toggle it, and I modified it to handle the <del>
elements.
Sancho says
I know it’s probably out of scope, but it’d be pretty spiffy if it could track multiple changes–e.g. by using an attribute like rev:
blahblah
Sancho says
Uh oh–blog ate my tags
<ins rev=2>blahblah</ins>
I think that should work….
steph says
Sorry about that!
Those two tags do support the cite attribute for date/time and author info, so it should be relatively easy to pull that out and make use of it… I’ll experiment sometime.