From 53fd6173be0c6139b5772bd8288cb78660d5d5e0 Mon Sep 17 00:00:00 2001 From: bankrot Date: Mon, 21 Sep 2015 22:32:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B5=D1=80=D0=B6=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D0=B2=D1=8B=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=BC=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/alt_cadesplugin_api.coffee | 4 +++- src/alt_cadesplugin_api.js | 4 +++- src/alt_cadesplugin_api.min.js | 2 +- test/js/alt_cadesplugin_api.js | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/alt_cadesplugin_api.coffee b/src/alt_cadesplugin_api.coffee index 20d48f5..1a9cfe7 100644 --- a/src/alt_cadesplugin_api.coffee +++ b/src/alt_cadesplugin_api.coffee @@ -101,7 +101,9 @@ AltCadesPlugin = class listener = (event)-> if event.data isnt 'cadesplugin_loaded' return - cpcsp_chrome_nmcades.check_chrome_plugin success, fail + setTimeout (-> + cpcsp_chrome_nmcades.check_chrome_plugin success, fail + ), 0 window.addEventListener 'message', listener, false diff --git a/src/alt_cadesplugin_api.js b/src/alt_cadesplugin_api.js index 0870046..dede7d7 100644 --- a/src/alt_cadesplugin_api.js +++ b/src/alt_cadesplugin_api.js @@ -144,7 +144,9 @@ AltCadesPlugin = (function() { if (event.data !== 'cadesplugin_loaded') { return; } - return cpcsp_chrome_nmcades.check_chrome_plugin(success, fail); + return setTimeout((function() { + return cpcsp_chrome_nmcades.check_chrome_plugin(success, fail); + }), 0); }; window.addEventListener('message', listener, false); setTimeout(((function(_this) { diff --git a/src/alt_cadesplugin_api.min.js b/src/alt_cadesplugin_api.min.js index 1602c81..2750d64 100644 --- a/src/alt_cadesplugin_api.min.js +++ b/src/alt_cadesplugin_api.min.js @@ -1 +1 @@ -!function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):t.AltCadesPlugin=e(t.$)}(this,function(t){var e,n,r=function(t,e){return function(){return t.apply(e,arguments)}},i=[].slice;return t&&!e&&(e=t),n=function(){function t(t){null==t&&(t={}),this.get=r(this.get,this),this.getParam=r(this.getParam,this),this.createObject=r(this.createObject,this),this.nonNpapiInit=r(this.nonNpapiInit,this),t.timeout&&(this.timeout=t.timeout),this.cadesplugin.JSModuleVersion="2.0",this.cadesplugin.async_spawn=this.asyncSpawn,this.cadesplugin.set=function(t){return function(e){return t.pluginObject=e}}(this),window.cadesplugin=this.cadesplugin}return t.prototype.checked=!1,t.prototype.cadesplugin={},t.prototype.pluginObject=null,t.prototype.timeout=2e4,t.prototype.asyncSpawn=function(t){var e,n,r,i;return e=function(t,e){var u,o,c;try{c=n[t](e)}catch(o){return u=o,Promise.reject(u)}return c.done?c.value:Promise.resolve(c.value).then(r,i)},n=t(Array.prototype.slice.call(arguments,1)),r=e.bind(e,"next"),i=e.bind(e,"throw"),r()},t.prototype.nonNpapiInit=function(){var t,n,r,i;return e("head").append(''),t=e.Deferred(),window.postMessage("cadesplugin_echo_request","*"),i=function(e){return function(){return e.checked=!0,t.resolve()}}(this),n=function(e){return function(n){return e.checked=!0,t.reject(n)}}(this),r=function(t){return"cadesplugin_loaded"===t.data?cpcsp_chrome_nmcades.check_chrome_plugin(i,n):void 0},window.addEventListener("message",r,!1),setTimeout(function(e){return function(){return e.checked?void 0:t.reject("timeout")}}(this),this.timeout),t},t.prototype.createObject=function(t){var n;return n=e.Deferred(),this.pluginObject.CreateObjectAsync(t).then(function(t){return n.resolve(t)},function(t){return n.reject(t)}),n},t.prototype.getParam=function(t,n){var r,i,u;return u=function(t,e){var n;return"object"==typeof e?t[e.paramName].apply(null,e.options):n=t[e]},i=e.Deferred(),r="string"==typeof t?this.pluginObject.CreateObjectAsync(t).then(function(t){return u(t,n)}):u(t,n),r.then(function(t){return i.resolve(t)},function(t){return i.reject(t)}),i},t.prototype.get=function(){var t,e,n;return e=arguments[0],n=arguments[1],t=3<=arguments.length?i.call(arguments,2):[],this.getParam(e,n).then(function(e){return function(n){return t.length>0?(t.unshift(n),e.get.apply(e,t)):n}}(this))},t}()}); \ No newline at end of file +!function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):t.AltCadesPlugin=e(t.$)}(this,function(t){var e,n,r=function(t,e){return function(){return t.apply(e,arguments)}},i=[].slice;return t&&!e&&(e=t),n=function(){function t(t){null==t&&(t={}),this.get=r(this.get,this),this.getParam=r(this.getParam,this),this.createObject=r(this.createObject,this),this.nonNpapiInit=r(this.nonNpapiInit,this),t.timeout&&(this.timeout=t.timeout),this.cadesplugin.JSModuleVersion="2.0",this.cadesplugin.async_spawn=this.asyncSpawn,this.cadesplugin.set=function(t){return function(e){return t.pluginObject=e}}(this),window.cadesplugin=this.cadesplugin}return t.prototype.checked=!1,t.prototype.cadesplugin={},t.prototype.pluginObject=null,t.prototype.timeout=2e4,t.prototype.asyncSpawn=function(t){var e,n,r,i;return e=function(t,e){var u,o,c;try{c=n[t](e)}catch(o){return u=o,Promise.reject(u)}return c.done?c.value:Promise.resolve(c.value).then(r,i)},n=t(Array.prototype.slice.call(arguments,1)),r=e.bind(e,"next"),i=e.bind(e,"throw"),r()},t.prototype.nonNpapiInit=function(){var t,n,r,i;return e("head").append(''),t=e.Deferred(),window.postMessage("cadesplugin_echo_request","*"),i=function(e){return function(){return e.checked=!0,t.resolve()}}(this),n=function(e){return function(n){return e.checked=!0,t.reject(n)}}(this),r=function(t){return"cadesplugin_loaded"===t.data?setTimeout(function(){return cpcsp_chrome_nmcades.check_chrome_plugin(i,n)},0):void 0},window.addEventListener("message",r,!1),setTimeout(function(e){return function(){return e.checked?void 0:t.reject("timeout")}}(this),this.timeout),t},t.prototype.createObject=function(t){var n;return n=e.Deferred(),this.pluginObject.CreateObjectAsync(t).then(function(t){return n.resolve(t)},function(t){return n.reject(t)}),n},t.prototype.getParam=function(t,n){var r,i,u;return u=function(t,e){var n;return"object"==typeof e?t[e.paramName].apply(null,e.options):n=t[e]},i=e.Deferred(),r="string"==typeof t?this.pluginObject.CreateObjectAsync(t).then(function(t){return u(t,n)}):u(t,n),r.then(function(t){return i.resolve(t)},function(t){return i.reject(t)}),i},t.prototype.get=function(){var t,e,n;return e=arguments[0],n=arguments[1],t=3<=arguments.length?i.call(arguments,2):[],this.getParam(e,n).then(function(e){return function(n){return t.length>0?(t.unshift(n),e.get.apply(e,t)):n}}(this))},t}()}); \ No newline at end of file diff --git a/test/js/alt_cadesplugin_api.js b/test/js/alt_cadesplugin_api.js index 0870046..dede7d7 100644 --- a/test/js/alt_cadesplugin_api.js +++ b/test/js/alt_cadesplugin_api.js @@ -144,7 +144,9 @@ AltCadesPlugin = (function() { if (event.data !== 'cadesplugin_loaded') { return; } - return cpcsp_chrome_nmcades.check_chrome_plugin(success, fail); + return setTimeout((function() { + return cpcsp_chrome_nmcades.check_chrome_plugin(success, fail); + }), 0); }; window.addEventListener('message', listener, false); setTimeout(((function(_this) {