1var __extends = (this && this.__extends) || (function () { 2 var extendStatics = function (d, b) { 3 extendStatics = Object.setPrototypeOf || 4 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 return extendStatics(d, b); 7 }; 8 return function (d, b) { 9 extendStatics(d, b); 10 function __() { this.constructor = d; } 11 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 12 }; 13})(); 14var SmartFormsFields; 15(function (SmartFormsFields) { 16 var rednaorecaptcha2 = /** @class */ (function (_super) { 17 __extends(rednaorecaptcha2, _super); 18 function rednaorecaptcha2(options, serverOptions) { 19 var _this = _super.call(this, options, serverOptions) || this; 20 _this.IsDynamicField = true; 21 sfFormElementBase.call(_this, options, serverOptions); 22 _this.Title = "Title"; 23 _this.paper = null; 24 _this.captchaId = ""; 25 if (_this.IsNew) { 26 _this.Options.ClassName = "rednaorecaptcha2"; 27 _this.Options.Label = "Captcha"; 28 _this.Options.SiteKey = ""; 29 _this.ServerOptions.SecretKey = ""; 30 } 31 _this.Options.Id = "captcha2"; 32 _this.Id = "captcha2"; 33 _this.RecaptchaAlreadyLoaded = false; 34 return _this; 35 } 36 rednaorecaptcha2.prototype.SetData = function (data) { 37 }; 38 rednaorecaptcha2.prototype.CreateProperties = function () { 39 this.Properties.push(new SimpleTextProperty(this, this.Options, "Label", "Label", { ManipulatorType: 'basic' })); 40 this.Properties.push(new SimpleTextProperty(this, this.Options, "SiteKey", "Site Key", { 41 ManipulatorType: 'basic', 42 'Tooltip': { 43 Text: 'Please check tutorial to know how to generate these keys: <a target="_blank" href="https://smartforms.rednao.com/configuring-recaptcha-2">https://smartforms.rednao.com/configuring-recaptcha-2</a>', 44 HideDelay: 3000 45 } 46 })); 47 this.Properties.push(new SimpleTextProperty(this, this.ServerOptions, "SecretKey", "Secret Key", { 48 ManipulatorType: 'basic', 49 Tooltip: { 50 Text: 'Please check tutorial to know how to generate these keys: <a target="_blank" href="https://smartforms.rednao.com/configuring-recaptcha-2">https://smartforms.rednao.com/configuring-recaptcha-2</a>', 51 HideDelay: 3000 52 } 53 })); 54 }; 55 ; 56 rednaorecaptcha2.prototype.GenerateInlineElement = function () { 57 var html = ''; 58 if (this.Options.SiteKey == '') { 59 html = '<div class="rednao_label_container col-sm-3"><label class="rednao_control_label" >' + this.Options.Label + '</label></div>\ 60 <div class="redNaoControls col-sm-9 smartFormsSlider">To use captcha you need to configure a site key and secret key <a target="_blank" href="https://smartforms.rednao.com/?p=3822&preview=true">Learn how to get them here (its free and you can get them in less than 1 minute)</a></div>'; 61 } 62 else { 63 html = '<div class="rednao_label_container col-sm-3"><label class="rednao_control_label" >' + this.Options.Label + '</label></div>\ 64 <div class="redNaoControls col-sm-9 smartFormsSlider"></div>'; 65 } 66 return html; 67 }; 68 ; 69 //used in smart forms 70 //noinspection JSUnusedGlobalSymbols 71 rednaorecaptcha2.prototype.GenerationCompleted = function (jQueryElement) { 72 if (jQueryElement.parent().hasClass('component')) { 73 jQueryElement.find('.redNaoControls').empty(); 74 jQueryElement.find('.redNaoControls').append('<img src="' + smartFormsRootPath + 'images/recaptcha2.png"></img>'); 75 return; 76 } 77 if (this.Options.SiteKey == '') 78 return; 79 var self = this; 80 this.RecaptchaAlreadyLoaded = false; 81 var siteKey = self.Options.SiteKey; 82 if (siteKey == "") 83 siteKey = "asdfdsaf"; 84 var callBack = function () { 85 var timeOut = setInterval(function () { 86 if (typeof grecaptcha != 'undefined' && typeof grecaptcha.render != 'undefined') { 87 jQueryElement = self.JQueryElement; //this is needed because the jqueryelement parameter my not be the one that is shown in the form when the library finished loading 88 if (self.RecaptchaAlreadyLoaded) { 89 clearInterval(timeOut); 90 return; 91 } 92 jQueryElement.find('#rc2' + self.Id).remove(); 93 var $recaptchaControl = rnJQuery('<div id="rc2' + self.Id + '"></div>'); 94 if (smartFormsDesignMode) 95 $recaptchaControl.css('pointer-events', 'n
95one'); 96 jQueryElement.find('.redNaoControls').append($recaptchaControl); 97 self.RecaptchaAlreadyLoaded = true; 98 clearInterval(timeOut); 99 self.captchaId = grecaptcha.render($recaptchaControl[0], { sitekey: siteKey }); 100 } 101 }, 10); 102 }; 103 callBack = callBack.bind(this); 104 var count = 1; 105 while (typeof (window['sfRecatchaCallBack' + count]) != 'undefined') 106 count++; 107 window['sfRecatchaCallBack' + count] = callBack; 108 rnJQuery.RNLoadLibrary(['https://www.google.com/recaptcha/api.js?onload=sfRecatchaCallBack' + count], [], callBack); 109 }; 110 rednaorecaptcha2.prototype.interpolate = function (start, end, smilePercentage) { 111 return (start + ((end - start) * smilePercentage)).toString(); 112 }; 113 //used in smart forms 114 //noinspection JSUnusedGlobalSymbols 115 rednaorecaptcha2.prototype.GetValueString = function () { 116 if (this.IsIgnored()) 117 return { value: '' }; 118 return { value: this.JQueryElement.find('.sfSlider').slider('option', 'value') }; 119 }; 120 ; 121 //used in smart forms 122 //noinspection JSUnusedGlobalSymbols 123 rednaorecaptcha2.prototype.IsValid = function () { 124 var response = grecaptcha.getResponse(this.captchaId) != ''; 125 if (response == "") 126 this.AddError('root', this.InvalidInputMessage); 127 else 128 this.RemoveError('root'); 129 return this.InternalIsValid(); 130 }; 131 ; 132 //used in smart forms 133 //noinspection JSUnusedGlobalSymbols 134 rednaorecaptcha2.prototype.StoresInformation = function () { 135 return false; 136 }; 137 ; 138 rednaorecaptcha2.prototype.GetValuePath = function () { 139 return 'formData.' + this.Id + '.value'; 140 }; 141 ; 142 return rednaorecaptcha2; 143 }(sfFormElementBase)); 144 SmartFormsFields.rednaorecaptcha2 = rednaorecaptcha2; 145})(SmartFormsFields || (SmartFormsFields = {})); 146//# sourceMappingURL=rednaorecaptcha2.js.map
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.