Skip to content

Commit

Permalink
Updating the build with latest module defines.
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed Apr 19, 2016
1 parent 584d00f commit 55ae32d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
12 changes: 10 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ module.exports = function(grunt) {

var suffix = 'exports.JSEncrypt = JSEncrypt;' + "\n";
suffix += '})(JSEncryptExports);' + "\n";
suffix += 'var JSEncrypt = JSEncryptExports.JSEncrypt;' + "\n";
suffix += '(function (global, factory) {' + "\n";
suffix += ' if (typeof exports === \'object\' && typeof module !== \'undefined\') {' + "\n";
suffix += ' module.exports = factory;' + "\n";
suffix += ' } else if (typeof define === \'function\' && define.amd) {' + "\n";
suffix += ' define(factory);' + "\n";
suffix += ' } else {' + "\n";
suffix += ' global.JSEncrypt = factory;' + "\n";
suffix += ' }' + "\n";
suffix += '}(this, JSEncryptExports.JSEncrypt));' + "\n";

// Project configuration.
grunt.initConfig({
Expand Down Expand Up @@ -95,7 +103,7 @@ module.exports = function(grunt) {

// Default task(s).
grunt.registerTask('default', ['jshint', 'concat', 'uglify']);

// Only run jekyll on a grunt build.
grunt.registerTask('build', ['jekyll']);
};
24 changes: 15 additions & 9 deletions bin/jsencrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1289,9 +1289,13 @@ if(rng_pool == null) {
window.detachEvent("onmousemove", onMouseMoveListener);
return;
}
this.count += 1;
var mouseCoordinates = ev.x + ev.y;
rng_pool[rng_pptr++] = mouseCoordinates & 255;
try {
var mouseCoordinates = ev.x + ev.y;
rng_pool[rng_pptr++] = mouseCoordinates & 255;
this.count += 1;
} catch (e) {
// Sometimes Firefox will deny permission to access event properties for some reason. Ignore.
}
};
if (window.addEventListener)
window.addEventListener("mousemove", onMouseMoveListener, false);
Expand Down Expand Up @@ -4321,10 +4325,12 @@ JSEncrypt.prototype.getPublicKeyB64 = function () {

exports.JSEncrypt = JSEncrypt;
})(JSEncryptExports);

// module support
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory :
typeof define === 'function' && define.amd ? define(factory) :
(global.JSEncrypt = factory);
}(this, JSEncryptExports.JSEncrypt))
if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = factory;
} else if (typeof define === 'function' && define.amd) {
define(factory);
} else {
global.JSEncrypt = factory;
}
}(this, JSEncryptExports.JSEncrypt));
Loading

0 comments on commit 55ae32d

Please sign in to comment.