Compatibility with browserify

In a browserify package, `this` will refer to a node-style
exports object, not window. So just reference `window`
directly.
Merge pull request #1572 from jfirebaugh/browserify

Compatibility with browserify