jQuery 1.9 compatability, fixing conflict with other gems

Code from 2 pull requests in original repo