Drupal 6 JavaScript and jQuery

Drupal 6 JavaScript and jQuery CoverI just finished reading a new book, Drupal 6 JavaScript and jQuery, by Matt Butcher. The book title makes it sound highly specialized, but in fact it’s a great resource for a variety of readers, from Drupal beginners to JavaScript experts. Best of all, the book brings together two of my favorite open source technologies: Drupal and jQuery. If you aren’t already a fan, I’ve written elsewhere about Drupal’s benefits, and for jQuery, one statement should win you over: query HTML content using plain old CSS selectors!

Matt does a great job leading the reader from very basic principles to advanced concepts, thoroughly enough to initiate less experienced coders, but quickly enough to get everyone to real meat right away. You will get immediate value from this book whether you are a web designer just starting out with Drupal and/or JavaScript, an intermediate coder looking to expand your skills with either Drupal or JavaScript, or an advanced Drupalista or JavaScriptor looking to bring the two together.

Because I reach under the Drupal hood only sporadically, I love how how Matt quickly covers all the basic terminology and functionality of Drupal, JavaScript, and jQuery to remind me how they all work, and work together. I can see turning to this book as a basic reference again and again.

Best of all, in each chapter Matt provides a hands-on project worth doing for it’s own sake as well as for the added learning. Trying it out, I modified the rotating sticky node teasers project in Chapter 3 to complete something I’ve been wanting to do here on my blog for some time: make my Flickr-stream header images rotate dynamically. Read more about exactly how I did it. If I can do something like this in just a few minutes, that tells you a lot about the power and simplicity of Drupal and jQuery together, and Matt’s ability to make it all understandable.

Ready to dip your toes or delve deeper into how jQuery let’s you “write less, do more” with Drupal? You can buy Matt’s Drupal 6 JavaScript and jQuery book directly from the Packt website.

FYI: I drafted this entire review sitting on an Oregon coast beach using the Evernote iPhone app. Pretty nice working conditions ;)

Ubiquity: Everything, Everywhere

A couple of days ago, Mozilla Labs released an alpha version of Ubiquity, a Firefox extension that puts crowd-sourced, powerful, mashup commands a keystroke away in your browser. My first thought was that it was like the Mac OS utility application, Quicksilver, but for the entire web rather than just the local operating system, an idea clearly shared by others.

While ubiquity is still young, its potential seems great, so I thought I’d test it out by creating a new ubiquity command for a basic web task I often find myself wishing were easier and quicker: making a trackable, shortened "twurl" URL via Tweetburner.

Once you’ve installed ubiquity, you can try out my twurl command, which will immediately give you basic twurl functionality and more to come…with no further action needed on your part to receive any upgrades I might make. For example, I’m still working out authentication with Tweetburner to enable the shortened URLs produced by this command to link to your Tweetburner identity so you can monitor clickthroughs.

A major issue on the horizon is trust: how will I know which of these powerful ubiquity commands to let in the door? Mozilla promises to initiate a "trust network" to address this issue, but until it’s in place, you’re left trusting only in your ability to grok javascript code and your sense of adventure. I guarantee I don’t know enough JS to do anything evil, so you’re safe with my example command ;)

In the meantime, check out the growing list of ubiquity commands you can subscribe to, either by browsing Mozilla’s wiki page, or exploring the folks that have used ubiquity’s "herd" command to register available commands.

Following are experimental Ubiquity commands I’ve authored. Please note, both Ubiquity itself and these commands are in an alpha stage—use both only at your own risk.

Twurl

Replaces a provided URL with a shortened tweetburner.com/twurl.nl URL.

Roadmap

  • Enable Tweetburner authentication to enable tracking shortened URL usage.
  • Change behavior to shorten currently highlighted URL and put shortened URL into clipboard.
CmdUtils.CreateCommand({
  name: "twurl",
  takes: {"URL to shorten": noun_arb_text},
  homepage: "http://xolotl.org/ubiquity",
  author: {name: "Nate Angell", homepage: "http://xolotl.org/", twitter: "xolotl"},
  license: "MPL",
  description: "Replaces a provided URL with a shortened tweetburner.com/twurl.nl URL.",
  help: "If you're in an editable form field, inserts a shortened tweetburner.com/twurl.nl URL pointing to the URL you provided.",
  preview: "Replaces a provided URL with a shortened tweetburner.com/twurl.nl URL.",
  execute: function(urlToShorten) {
    var baseUrl = "http://tweetburner.com/links";
    var params = {'link[url]': urlToShorten.text};
    jQuery.post(baseUrl, params, function(data) {CmdUtils.setSelection("http://twurl.nl/" + data.sid);},'json');
  }
})