I’ve just pushed some pretty hefty changes to the jQuery.Gantt project I’ve been developing with lately. I tried some other Gantt libraries, but they were either dependant upon ExtJS, no longer maintained or just didn’t play nicely with my pre-existing code.
I settled on jQuery.Gantt, but there were a few things I found that really kept it from being an accessible, front-end developer friendly resource. For instance, you could previously only specify a URL as a data source, and not a local object. I needed to pre-parse another JSON feed before plugging it into the chart. There were also some conflicts when using the Twitter bootstrap, and the inability to place attributes on the Gantt bars meant no sexy popovers like below.

A lengthy list of changes follows:
- Reduced conflicts with Twitter Bootstrap by name-spacing styles
- Source now accepts data from a local object, not just a JSON call
- Can now extend data properties on to bars for use with Bootstrap popovers etc.
- Code is now “use strict”
- Fixed a couple of errors resulting from “use strict”
- Various English translations: renamed months and days to english, hollydays/holidays
- Redesigned buttons and slider with CSS3 and an image sprite
- Modified category colours and styles
- Made chart 100% width so it responds to parent container width
- Began enforcing front end dev guidelines such as double quotations (but singles on HTML strings), triple equals comparison and using spans instead of hyperlinks for JavaScript interactivity
- Updated demo page doctype to HTML5
- Moved body styles from stylesheet to page to reduce style conflicts
Flash-free Google Analytics with Highcharts - UX Lab 002
The reliance upon Flash to produce the charting on Google Analytics has frustrated myself and other web devs for a while now. When Google announced a new premium package it appeared that they had spent some time overhauling their product. I was genuinely curious, as it’s impossible to view your analytics on an iOS device without using a third party application. I was, of course, disappointed. I made what I thought was a valid comment on Hacker News and entered into a bit of a debate.
Regardless of Android vs. iOS motives, regardless of internal politics, what I said still holds true. A front end dev could pump out a proof of concept with a jQuery UI datepicker and the amazing Highcharts in a matter of minutes. I decided to go the other way and produce a facsimile product that took just over an hour.
Highcharts is an absolutely amazing product. You might catch me harping on about it on Twitter every so often, but it’s because I think it’s that damn good. It’s a mature product, well supported by the creators on it’s support forum.
There was little I wasn’t able to visually match between the libraries. The remaining gaps such as the microcharts could probably just be patched with jQuery sparklines or something similar.

Put simply, there is no technological reason Google couldn’t release a non-Flash version of Analytics tomorrow. They probably already have one in their own labs. Why has it taken so long? I can’t answer that. But I’m not sure I can wait much longer either.
Introducing the UX Lab
The lab is a place for me to share my thoughts and experiments with the web development community. While the name indicates a user interaction and user experience focus - I’ll also be sharing CSS3, JS and HTML5 tidbits. My aim is to make the web a better, more consistent place. And what better way to achieve that than by leading by example.
The experiments will be hosted as one main repo on GitHub. That way you can easily view the code, download any resources, as well as forking or branching it for your own purposes.
Some of the cool things to come:
- Credit Card Type - Passive Selection
- jQuery UI Slider Toggle Switches
- Mac vs. Windows Close Buttons
- Flash-free Google Analytics
- and more…
Chosen - a javascript select thingy
I’ve been using the Select Menu plugin by Filament Group, but this looks like it’s possibly better. The reason I like the Filament Group one so much is it’s adherence to jQuery UI practices in classing etc and it’s full ARIA compliance.
Chosen is a javsacript plug-in makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.
Project page on GitHub
@font-face Smoothing in Windows Chrome
WARNING: THE FIX BELOW IS DEPRECATED IN CHROME 16 + 17. SAD-FACE :(
You may have noticed the issue in which @font-face embeds rendered in Windows Chrome look mighty jagged. Fixes such as -webkit-font-smoothing barely do anything, so this hack relies on a fairly well known fact about Windows Chrome: putting text-shadow on anything makes it blurry as shit. Original implementations of the hack relied on a solid text-shadow colour, but this no longer works in recent updates. It is now vital to enter an rgba() value instead.
Hopefully you will end up with something like this:
h1, h2, h3, h4, h5 {
font-family: ‘TodaySHOP-BoldRegular’;
text-shadow: 0 1px 0 rgba(0,0,0,0.01);
}
Real World Examples:
A real world example of this is best demonstrated on my own Front End Development Guidelines. My header tags were smoothed out with a solid hex colour, prior to the rgba() update. They’re still broken to date. Oops.

But the problem is much more widespread. Consider this ironic blog post on IE font smoothing by @Koodoz, in which the Chrome problem rears its ugly head again. It leads to some interesting accidental changes, where “hate” has become “hale”.

Caveats:
Be aware that this can modify the kerning of the text. There are also situations where the font is hinted in a way that this hack is detrimental. The over-used League Gothic, for example, does not bode well with this method at smaller font-sizes. There were also some comments that this makes Chrome on Mac even blurrier than usual.
Credit:
I’ve been trying to track down who taught me this little trick for a while now. I originally assumed it was @Koodoz, as he invests heavily in @font-face in his designs - but it was news to him. I thought it might be @Rainerbird, as we both read the same kind of stuff online. No dice there either. This blog post also describes the method, but I have probably been using the method just as long and don’t recall visiting that site. The comments and feedback on that blog post are great for further explaining the method and its shortfalls. ■
My role with my last employer involved creating websites, applications and widgets with front end technologies like HTML, CSS and JavaScript. Other parts of my job included code reviewing commits and running training exercises to spread the knowledge around. When I handed in my three weeks notice, they were quick to ask me to write up guidelines on the best way to write maintainable, clean and accessible code. What follows is a GitHub hosted document, allowing for revisions, forking and issue logging - a concept I “borrowed” from the great resource JavaScript Garden.
Considering my knowledge is all gleamed from many years of reading Hacker News and following Twitter links, it definitely has holes. I am completely self taught in that regard. So although I can’t vouch for the accuracy of all the information, hopefully you can log any corrections or raise any questions via the issues interface.
Linking JavaScript Objects to HTML Elements
Alternative Title: The jQuery $.data() Function is Awesome
![]()
The Workflow creation tool I’ve been working on and blogging about (design & code pattern) would have been impossible without forcing myself to learn object oriented (OO) JavaScript. It was a pretty steep learning curve for a designer, and I soon came across the common pitfalls of writing OO code. The factory pattern structure I linked to above took care of most of the problems like: pushing pseudo-class objects to an array, easy find methods without the use of hash tables, and deleting objects non-destructively.
One thing that took me a while to wrap my head around: How do you form a relationship between the “back end” object instances and the HTML/DOM objects you output from these?
Say you have the classic Person object example:
var collection = [];
var Person = function(params) {
this.name = null;
this.age = null;
$.extend(this, params);
collection.push(this);
}

When I came across the problem of being able to link back to the object itself, the first (and laziest) solution that jumped to mind was searching using an instance’s unique ID. Creating the objects initially gives you the chance to ensure the HTML and back end instance shared the same ID. At a later point when you need to find the instance, you can loop through your objects with class manager shorthand findBy() function:
Manager.prototype.findBy = function(p, v) {
for(var i = 0, len = this.objs.length; i < len; i++) {
if(this.objs[i][p] === v) {
return this.objs[i];
}
}
};MyManager.findBy(“id”, 999);
This made a lot of sense initially:
- HTML attributes can only be strings.
- Make the HTML element and the back end object share an ID
- Loop through and match the object when required
![]()
An Example
In this example, we have to get the ID from the HTML element, convert it to an integer and then finally: loop through all the instances until it finds a match.
// get the ID value
var theID = parseInt($(this).attr(“objectID”), 10);
// silly loop to find the object
$(collection).each(function(i, item) {
if (item.id === theID) {
item.birthday();
}
});
But why bother looping? Maybe a hash table would be better suited to your scenario, but for me I wanted something more dynamic.
![]()
The Better Way
The jQuery $.data() method is awesome. On face value it’s like the native $.attr() method but doesn’t restrict you to a string value. What this incredibly long-winded post boils down to is the realisation that you can bind your HTML elements directly to their back end objects via the use of the data attribute. No (visible) loops.
// set the data attribute originally
$(obj).data(“personObject”, self);// call birthday on the object directly
var theObject = $(this).data(“personObject”);
theObject.birthday();
You don’t even have to declare a reference to the object, you could just as easily chain up your calls. A word of warning though: this can get a bit confusing if you’re using a chaining library like jQuery, especially if your object prototype functions share names like “remove()”. ■
JavaScript Gesture Recognition for Touch Screens
Introducing “Gestures”, a proof-of-concept for front-end gesture recognition on iOS and Android devices. There is nothing particularly revolutionary going on here, I simply re-tooled the $1 Unistroke Recognizer to accept mobile safari and android touch screen device input. I was surprised to notice no-one had yet implemented web based touch and gesture recognition (for mobiles) to this degree, so I’ve chucked the code up on GitHub, and hosted a static page for a demo.
I didn’t want to spend much time on the design for such a simple experiment, so many thanks must go out to @Powic for allowing me to use the wallpaper from his Tron theme.
![]()
Aristo 0.8 + Minor Milestone

Icon courtesy: www.icondrawer.com

Aristo nudged up 250 GitHub followers recently, with the current count sitting at 254.
The 0.8 release is a minor update, fixing the buttons that were broken to a structural change to .ui-buttons in the jQuery UI 1.8.5 release. There are 3 open issues, but I haven’t had the time to look at these as of yet. I am still without internet following the big move to my new apartment, so thanks to those who pushed commits to the master.




