Acko.net
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:
12 Jul 02:04

"Drupal 6 core now consists

"Drupal 6 core now consists of 8% JavaScript. This is quite a lot."

Is it good? Is it bad?
Or just statistical info ?

19 Jul 20:54

I find myself relying on JS more and more

I refer to Drupal for a lot of inspiration and ideas when I work on my own made CMS, framework, whatever you want to call it. When you announced a while back that jQuery was being added to Drupal, I had no idea what to think, because I simply did not know what jQuery was, nor did I ever use a JS framework (jQuery? Scriptaculous? Prototype? What are those?!). Now I know better and since then, I've ventured into jQuery and have become a convert (and I'm less prone to trying to make purdy things happen with JS with my own code as opposed to using jQuery). As a result, I'm using a lot more AJAX functionality as opposed to needing a page refresh to do whatever I need to do, and also adding the simple, yet effective touches that make my websites better than the rest (at least I like to think so...).

How does one get a figure like this? If I wanted to see just how much my own work depended on JS, what would I do to get a percentage? Some of my clients have hardly and JS, while others depend on it heavily for certain types of functionality (because sometimes the best option is using JS).

I learned from many mistakes that other websites have made in over saturating their site with lousy JS code that simply did not fit, did not work properly, and ruined the whole experience of enjoying a website. Seeing some of the high caliber work that you've done, Steven, has helped make be more mindful of just what is going to happen when I execute a certain function. So um, thanks :D

22 Jul 22:07

JQUERY COLOR SELECTOR

by Anonymous

Your jquery color picker looks good. I;m trying to get a basic idea of how to do something similar within Drupal

I'm creating a t-shirt site with Drupal and Ubercart, and I'm trying to get the colors on a t-shirt object change when the user selects a color from the drop down list.

I figure this can be done with Javascript, but what would be the basic code for this using the more compact jquery?

Your response will be greatly appreciated.

RJ

24 Jul 12:43

RJ

by Steven

RJ: Drupal already has an example of Farbtastic in color.js. What you're asking sounds suspiciously like "do my work for me". jQuery and Farbtastic are both documented and JavaScript is not rocket science.

03 Aug 05:45

How beautiful you website-

by Nauck

I really like the design. currently i'm peeking into drupal to check it out. before i usually installed joomlas but you also gotta know how other things work.... so i check it you and found your site on the way. impressive

15 Aug 03:35

Statistics flawed

Just a note, Ohloh's statistics for Drupal are/were flawed because the system doesn't/didn't recognize .module, .inc, etc as PHP source files, thus not all PHP code is getting counted. This is a known problem but I don't know if it has been fixed already. In any case, according to the latest statistics JavaScript forms only 7% of Drupal's code.

10 Jan 06:39

Wanted to comment on your theater festival site

by Steven Malcon

I was just looking at your design for the theater festival - it's just beautiful. I wanted to leave a comment on that post, but comments seem to be closed there.

I found one of the Easter eggs (the handle) and have yet to find the second. Lovely work, and thanks for sharing it.

03 Mar 10:37

thakns

by oyun

Your jquery color picker looks good. I;m trying to get a basic idea of how to do something similar within Drupal

I'm creating a t-shirt site with Drupal and Ubercart, and I'm trying to get the colors on a t-shirt object change when the user selects a color from the drop down list.

I figure this can be done with Javascript, but what would be the basic code for this using the more compact jquery?

Your response will be greatly appreciated.

03 Mar 10:39

thanks...

by çocuk oyunları

really like the design. currently i'm peeking into drupal to check it out. before i usually installed joomlas but you also gotta know how other things work.... so i check it you and found your site on the way. impressive

11 Mar 21:17

sweet

Loving the '... slight problem with NS 4.76' note in the yaroon theme. Definitely dealt with those issues before...

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul> <img> <em> <p> <br> <span> <div> <h2> <h3> <abbr> <small> <table> <tr> <td> <strong> <acronym> <th> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options