jQuery Roundup: jQuery 1.5, BigText, View, jKey, Jail
Welcome to the jQuery roundup. You can send your plugins and articles in for review through our contact form or @dailyjs.
jQuery 1.5 Beta 1
jQuery 1.5 Beta 1 has been released. The changes mainly centre around the Ajax module because it has been rewritten, but I also thought jQuery.subclass was worth mentioning.
BigText

BigText (GitHub: zachleat / BigText) by Zach Leatherman calculates the font size and word spacing required to fit text to a given width. It’s easier to understand the features by checking out the BigText demo.
It works like this:
For each line, it increments first by 16em until it detects a line break, backs off an interval then increments by 8em. It continues with 4em, 2em, 1em, 0.1em, until it finds the correct font-size to the nearest hundredth of an em.
jQuery View
jQuery View (GitHub: syntacticx / viewjs, MIT and GPL) by Ryan Johnson is a class and inheritance plugin for templates. This can result in some interesting opportunities for code reuse when combined with something like Backbone.js: the Backbone to-do app example by Jérôme Gravel-Niquet has been ported as a jQuery View demo with annotated source.
The View guide is probably the best way to get started with the library.
jKey
jKey by Oscar Godson makes keyboard shortcut handling much easier, for example:
$(window).jkey('alt+d', function() {
// Callback
});
$(window).jkey('w, up',function() {
// w OR up
});
There’s an interactive example in the jKey documentation.
Jail
Jail (GitHub: sebarmeli / JAIL, MIT) by Sebastiano Armeli-Battana is an asynchronous image loader:
Selected images will be downloaded after the document is ready not blocking the page to render elements in your page. Images can be loaded after an event is triggered (like clicking on a link, mouseovering on some elements, scrolling up/down) or after some delay.
The author’s recommendation is to use an img tag with small images in combination with a noscript tag like this:
<img class="lazy" src="/img/blank.gif" name="/img/image1.jpg">
<noscript>
<img src="/img/image1.jpg">
<noscript>
This approach can be seen in the Jail demos.
I’m not sure if using the name attribute this way constitutes an unacceptable abuse to enthusiastic spec zealots, but the plugin source is readable so it could be modified to suit other requirements.