| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/mimradmin/.trash/wp-content.1/themes/woodmart/js/scripts/wc/ |
Upload File : |
/* global woodmart_settings, woodmartThemeModule */
woodmartThemeModule.emailSubscriptionCheckboxes = function() {
let mainCheckbox = document.querySelector('#wd_email_subscription_consent');
function init() {
if (!mainCheckbox) {
return;
}
setupEventListeners();
}
function setupEventListeners() {
mainCheckbox.addEventListener('change', updateIndividualCheckboxes);
document.querySelectorAll('.wd-email-individual-consent').forEach(function(checkbox) {
checkbox.addEventListener('change', updateMainCheckbox);
});
}
function updateIndividualCheckboxes() {
document.querySelectorAll('.wd-email-individual-consent').forEach(function(checkbox) {
checkbox.checked = mainCheckbox.checked;
if (mainCheckbox.checked) {
checkbox.disabled = false;
checkbox.value = '1';
} else {
checkbox.disabled = true;
checkbox.value = '0';
}
});
}
function updateMainCheckbox() {
if (this.checked) {
mainCheckbox.checked = true;
mainCheckbox.value = '1';
} else if (!anyChecked()) {
mainCheckbox.checked = false;
mainCheckbox.value = '0';
}
}
function anyChecked() {
let anyChecked = false;
document.querySelectorAll('.wd-email-individual-consent').forEach(function(box) {
if (box.checked) {
anyChecked = true;
}
});
return anyChecked;
}
init();
}
window.addEventListener('load', function() {
woodmartThemeModule.emailSubscriptionCheckboxes();
});