JavaScript

JavaScript Theme Functions in Drupal

Posted: May 16, 2011 In / 5 Comments

Drupal has an extensive theming system which includes theme functions that can be overridden and an extensible template system. There is an expectation that all markup go through the theme system and it is considered a bug when that doesn't happen. Most of the talk surrounding this system focuses on the server side system and what we can do in PHP. But, that's not all there is to the theme system. Drupal provides a theme system for JavaScript as well. One with callbacks that can be overridden by themes, just like on the PHP side. Read more »

Translatable Strings In Drupal JavaScript

Posted: May 2, 2011 In / 1 Comment

Drupal is known for being highly translatable. The localization team has done a fantastic job building out tools to make Drupal translatable and it's rare to find a module that doesn't properly wrap its strings in the t() function or the lesser known format_plural() function. While the Drupal community is doing fairly well on the PHP side, many people don't know there is a translation system for Drupal JavaScript as well through the use of the Drupal.t() and Drupal.formatPlural() functions. Read more »

Build your JavaScript With jQuery 1.5.2 in Drupal 7

Posted: April 5, 2011 In / 2 Comments

Shortly after Drupal 7 launched the version of jQuery shipped with Drupal became outdated. Drupal 7 ships with jQuery 1.4.4 but the jQuery community has shipped jQuery 1.5.2. When we are developing the JavaScript in our shinny new Drupal 7 we are already using an outdated version of jQuery. But, there is a solution. The jQuery Update module provides an update for core to jQuery 1.5.2 and jQuery UI 1.8.11. Read more »

Drupal 8 JavaScript Excellence Roadmap

Posted: March 18, 2011 In / 9 Comments

Over the past several months there has been a bit of talk attempting to answer the question, how can we make our JavaScript something we can be proud of and others want to use. Through the conversations, which included a Birds of a Feature session at DrupalCon Chicago, we (a number of people in the community) have come up with eight points of attack to make the JavaScript in Drupal 8 awesome. These aren't everything we hope to accomplish but are an important piece of the puzzle. Read more »

Making Drupal's JavaScript Rock Hard Awesome

Posted: February 17, 2011 In / 26 Comments

The JavaScript shipped with Drupal core is not all that great. If I'm going to be completely honest I have to say that at times I feel the code reminds me of something a JavaScript guru said to me when he said, "Some of the worst JavaScript I've seen is in Drupal core." Ouch. While I don't think this is completely true, there is some massive room for improvement.

The improvements needed to Drupal's JavaScript are no surprising to those familiar with it. For months there have been back channel conversations trying to figure out a plan of attack for Drupal 8. Once we have a plan of attack it becomes much easier to rally the troops, make design decisions, and collectively make Drupal 8 a release that shines for JavaScript. With that in mind here are four points that I think are essential to making JavaScript great in Drupal 8. Read more »

Review: Even Faster Web Sites

Posted: November 10, 2010 In / 1 Comment

Even_Faster_Web_Sites.jpgBuilding high performing front ends to websites is often an after thought. This is especially true if you look at Drupal sites and even the high end of Drupal sites. I just finished reading Even Faster Web Sites: Performance Best Practices for Web Developers, a book by Steve Souders the original author of YSlow, author of High Performance Websites, and a Google Engineer. This book directly deals with making sites fast.

Over the past few years I've read a lot about making websites fast. Most of what I've read and heard dealt with making the servers run fast by using reverse proxies, better server caching system, CDNs, and other server side elements. But, the performance websites users experience is based on a lot more than these. And, because most web developers build sites locally or sit on the highest speed of internet connections they don't experience what most of the world does with websites. This other side of performance that can have a large impact on end users is what Even Faster Web Sites addresses. Read more »

Fixing The Drupal JavaScript Problem Examples Explained

Posted: November 2, 2010 In / 8 Comments

In my previous post explaining the Drupal JavaScript problem I posted a litmus test to see if anyone else noticed what was wrong. I was asked to share the answer I was looking for and some tried to answer it. Sadly, no one approached me with what I was looking for. So, here is a walk through explaining some of he problems we have in our JavaScript (all examples are from Drupal 7 Beta 2). Read more »

Fixing The Drupal JavaScript Problem

Posted: November 1, 2010 In / 9 Comments

JavaScript is a second class language within Drupal. This shouldn't be a surprise and there is no one to point the blame at. Drupal has been around since JavaScript was used for window dressing (like snowflakes falling down your page). In the last several years JavaScript has blossomed and is used everywhere. Drupal has taken notice and recent versions of Drupal ship with a lot of JavaScript. Drupal 7 ships with jQuery, jQuery UI, and several other useful plugins.

But, the custom JavaScript within Drupal looks a lot like it was written by PHP developers who learned just enough JavaScript to be dangerous. I say that as someone who has contributed to producing sub-par JavaScript. As a community it is time we fix this problem. We need to grow some solid JavaScript developers and make the world of Drupal JavaScript a better place. Read more »

Script Editing in Chrome 6

Posted: September 9, 2010 In

jQuery Date and Time Pickers

Posted: April 12, 2010 In / 1 Comment

Recently, I was looking into date and time pickers for jQuery. jQuery UI has a great datepicker but I wanted something that provided a slick time input as well. When I did some searching I found quite a few options but two seemed to stick out above the rest. Read more »