Acko.net

JavaScript

04 Jul 2007

Drupal: Now with 8% Yummy

According to Ohloh, Drupal 6 core now consists of 8% JavaScript. This is quite a lot.

Ohloh statistics for Drupal core: 8% JavaScript

Drupal and JavaScript haven't always seen eye to eye though.

While the first clean and consistent usage of JavaScript in core was the textfield autocompleter and accompanying drupal.js base (committed a little over two years ago), this was not the first line of JavaScript in Drupal core.

The Yaroon theme for example had a little JS dropdown navigator in 2001, while the Goofy theme used JavaScript to compress its gigantic table-based markup—yes, we were n00bs at one time too. In fact it took until January 2003 (with the retiring of the Goofy theme) for core to go back to plain PHP, HTML and CSS.

From that point on, JavaScript was shunned and suggesting it as a solution to a problem was sure to cause grumpy voices to rise. So it's not surprising that in 2005, a lot of people were skeptical about the proposed JavaScript features for Drupal 4.7. Still, the new incarnation was written with the clear mindset that everything must degrade gracefully without it, and that the methods used should be accessible, extensible and clean. The code got committed and was eventually released in May 2006.

Even so, it really wasn't until we included the jQuery library in Drupal 5 core that a significant amount of Drupal contributors started working with JavaScript in their modules and themes, as it lowered the barrier to entry for browser scripting massively.

Given all that, I'm quite impressed with this 8% figure for core. Slowly but surely, JavaScript in Drupal has gone from ugly duckling to shining star.

Tags:
09 Mar 2007

ComicJuice gets even better

I finished some more tweaks to ComicJuice:

  • IE6 and 7 are now supported, thanks to the amazing ExplorerCanvas by Google. It emulates the <canvas> tag in IE, meaning that client-side scriptable vector graphics are now available on all the major browsers (IE, Firefox, Safari, Opera). I doubt Konqueror will be far behind.

    This opens up some cool abilities, like dynamic in-page graphs, mini-widgets (sliders, dials, maps, ...) and even pure JS games. There's a bunch of examples linked on Wikipedia (though most don't use ExplorerCanvas yet).

  • I added support for uploading your own images rather than using pictures on the web. It uses a customized and themed version of core's JS uploader.
    comic juice
  • I improved the clipping of speech bubbles so there should be less useless whitespace around comics, especially when embedding them.

If you haven't played around with it yet, give it a shot. No registration is required if you just want to play around.

Tags:
06 Mar 2007

Announcing.... ComicJuice!

I'm proud to announce the start of ComicJuice, a web 2.0 social mashup tool that lets you create comics in your browser and share them with others.

Update: Now with Internet Explorer support! Thanks to Google's ExplorerCanvas. Viewing comics works in IE6 and 7, while editing still requires IE7.

The crazy part is that I started working on this only friday evening (that's 4 days ago). Once I had the initial idea and a rough plan, I simply couldn't not code it.

27 Oct 2006

Mouse Handling and Absolute Positions in JavaScript

As I was working on the new recolorable Garland Drupal theme, I noticed that suddenly my Farbtastic color picker wasn't working right anymore in IE. A lot of headscratching later, I found the cause and discovered a useful trick for dealing with mouse coordinates in JavaScript.

Tags:
01 Sep 2006

jQuery is in Drupal core!

After a long wait, the awesome jQuery library has finally been committed to Drupal core. jQuery 1.0 will be part of the next major Drupal release, for which the code freeze is about to begin.

While we did take advantage of jQuery to add some minor glitter to our JavaScript features, the main advantage is that it makes it easier to develop JavaScript features. Using a simple CSS-based syntax, you can manipulate any element in the page easily. Loading in chunks of HTML through Ajax is a snap too.

Hopefully jQuery will help more Drupal developers look at using JavaScript to build kick-ass interfaces in the browser.

Thanks to John Resig and the jQuery community for making such an awesome library. On the Drupal site, thanks to: Konstantin, Steve, Angie, Ted, Jeff and everyone else who tested the patch.

See also: 'New Wave' JavaScript in Drupal: jQuery.

PS: There will still be some bugs in there that I haven't found, but that's what the code freeze is for ;).

Tags:
14 Jul 2006

Farbtastic color picker released

A while ago I made a nifty JavaScript color picker, but never got around to fully testing or releasing it. Recently Mark Burdett contacted me to ask if he could use it.

So I cleaned up the code, converted it to use the excellent jQuery library (which will soon be making it into Drupal) and put it online under a GPL license.

Check it out.

PS: What about jQuery-in-Drupal? Well, I'm essentially waiting for jQuery to hit 1.0. They're now in the 'alpha' stage, with a release candidate on the horizon soon. The adventurous can already try this patch, but the version of jQuery used is not fit for general consumption.

Tags: