`;
if (!localStorage.getItem("consentChecked")) {
cookieConsentDiv.innerHTML = bannerDiv;
}
document.getElementById("cookie").addEventListener("click", function () {
showBanner();
});
document.addEventListener("click", function (event) {
if ( event.target.id === "btn-accept-all") {
setConsent({
necessary: true,
analytics: true,
preferences: true,
marketing: true,
});
hideBanner();
}
if ( event.target.id === "btn-accept-some") {
setConsent({
necessary: true,
analytics: document.getElementById("consent-analytics").checked,
preferences: document.getElementById("consent-preferences").checked,
marketing: document.getElementById("consent-marketing").checked,
});
hideBanner();
}
if ( event.target.id === "btn-reject-all") {
setConsent({
necessary: false,
analytics: false,
preferences: false,
marketing: false,
});
hideBanner();
}
});
if (localStorage.getItem("consentMode") === null) {
setDefaultConsent({
necessary: false,
analytics: false,
preferences: false,
marketing: false,
});
} else {
setCurrentConsent();
}
function markCheckboxes() {
const consentModeString = localStorage.getItem("consentMode");
if (!consentModeString) return;
const consentModeObject = JSON.parse(consentModeString);
document.getElementById("consent-marketing").checked = consentModeObject.ad_storage === "granted";
document.getElementById("consent-analytics").checked = consentModeObject.analytics_storage === "granted";
document.getElementById("consent-preferences").checked = consentModeObject.ad_personalization === "granted";
}
function setCurrentConsent() {
const consentModeString = localStorage.getItem("consentMode");
if (!consentModeString) return;
const consentModeObject = JSON.parse(consentModeString);
setConsent({
necessary: true,
analytics: consentModeObject.analytics_storage == "granted" ? true : false,
preferences: consentModeObject.ad_personalization == "granted" ? true : false,
marketing: consentModeObject.ad_storage == "granted" ? true : false,
});
}
function setConsent(consent) {
const consentMode = {
functionality_storage: consent.necessary ? "granted" : "denied",
security_storage: consent.necessary ? "granted" : "denied",
ad_storage: consent.marketing ? "granted" : "denied",
analytics_storage: consent.analytics ? "granted" : "denied",
ad_personalization: consent.preferences ? "granted" : "denied",
ad_user_data: consent.marketing ? "granted" : "denied",
};
gtag("consent", "update", consentMode);
localStorage.setItem("consentMode", JSON.stringify(consentMode));
}
function setDefaultConsent() {
const consentMode = {
functionality_storage: "denied",
security_storage: "denied",
ad_storage: "denied",
analytics_storage: "denied",
ad_personalization: "denied",
ad_user_data: "denied",
};
gtag("consent", "default", consentMode);
localStorage.setItem("consentMode", JSON.stringify(consentMode));
}
function hideBanner() {
document.getElementById("cookie-consent-banner").remove();
localStorage.setItem("consentChecked", true);
}
function showBanner() {
cookieConsentDiv.innerHTML = bannerDiv;
markCheckboxes();
}
});
//Табове//
var settingsVisible = true;
function showTabs() {
document.getElementById('tabs').style.display = "block";
settingsVisible = true;
}
function hideTabs() {
document.getElementById('tabs').style.display = "none";
settingsVisible = false;
}
function toggleButtonText() {
const button = document.getElementById("toggle-cookie-options-button");
if (settingsVisible) {
button.textContent = "СКРИВАНЕ НА ПОДРОБНОСТИТЕ";
} else {
button.textContent = "ВИЖТЕ ПОДРОБНОСТИТЕ";
}
}
function toggleOptions() {
var optionsDiv = document.querySelector('.cookie-consent-options');
var tabs = document.getElementById("tabs");
var tabContents = document.querySelectorAll('.tabcontent');
if (optionsDiv.style.display === 'none' || optionsDiv.style.display === '') {
optionsDiv.style.display = 'block';
toggleTabsVisibility(true);
settingsVisible = true;
} else {
optionsDiv.style.display = 'none';
tabs.style.display = 'none';
tabContents.forEach(function(tabContent) {
tabContent.style.display = 'none';
});
settingsVisible = false;
}
toggleButtonText();
}
function toggleTabsVisibility(show) {
var tabs = document.getElementById("tabs");
var subTabs = document.querySelectorAll(".sub-tabcontent");
if (show) {
tabs.style.display = "block";
subTabs.forEach(function(subTab) {
subTab.style.display = "block";
});
} else {
tabs.style.display = "none";
subTabs.forEach(function(subTab) {
if (!subTab.classList.contains('active')) {
subTab.style.display = "none";
}
});
}
}
function openSubTab(event, subTabName) {
var subTabcontent = document.getElementsByClassName("sub-tabcontent");
for (var i = 0; i < subTabcontent.length; i++) {
subTabcontent[i].style.display = "none";
}
var subTablinks = document.getElementsByClassName("sub-tablink");
for (var i = 0; i < subTablinks.length; i++) {
subTablinks[i].classList.remove("active");
}
document.getElementById(subTabName).style.display = "block";
event.currentTarget.classList.add("active");
}
function openTab(event, tabName) {
var tabcontent = document.getElementsByClassName("tabcontent");
for (var i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
var tablinks = document.getElementsByClassName("tablink");
for (var i = 0; i < tablinks.length; i++) {
tablinks[i].classList.remove("active");
}
document.getElementById(tabName).style.display = "block";
event.currentTarget.classList.add("active");
if (tabName === 'Tab1') {
toggleTabsVisibility(false);
}
}
-->
Обнови бисквитки