Is this correct for you?

Just check out the PR branches (https://gist.github.com/piscisaureus/3342247) and run the index.html file! ;)