1jQuery.widget('gc.phoneConfirmField', $.gc.abstractField, { 2 phone: null, 3 4 build: function () { 5 var captchaEnabled = !window.disableCaptchaForConfirmPhone; 6 7 if (captchaEnabled) { 8 $('
vendor: 86 bytes, line 8
8<script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></script>
8').appendTo($('body')); 9 } 10 11 this.input = $( '<input type="text" name="' + this.options.field.fieldName + '" size=4 placeholder="ÐведиÑе код подÑвеÑждениÑ"/>') 12 this.codeSentEl = $( "<div>Ðод подÑвеÑÐ¶Ð´ÐµÐ½Ð¸Ñ Ð±Ñл оÑпÑавлен на Ð²Ð°Ñ Ð½Ð¾Ð¼ÐµÑ</div>"); 13 this.input.hide(); 14 this.codeSentEl.hide(); 15 16 this.buttonsEl = $('<div style="padding-top: 10px; padding-bottom: 10px;"/>'); 17 18 if (captchaEnabled) { 19 this.captcha = $('<div class="g-recaptcha" data-sitekey="6LedcXoUAAAAALSIjF8UgtAgz0J6JwkbFW2mZiTI"></div>'); 20 this.captcha.appendTo(this.buttonsEl); 21 } 22 23 this.sendSmsLink = $( "<a href='javascript:void(0)' class='btn btn-sm btn-primary' style='margin-right: 10px;'>ÐолÑÑиÑÑ ÐºÐ¾Ð´</a>"); 24 this.sendSmsLink.appendTo( this.buttonsEl ); 25 26 this.buttonsEl.appendTo( this.inputBlock ); 27 this.codeSentEl.appendTo( this.inputBlock ); 28 this.input.appendTo( this.inputBlock ); 29 30 if (this.field.showResendCode) { 31 var resendCodeLinkLabel = 'ÐÑпÑавиÑÑ ÐºÐ¾Ð´ повÑоÑно'; 32 if (typeof Yii != 'undefined') { 33 resendCodeLinkLabel = Yii.t('cms', 'ÐÑпÑавиÑÑ ÐºÐ¾Ð´ повÑоÑно'); 34 } 35 this.resendCodeLink = $('<div class="repeat-confirm-code"><a href="#" class="repeat-confirm-code-btn">' 36 + resendCodeLinkLabel + '</a></div>'); 37 this.resendCodeLink.hide(); 38 this.resendCodeLink.appendTo(this.inputBlock); 39 } 40 41 var self = this; 42 this.sendSmsLink.click( function() { 43 self.phone = $('input.form-field-phone').val(); 44 var data = {phone: self.phone}; 45 if (captchaEnabled) { 46 data.recaptcha = grecaptcha.getResponse(); 47 } 48 ajaxCall( "/user/public/user/sendConfirmationCode", data, { btn: $(this) }, function( response ) { 49 self.valueChanged(1); 50 self.sendSmsLink.hide(); 51 if (response.text) { 52 $.toast(response.text, {type: "info"}); 53 } 54 } ); 55 return false; 56 }); 57 58 if (this.field.showResendCode) { 59 this.resendCodeLink.click(function (event) { 60 event.preventDefault(); 61 var data = {phone: self.phone, resend: 1}; 62 if (captchaEnabled) { 63 data.recaptcha = grecaptcha.getResponse(); 64 } 65 ajaxCall("/user/public/user/sendConfirmationCode", data, {btn: $(this)}, function (response) { 66 if (response.text) { 67 $.toast(response.text, {type: "info"}); 68 } 69 }); 70 return false; 71 }); 72 } 73 $('form.xdget-block').find('.form-field-phone').on('keyup change click input', function() { 74 if (grecaptcha && captchaEnabled) { 75 grecaptcha.reset(); 76 } 77 }); 78 }, 79 getValue: function () { 80 return [ 81 this.input.val() 82 ].join(':'); 83 }, 84 valueChanged: function( value, otherValues ) { 85 if ( otherValues ) { 86 this.phone = otherValues.phone; 87 } 88 if ( value == 1 ) { 89 this.sendSmsLink.hide(); 90 this.codeSentEl.show(); 91 this.input.show(); 92 if (this.field.showResendCode) { 93 this.resendCodeLink.show(); 94 } 95 } 96 97 this.input.val( "" ); 98 99 if ( 100 (typeof otherValues != 'undefined') 101 && otherValues.phone_confirmed == true 102 && (this.input.is(":visible") == false) 103 && (this.options.field.required == 'true') 104 ) { 105 this.input.val(otherValues.phone_confirmed); 106 } 107 } 108});
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.