Javascript

Ubiquity - A New Direction in Web UI

Mozilla labs has released a slick new Firefox extension called Ubiquity that aims to streamline the most common tasks you do in your browser as well as make things that seemed otherwise overly difficult or complicated, much more easier. I've seen it being called everything from "Quicksilver for Firefox" to "mashups for dummies". There's plenty of buzz around the net to fill you in on the details, so I won't go into that here.

I certainly like what I see in Ubiquity. It goes way beyond what Quiksilver does (or can do) and its more thant just a "mashup". Its capabilities are virtually limitless. But, what I've liked most so far about Ubiquity is how easy it is to extend. In a matter of about an hour I saw the headline on reddit about "the future of the web browser", watched Aza's cool video, wrote two simple, trivial commands, published my commands, and watched as over a dozen different people (whom I don't know nor didn't pay) downloaded and began using those commands. That says a lot about the tool and the creators over at Mozilla labs.

Its definitely something to check out if you haven't done so already.

Oh, and about those commands. The first allows you to submit any page you're on to the W3C's markup validator. Just ubiq "validate" and hit enter. You can catch that one here.

The last command I wrote is basically a shortcut to Drupal's API. Ubiq "drupal" followed by a core function, file name, constant, global or topic, hit enter and you'll land softly on the correct Drupal API page.

Drupal API Ubiquity Command

One last thing, if you haven't heard about the IE Death March, go show your support.

Rails' observe_field with :on - Rails 2.0

In a previous post I showed how to get around a bug in Prototype that was ignoring the "on" parameter of the observe_field function. The solution I originally posted no longer works with the latest version of Rails and Prototype. Although the documentation for observe_field received a facelift, somehow the Rails team still missed the fact that the :on function doesn't work with the current version of Prototype. Or maybe its the Prototype guys we should be after here. :-)

The new fix requires a change to both prototype.js and a small Rails core update.

I will start with the update to prototype.js. Search for Abstract.EventObserver (around line 3632 in my version). That should now read

Abstract.EventObserver = Class.create({
  initialize: function(element, callback, trigger) {
    this.element  = $(element);
    this.callback = callback;
    this.trigger = trigger;

    this.lastValue = this.getValue();
    if (this.element.tagName.toLowerCase() == 'form')
      this.registerFormCallbacks();
    else
      this.registerCallback(this.element, this.trigger);
  },

  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },

  registerFormCallbacks: function() {
Syndicate content