javascript

Adobe, Mobile Flash Player, JavaScript, etc.

Before you click over this because you know me as a Flash hater, give me two seconds.  That's not what this post is about.  It's about a larger issue.  It's about how awesome it is to be a web developer these days.
Ten years ago, being a web developer sucked.  Deployment was easy (rsync to production [...]

Even Better Inline Progress Bars

In the handful of months since I last posted about inline progress bars, I've made some enhancements to the mechanism. In particular, the original mechanism didn't handle overages very gracefully, and while overage isn't strictly needed for progress, I've ended up wanting the same inline display for other types of measurements (e.g., fundraising dollars against [...]

setTimeout/setInterval Bug in Android 2.2 WebKit

If you develop web apps for Android devices, there's a really gnarly bug you should be aware of: setTimeout and setInterval will never fire while the soft keyboard is open.  When the soft keyboard closes, all the queued up timeouts/intervals will unspool all at once, which is not terribly good, but better than them disappearing.  [...]

Inline JS Progress Bars

Inline JS Progress Bars

2011-05-17: A richer version is available at http://www.barneyb.com/barneyblog/2011/05/17/even-better-inline-progress-bars/.
If you've ever built a web app that does background and/or batch processing of stuff, you've invariably created a bit of markup like this:
#numberFormat(sentEmailCount, ',')# of #numberFormat(emailCount, ',')# sent…
which then renders like this:

Wouldn't it be nice to create this markup (simply with a wrapping span) instead:
<span class="progress" rel="#sentEmailCount [...]

On-The-Fly YUI Compressor

A couple years ago I wrote about using YUI Compressor to do built-time aggregation and compression of static assets.  That works well and good if you have a build environment, but that's not always the case.  So, still using YUI Compressor, I set up a simple script that'll do runtime aggregation and compression of assets [...]

Improving the JSON/P Twitter Widget

For quite some time now I've had a sidebar widget that displays an excerpt of my Twitter feed on my blog.  It uses the standard Twitter JSON/P interface for loading the tweets and then a Twitter-provided script (http://twitter.com/javascripts/blogger.js) for rendering them on the page.  Unfortunately the default installation instructions would have you set up something [...]

jQuery TableSorter Comma Parser

Last night I needed a simple HTML table with sortable columns, and after a quick Googling, found the TableSorter jQuery plugin.  I'd come across it before, but never actually used it.  Added a class to my table (for targeting and to leverage the CSS that it comes with), added the required line of JavaScript to [...]

jQuery.bind() Data

If you only ever use the type-specific event helpers (.click(), .load(), .change(), etc.), you're potentially missing out on a really handy feature of jQuery: bind data.  Bind data is data associated with the bound handler function, available to every invocation of it, but not in any "normal" variable scope.  It's kind of like currying, except [...]

jQuery.live("click") Gotcha

If you're using the new jQuery.live("type", fn) handlers in jQuery 1.3, be careful with the "click" event type.  Unlike jQuery.bind("click", fn) and jQuery.click(fn), jQuery.live("click", fn) doesn't distinguish between mouse buttons.  So while the "normal" handlers will only trigger when the left button is used, the live handler will trigger on any button.
The workaround is pretty [...]

HTTP is an API

Ray Camden posted an interesting article over on InsideRIA about expanding short urls using jQuery and ColdFusion.  After reading the article, I thought he was overcomplicating things somewhat by relying on the url shortening services' APIs to do the lookups.  Yes, that's what APIs are for, but for this case, HTTP happens to be a [...]