Support require.js/AMD.

This is along the lines of https://github.com/umdjs/umd/blob/master/jqueryPlugin.js