39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
|
|
document.addEventListener("DOMContentLoaded", function () {
|
||
|
|
const banner = document.getElementById("user-consent-banner");
|
||
|
|
// Проверяем, есть ли уже согласие
|
||
|
|
const consentGiven = localStorage.getItem("userConsent");
|
||
|
|
if (!consentGiven) {
|
||
|
|
banner.classList.remove("hidden");
|
||
|
|
} else {
|
||
|
|
banner.classList.add("hidden");
|
||
|
|
}
|
||
|
|
|
||
|
|
// Обработчики
|
||
|
|
banner.querySelector("#user-consent-banner .btn.accept")?.addEventListener("click", function () {
|
||
|
|
localStorage.setItem("userConsent", "accepted");
|
||
|
|
localStorage.setItem("userConsentDate", new Date().toISOString());
|
||
|
|
banner.classList.add("hidden");
|
||
|
|
});
|
||
|
|
|
||
|
|
// banner.querySelector("#user-consent-banner .btn.decline")?.addEventListener("click", function () {
|
||
|
|
// localStorage.setItem("userConsent", "declined");
|
||
|
|
// banner.classList.add("hidden");
|
||
|
|
// });
|
||
|
|
});
|
||
|
|
|
||
|
|
document.addEventListener('DOMContentLoaded', function () {
|
||
|
|
const formIndexes = [1, 2, 3];
|
||
|
|
|
||
|
|
formIndexes.forEach(index => {
|
||
|
|
const checkbox = document.querySelector(`input[name="agree_policy_${index}"]`);
|
||
|
|
const button = document.getElementById(`registerButton_${index}`);
|
||
|
|
|
||
|
|
if (checkbox && button) {
|
||
|
|
button.disabled = !checkbox.checked;
|
||
|
|
|
||
|
|
checkbox.addEventListener('change', function () {
|
||
|
|
button.disabled = !checkbox.checked;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|