@plotdb/captcha
Advanced tools
| # Change Logs | ||
| ## v0.0.2 | ||
| - use `lderror` instead of `ldError` | ||
| - upgrade ldquery and template modules | ||
+7
-2
@@ -11,5 +11,10 @@ // Generated by LiveScript 1.6.0 | ||
| ? null | ||
| : new captcha(opt.alt); | ||
| : opt.alt instanceof captcha | ||
| ? opt.alt | ||
| : new captcha(opt.alt); | ||
| this._init = opt.init; | ||
| this._get = opt.get; | ||
| this._failed = opt.isVerifyFailed || function(){ | ||
| return false; | ||
| }; | ||
| this.inited = false; | ||
@@ -79,3 +84,3 @@ this.ready = false; | ||
| })['catch'](function(e){ | ||
| if (this$.isCaptchaFailed(e) && this$.alt) { | ||
| if (this$._failed(e) && this$.alt) { | ||
| return this$.alt.execute(cb); | ||
@@ -82,0 +87,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| (function(){var captcha;captcha=function(opt){opt==null&&(opt={});this.lc=opt.lc||{};this.opt=opt;this.config=opt.config||{};this.alt=!opt.alt?null:new captcha(opt.alt);this._init=opt.init;this._get=opt.get;this.inited=false;this.ready=false;this.queue=[];return this};captcha.prototype=import$(Object.create(Object.prototype),{init:function(){var this$=this;if(this.inited){return Promise.resolve()}this.inited=true;return Promise.resolve().then(function(){if(this$._init){return this$._init()}}).then(function(it){this$.ready=true;this$.queue.map(function(it){return it.res()});this$.queue.splice(0);return it})},setConfig:function(it){return this.config=it},get:function(opt){var this$=this;opt==null&&(opt={});return Promise.resolve().then(function(){if(!this$.inited){return this$.init()}else{return Promise.resolve()}}).then(function(){if(this$.ready){return Promise.resolve()}else{return new Promise(function(res,rej){return this$.queue.push({res:res,rej:rej})})}}).then(function(){if(this$._get){return this$._get(opt)}else{return{token:""}}})},execute:function(opt,cb){var this$=this;opt==null&&(opt={});return this.get(opt).then(function(ret){return cb(ret)})["catch"](function(e){if(this$.isCaptchaFailed(e)&&this$.alt){return this$.alt.execute(cb)}return Promise.reject(e)})}});if(typeof window!="undefined"&&window!==null){window.captcha=captcha}function import$(obj,src){var own={}.hasOwnProperty;for(var key in src)if(own.call(src,key))obj[key]=src[key];return obj}}).call(this); | ||
| (function(){var captcha;captcha=function(opt){opt==null&&(opt={});this.lc=opt.lc||{};this.opt=opt;this.config=opt.config||{};this.alt=!opt.alt?null:opt.alt instanceof captcha?opt.alt:new captcha(opt.alt);this._init=opt.init;this._get=opt.get;this._failed=opt.isVerifyFailed||function(){return false};this.inited=false;this.ready=false;this.queue=[];return this};captcha.prototype=import$(Object.create(Object.prototype),{init:function(){var this$=this;if(this.inited){return Promise.resolve()}this.inited=true;return Promise.resolve().then(function(){if(this$._init){return this$._init()}}).then(function(it){this$.ready=true;this$.queue.map(function(it){return it.res()});this$.queue.splice(0);return it})},setConfig:function(it){return this.config=it},get:function(opt){var this$=this;opt==null&&(opt={});return Promise.resolve().then(function(){if(!this$.inited){return this$.init()}else{return Promise.resolve()}}).then(function(){if(this$.ready){return Promise.resolve()}else{return new Promise(function(res,rej){return this$.queue.push({res:res,rej:rej})})}}).then(function(){if(this$._get){return this$._get(opt)}else{return{token:""}}})},execute:function(opt,cb){var this$=this;opt==null&&(opt={});return this.get(opt).then(function(ret){return cb(ret)})["catch"](function(e){if(this$._failed(e)&&this$.alt){return this$.alt.execute(cb)}return Promise.reject(e)})}});if(typeof window!="undefined"&&window!==null){window.captcha=captcha}function import$(obj,src){var own={}.hasOwnProperty;for(var key in src)if(own.call(src,key))obj[key]=src[key];return obj}}).call(this); |
@@ -18,3 +18,3 @@ // Generated by LiveScript 1.6.0 | ||
| var ref$; | ||
| return rej((ref$ = new Error(), ref$.id = 1022, ref$.name = 'ldError', ref$)); | ||
| return rej((ref$ = new Error(), ref$.id = 1022, ref$.name = 'lderror', ref$)); | ||
| }; | ||
@@ -95,3 +95,3 @@ attr = { | ||
| var ref$; | ||
| return rej((ref$ = new Error(), ref$.name = 'ldError', ref$.id = 1013, ref$)); | ||
| return rej((ref$ = new Error(), ref$.name = 'lderror', ref$.id = 1013, ref$)); | ||
| } | ||
@@ -98,0 +98,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
| (function(){var recaptcha;recaptcha={};recaptcha.v3=new captcha({init:function(){var this$=this;return new Promise(function(res,rej){var tag,attr,k,v;tag=document.createElement("script");tag.onload=function(){return grecaptcha.ready(function(){return res()})};tag.onerror=function(){var ref$;return rej((ref$=new Error,ref$.id=1022,ref$.name="ldError",ref$))};attr={type:"text/javascript",async:"",defer:"",src:"https://www.google.com/recaptcha/api.js?render="+this$.config.sitekey};for(k in attr){v=attr[k];tag.setAttribute(k,v)}return document.body.appendChild(tag)})},get:function(opt){var this$=this;opt==null&&(opt={});if(!this.config.sitekey||this.config.enabled!=null&&!this.config.enabled){return Promise.resolve()}return new Promise(function(res,rej){return grecaptcha.execute(this$.config.sitekey,{action:opt.action}).then(function(token){return{token:token}})})}});recaptcha.v2=new captcha({init:function(){return new Promise(function(res,rej){var tag,attr,k,v;tag=document.createElement("script");attr={type:"text/javascript",async:"",defer:"",src:"https://www.google.com/recaptcha/api.js?onload=_grecaptcha_callback"};for(k in attr){v=attr[k];tag.setAttribute(k,v)}window._grecaptcha_callback=function(){return res()};return document.body.appendChild(tag)})},get:function(){var this$=this;if(!this.config.sitekey||this.config.enabled!=null&&!this.config.enabled){return Promise.resolve()}return new Promise(function(res,rej){var div,config,id;div=document.createElement("div");document.body.appendChild(div);config={sitekey:this$.config.sitekey,size:"invisible",badge:"none",callback:function(token){return res({token:token})},"error-callback":function(it){return rej(new Error(it))},"expired-callback":function(){var ref$;return rej((ref$=new Error,ref$.name="ldError",ref$.id=1013,ref$))}};id=grecaptcha.render(div,config,true);return grecaptcha.execute(id).then(function(){})})}});if(typeof window!="undefined"&&window!==null){window.recaptcha=recaptcha}}).call(this); | ||
| (function(){var recaptcha;recaptcha={};recaptcha.v3=new captcha({init:function(){var this$=this;return new Promise(function(res,rej){var tag,attr,k,v;tag=document.createElement("script");tag.onload=function(){return grecaptcha.ready(function(){return res()})};tag.onerror=function(){var ref$;return rej((ref$=new Error,ref$.id=1022,ref$.name="lderror",ref$))};attr={type:"text/javascript",async:"",defer:"",src:"https://www.google.com/recaptcha/api.js?render="+this$.config.sitekey};for(k in attr){v=attr[k];tag.setAttribute(k,v)}return document.body.appendChild(tag)})},get:function(opt){var this$=this;opt==null&&(opt={});if(!this.config.sitekey||this.config.enabled!=null&&!this.config.enabled){return Promise.resolve()}return new Promise(function(res,rej){return grecaptcha.execute(this$.config.sitekey,{action:opt.action}).then(function(token){return{token:token}})})}});recaptcha.v2=new captcha({init:function(){return new Promise(function(res,rej){var tag,attr,k,v;tag=document.createElement("script");attr={type:"text/javascript",async:"",defer:"",src:"https://www.google.com/recaptcha/api.js?onload=_grecaptcha_callback"};for(k in attr){v=attr[k];tag.setAttribute(k,v)}window._grecaptcha_callback=function(){return res()};return document.body.appendChild(tag)})},get:function(){var this$=this;if(!this.config.sitekey||this.config.enabled!=null&&!this.config.enabled){return Promise.resolve()}return new Promise(function(res,rej){var div,config,id;div=document.createElement("div");document.body.appendChild(div);config={sitekey:this$.config.sitekey,size:"invisible",badge:"none",callback:function(token){return res({token:token})},"error-callback":function(it){return rej(new Error(it))},"expired-callback":function(){var ref$;return rej((ref$=new Error,ref$.name="lderror",ref$.id=1013,ref$))}};id=grecaptcha.render(div,config,true);return grecaptcha.execute(id).then(function(){})})}});if(typeof window!="undefined"&&window!==null){window.recaptcha=recaptcha}}).call(this); |
+3
-3
@@ -6,3 +6,3 @@ { | ||
| "description": "captcha sample", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "files": [ | ||
@@ -24,3 +24,3 @@ "dist/**/*" | ||
| "devDependencies": { | ||
| "@loadingio/ldquery": "^1.1.1", | ||
| "@loadingio/ldquery": "^2.0.0", | ||
| "bootstrap": "^4.5.2", | ||
@@ -33,3 +33,3 @@ "bootstrap.ldui": "github:loadingio/bootstrap.ldui", | ||
| "stylus": "^0.54.5", | ||
| "template": "github:zbryikt/template#v2.1.8", | ||
| "template": "github:zbryikt/template#v2.3.9", | ||
| "template-text": "^0.1.0", | ||
@@ -36,0 +36,0 @@ "uglify-js": "=3.2.0", |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
13488
2.41%7
16.67%218
2.83%