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 */ 19 20window.etsCfuTurnstileWidgets = []; 21 22window.etsCfuTurnstileCallback = function () { 23 if (typeof turnstile === 'undefined') { 24 return; 25 } 26 27 // Explicitly render all placeholders 28 var placeholders = document.querySelectorAll('.ets-cfu-turnstile'); 29 for (var i = 0; i < placeholders.length; i++) { 30 var el = placeholders[i]; 31 if (el.dataset.rendered) { 32 continue; 33 } 34 35 var sitekey = el.getAttribute('data-sitekey'); 36 var theme = el.getAttribute('data-theme') || 'auto'; 37 var language = el.getAttribute('data-language') || 'auto'; 38 39 try { 40 var widgetId = turnstile.render(el, { 41 sitekey: sitekey, 42 theme: theme, 43 language: language 44 }); 45 el.dataset.rendered = "true"; 46 el.dataset.widgetId = widgetId; 47 window.etsCfuTurnstileWidgets.push(widgetId); 48 } catch (e) { 49 console.error('Turnstile render error:', e); 50 } 51 } 52}; 53 54(function ($) { 55 'use strict'; 56 57 // Global helper to reset Turnstile widgets 58 window.etsCfuResetTurnstile = function () { 59 if (typeof turnstile !== 'undefined' && window.etsCfuTurnstileWidgets.length) { 60 for (var i = 0; i < window.etsCfuTurnstileWidgets.length; i++) { 61 try { 62 turnstile.reset(window.etsCfuTurnstileWidgets[i]); 63 } catch (e) { 64 // Ignore errors if widget is no longer valid 65 } 66 } 67 } 68 }; 69 70 $(document).ready(function(){ 71 // Check if API is already loaded but callback didn't fire (e.g. cached) 72 if (typeof turnstile !== 'undefined' && $('.ets-cfu-turnstile:not([data-rendered])').length > 0) { 73 window.etsCfuTurnstileCallback(); 74 } 75 76 // Listen for form submission events to reset captcha 77 document.addEventListener('wpcfusubmit', function (event) { 78 if (typeof turnstile !== "undefined") { 79 // Check if the form submitted has a turnstile widget? 80 // For now, reset all to be safe and consistent with reCAPTCHA implementation 81 window.etsCfuResetTurnstile(); 82 } 83 }, false); 84 }); 85 86})(jQuery);
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.