From 1bbbaf068f7c3da022e5d2b08c3a1e6c7b8faa61 Mon Sep 17 00:00:00 2001 From: Mike Tang Date: Wed, 26 Oct 2016 10:58:12 +0800 Subject: [PATCH] update to v1.1.8 1. change the onload function load method --- lib/mcommon.js | 16 ++++++++++++++-- package.json | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) 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" }