UMD pattern for CommonJS and AMD compatibility

This makes it easy to use the plugin when using Browserify/CommonJS and RequireJS/AMD, while still remaining compatible with normal script includes.