1/** 2 * Copyright ETS Software Technology Co., Ltd 3 * 4 * NOTICE OF LICENSE 5 * 6 * This file is not open source! Each license that you purchased is only available for 1 website only. 7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses. 8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party. 9 * 10 * DISCLAIMER 11 * 12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 13 * versions in the future. 14 * 15 * @author ETS Software Technology Co., Ltd 16 * @copyright ETS Software Technology Co., Ltd 17 * @license Valid for 1 website (or project) for each purchase of license 18 */ 19if (ets_cfu_recaptcha_enabled) { 20 if (!ets_cfu_recaptcha_v3) { 21 //v2. 22 var recaptchaWidgets = []; 23 var recaptchaCallback = function () { 24 if (typeof grecaptcha == "undefined") 25 return; 26 var forms = document.getElementsByTagName('form'); 27 var pattern = /(^|\s)g-recaptcha(\s|$)/; 28 for (var i = 0; i < forms.length; i++) { 29 var divs = forms[i].getElementsByTagName('div'); 30 for (var j = 0; j < divs.length; j++) { 31 var sitekey = divs[j].getAttribute('data-sitekey'); 32 if (divs[j].className && divs[j].className.match(pattern) && sitekey) { 33 var params = { 34 'sitekey': sitekey, 35 'type': divs[j].getAttribute('data-type'), 36 'size': divs[j].getAttribute('data-size'), 37 'theme': divs[j].getAttribute('data-theme'), 38 'badge': divs[j].getAttribute('data-badge'), 39 'tabindex': divs[j].getAttribute('data-tabindex') 40 }; 41 var callback = divs[j].getAttribute('data-callback'); 42 if (callback && 'function' == typeof window[callback]) { 43 params['callback'] = window[callback]; 44 } 45 var expired_callback = divs[j].getAttribute('data-expired-callback'); 46 if (expired_callback && 'function' == typeof window[expired_callback]) { 47 params['expired-callback'] = window[expired_callback]; 48 } 49 var widget_id = grecaptcha.render(divs[j], params); 50 recaptchaWidgets.push(widget_id); 51 break; 52 } 53 } 54 } 55 }; 56 document.addEventListener('ets_cfusubmit', function (event) { 57 switch (event.detail.status) { 58 case 'spam': 59 case 'mail_sent': 60 case 'mail_failed': 61 for (var i = 0; i < recaptchaWidgets.length; i++) { 62 grecaptcha.reset(recaptchaWidgets[i]); 63 } 64 } 65 }, false); 66 } else { 67 //v3. 68 (function ($) { 69 var cfu_re_captcha_v3 = function (form) { 70 if ($('.wpcfu form:not(.g-loaded)').length <= 0) 71 return; 72 var g_captcha = form.find('.g-recaptcha').eq(0); 73 if (g_captcha.length > 0) { 74 grecaptcha.ready(function () { 75 grecaptcha.execute(ets_cfu_recaptcha_key, {action: 'contact'}).then(function (token) { 76 g_captcha.html('<input type="hidden" class="g-recaptcha-response" name="g-recaptcha-response" value="' + token + '"/>'); 77 if (g_captcha.find('.g-recaptcha-response').length > 0) { 78 form.addClass('g-loaded'); 79 cfu_re_captcha_v3(form); 80 } 81 }); 82 }); 83 } 84 } 85 $(document).ready(function () { 86 if (ets_cfu_recaptcha_v3) { 87 cfu_re_captcha_v3($('.wpcfu form:not(.g-loaded)')); 88 } 89 }); 90 })(jQuery); 91 } 92}
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.