Support require.js/AMD.

This is along the lines of https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
Add CommonJS support as well
Merge pull request #593 from mpdude/support-amd

Support require.js/AMD and CommonJS