1// Initialize a Map to keep track of last click times for each form 2const lastClickTimes = new Map(); 3 4function handleClick(button) { 5 const currentTime = new Date().getTime(); 6 const form = button.form; // Retrieve the form element associated with the button 7 const formId = form.id; // Assume each form has a unique ID 8 9 // Retrieve the last click time for this specific form 10 const lastClickTime = lastClickTimes.get(formId) || 0; 11 12 if (currentTime - lastClickTime < 3000) { // Check if less than 3 seconds have passed 13 console.log('Disabling form buttons for 3 seconds'); 14 // Disable all submit buttons within this form 15 Array.from(form.querySelectorAll('.submit-button-kentico-form')).forEach(btn => btn.disabled = true); 16 17 // Re-enable the buttons after 3 seconds 18 setTimeout(() => { 19 Array.from(form.querySelectorAll('.submit-button-kentico-form')).forEach(btn => btn.disabled = false); 20 console.log('Re-enabling form buttons'); 21 }, 3000); 22 } else { 23 // Update last click time in the Map 24 lastClickTimes.set(formId, currentTime); 25 } 26}
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.