Three Little Projects
I recently cleaned up 3 little JavaScript projects I've made for myself, and thought I'd share them here:
LoadBar
A simple progress bar. Right now it expects a specific width and height for its container, but I'm working on generalizing it.
Authoring TextArea
A few JS-based enhancements for textarea elements:
tabkey produces a four space indentreturninserts a newline, and, more importantly, preserves the indentation of the previous line
I wrote this up to allow me to more easily write and edit the Markdown format that these posts are stored in for my blogging system (which will receive its own post shortly).
Firefox Truncation
A JavaScript implementation of text-overflow:ellipsis in CSS. Of all the modern browsers, Firefox doesn't support this fairly useful property (though it does have an open ticket for it). My solution? I use a canvas element to measure the size of the rendered text, and iteratively truncate the the text until it fits. All elements with the class of truncate recieve this treatment. The full text is available as a tooltip on hover. Right now, this script only works under the YUI library, but I am working on generalizing it to be framework-agnostic. See update here!
Matt "Potch" Claypotch is a web developer (At Mozilla!), geek, and all-around swell guy who currently resides in Mountain View, California.