1(function (window) { 2 'use strict'; 3 4 function create(options) { 5 options = options || {}; 6 7 var captchaId = options.captchaId || ''; 8 var captcha = null; 9 var loadFailed = false; 10 var pending = null; 11 12 function fail(message) { 13 var request = pending; 14 pending = null; 15 if (request && typeof request.onError === 'function') { 16 request.onError(message); 17 } 18 } 19 20 if (captchaId && typeof window.initAlicom4 === 'function') { 21 window.initAlicom4({ 22 captchaId: captchaId, 23 product: 'bind' 24 }, function (instance) { 25 captcha = instance; 26 captcha.onSuccess(function () { 27 var validateResult = captcha.getValidate(); 28 var request = pending; 29 pending = null; 30 31 if (!validateResult || !request) { 32 captcha.reset(); 33 return; 34 } 35 36 validateResult.captcha_id = captchaId; 37 request.onSuccess(validateResult, function () { 38 captcha.reset(); 39 }); 40 }).onError(function () { 41 loadFailed = true; 42 fail('å¾å½¢éªè¯å 载失败ï¼è¯·ç¨åéè¯'); 43 }); 44 }); 45 } 46 47 return { 48 show: function (onSuccess, onError) { 49 if (!captchaId) { 50 onError('å¾å½¢éªè¯æå¡æªé ç½®ï¼è¯·è系管çå'); 51 return; 52 } 53 if (loadFailed || typeof window.initAlicom4 !== 'function') { 54 onError('å¾å½¢éªè¯å 载失败ï¼è¯·æ£æ¥ç½ç»åéè¯'); 55 return; 56 } 57 if (!captcha) { 58 onError('å¾å½¢éªè¯æ£å¨å è½½ï¼è¯·ç¨åéè¯'); 59 return; 60 } 61 if (pending) { 62 onError('å¾å½¢éªè¯æ£å¨è¿è¡ï¼è¯·å®æéªè¯'); 63 return; 64 } 65 66 pending = { 67 onSuccess: onSuccess, 68 onError: onError 69 }; 70 captcha.showCaptcha(); 71 } 72 }; 73 } 74 75 window.FtcbGraphAuthCaptcha = { 76 create: create 77 }; 78})(window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.