diff --git a/lib/mcommon.js b/lib/mcommon.js index 6ae1525..82ad7a2 100644 --- a/lib/mcommon.js +++ b/lib/mcommon.js @@ -43,7 +43,7 @@ function decodeBase64(content) { // add enter to decrypt -window.onload = function() { +addLoadEvent(function() { console.log('register'); document.getElementById("pass").onkeypress = function(keyPressEvent) { console.log(keyPressEvent.keyCode === 13); @@ -51,4 +51,16 @@ window.onload = function() { decryptAES(); } }; -}; +}); + +function addLoadEvent(func) { + var oldonload = window.onload; + if (typeof window.onload != 'function') { + window.onload = func; + } else { + window.onload = function() { + oldonload(); + func(); + } + } +} diff --git a/package.json b/package.json index bc46cc1..cf02f43 100644 --- a/package.json +++ b/package.json @@ -33,5 +33,5 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "version": "1.1.7" + "version": "1.1.8" }