#gdpr-cookie-consent__model .modal-content input:checked + .slider {
background-color:
{cookiesWidget.0.btn_background_color}#EE7202;
}
/*
_2ClickIframePrivacy Class contains methods for handling user consent about cookies.
It internally uses cookies to remember user choices about privacy settings.
Classes:
- gdpr-privacy-msg: Used to style privacy message displayed within iframe
- toggleButton : Used by buttons which enables/disables specific services
Methods:
- setConsentStatus(service,status) : Sets the consent status for a service and stores it as a cookie.
- deleteCookie(name) : Deletes the specified cookie.
- getConsentStatuses(): Returns a JSON object representing all the cookies whose consent was obtained.
- wrap(el, wrapper, type, text, heading): Adds 'gdpr-privacy-msg' div element inside an iframe containing info about data security and obtain user’s consent
- EnableContent(type): Enables the iframe content once user provides consent.
- DisableContent(type,e): Disables the iframe content if user withdraws consent.
- Init(UserConfig) : Initializes the instance with user provided configurations.
Properties:
- consentCookieName: Specifies the name of the cookie used for preserving user consent settings
- toggleButtons: Represents all buttons which enables/disables specific services.
- consentStatuses: Stores the statuses of users' consent for cookies
*/
let arr = JSON.parse('{twoClickSol}');
document.addEventListener('DOMContentLoaded', () => {
if (Object.keys(arr).length !== 0) {
_2ClickIframePrivacy.init('', arr);
}
});
let switchs = document.querySelectorAll('.switch .toggleButton');
if (switchs.length !== 0) {
// let acceptBtn = document.querySelector('.accept-all .btn-lg');
// acceptBtn.addEventListener('click', function () {
// switchs.forEach((item, index) => {
// if (item.checked != true) {
// item.click();
// acceptBtn.disabled = true;
// acceptBtn.classList.add('disabled');
// }
// })
// })
}
//////////////////////Special One time PopUp///////////////////////////
document.addEventListener('DOMContentLoaded', () => {
const popUpShownMt = localStorage.getItem('popUpShownMt');
const popUpShownGt = localStorage.getItem('popUpShownGt');
const popUpShownMp = localStorage.getItem('popUpShownMp');
var toggleButtons = document.getElementsByClassName("toggleButton");
var btnTextColor = "{cookiesWidget.0.btn_background_color}";
const declineAllButton = document.getElementById('decline-allbtn');
var getToggleButtons = document.querySelectorAll(".toggleButton.singleToggle");
var uniqueToggleButtons = new Set(getToggleButtons);
let allToggleBtn = document.querySelector('.allToggle');
// Ensure all toggle buttons and decline button are in sync when the page loads
initializeToggleState();
// Event listener for the allToggle button
allToggleBtn.addEventListener('change', function () {
let checked = this.checked;
uniqueToggleButtons.forEach((item) => {
if (item.checked !== checked) {
item.click();
}
});
updateDeclineButtonState(checked);
});
// Event listener for each individual toggle button
uniqueToggleButtons.forEach((button) => {
button.addEventListener('change', function () {
checkAllToggleBtnState(); // Check if at least one button is on
});
});
// Event listener for the decline button
declineAllButton.addEventListener('click', function () {
// Uncheck all unique toggle buttons
uniqueToggleButtons.forEach((button) => {
if (button.checked) {
button.click();
}
});
// Update the allToggleBtn state to unchecked
allToggleBtn.checked = false;
updateDeclineButtonState(false);
});
// Function to update the state of the decline button based on toggles
function updateDeclineButtonState(checked) {
if (checked) {
// Enable the decline button
declineAllButton.style.backgroundColor = btnTextColor;
declineAllButton.style.pointerEvents = 'auto';
declineAllButton.style.opacity = '1';
allToggleBtn.checked = true;
} else {
declineAllButton.style.pointerEvents = 'none';
declineAllButton.style.opacity = '0.6';
allToggleBtn.checked = false;
}
}
// Function to check if all toggle buttons are in sync with allToggleBtn or if any is on
function checkAllToggleBtnState() {
let allChecked = Array.from(uniqueToggleButtons).every(button => button.checked);
let anyChecked = Array.from(uniqueToggleButtons).some(button => button.checked);
if (allChecked) {
allToggleBtn.checked = true; // If all buttons are checked, set allToggleBtn to checked
} else {
allToggleBtn.checked = false; // If not all are checked, set it to unchecked
}
// Update the decline button state based on if any toggle is checked
updateDeclineButtonState(anyChecked);
}
// Function to initialize the state of all toggle buttons and sync with allToggleBtn
function initializeToggleState() {
let anyChecked = Array.from(uniqueToggleButtons).some(button => button.checked);
if (anyChecked) {
// If any button is checked, the allToggleBtn should be on
allToggleBtn.checked = true;
} else {
// If no button is checked, allToggleBtn should be off
allToggleBtn.checked = false;
}
// Update the decline button state based on the initial toggle state
updateDeclineButtonState(anyChecked);
}
if (!popUpShownMt) {
const trackModalMt = document.getElementById("gdpr-extensions-com-cookie-track-model-mt");
if (trackModalMt) {
trackModalMt.style.display = "block";
localStorage.setItem('popUpShownMt', true);
}
}
if (!popUpShownMp) {
const trackModalMp = document.getElementById("gdpr-extensions-com-cookie-track-model-mp");
if (trackModalMp) {
trackModalMp.style.display = "block";
localStorage.setItem('popUpShownMp', true);
}
}
if(!popUpShownGt){
const trackModalGt = document.getElementById("gdpr-extensions-com-cookie-track-model-gt");
if (trackModalGt) {
trackModalGt.style.display = "block";
localStorage.setItem('popUpShownGt', true);
}
}
});
const acceptBtntrack = document.querySelector('.accept-all .btn-lg');
if (acceptBtntrack) {
// acceptBtntrack.addEventListener('click', () => {
//const switchs = document.querySelectorAll('.switch .toggleButton');
//switchs.forEach((item) => {
//if (!item.checked) {
//item.click();
// acceptBtntrack.disabled = true;
//acceptBtntrack.classList.add('disabled');
//}
// });
// });
const spackTrack = document.querySelector('.trackclose');
const acceptAllBtnMt = document.getElementById('acceptAllBtnMt');
const acceptAllBtnGt = document.getElementById('acceptAllBtnGt');
const acceptAllBtnMp = document.getElementById('acceptAllBtnMp');
if(acceptAllBtnMt){
acceptAllBtnMt.addEventListener("click" ,()=>{
spackTrack.click();
})
}
const spackTrackGt = document.querySelector('.trackcloseGt');
if(acceptAllBtnGt){
acceptAllBtnGt.addEventListener("click" ,()=>{
spackTrackGt.click();
})
}
if(spackTrackGt){
spackTrackGt.onclick = function () {
const trackModalGt = document.getElementById("gdpr-extensions-com-cookie-track-model-gt");
if(trackModalGt){
trackModalGt.style.display = "none";
}
};
}
const spackTrackMp = document.querySelector('.trackcloseMp');
if(acceptAllBtnMp){
acceptAllBtnMp.addEventListener("click" ,()=>{
spackTrackMp.click();
})
}
if(spackTrackMp){
spackTrackMp.onclick = function () {
const trackModalMp = document.getElementById("gdpr-extensions-com-cookie-track-model-mp");
if(trackModalMp){
trackModalMp.style.display = "none";
}
};
}
if(spackTrack){
spackTrack.onclick = function () {
const trackModalMt = document.getElementById("gdpr-extensions-com-cookie-track-model-mt");
if(trackModalMt){
trackModalMt.style.display = "none";
}
};
}
window.onclick = function (event) {
const trackModalMt = document.getElementById("gdpr-extensions-com-cookie-track-model-mt");
const trackModalGt = document.getElementById("gdpr-extensions-com-cookie-track-model-gt");
const trackModalMp = document.getElementById("gdpr-extensions-com-cookie-track-model-mp");
if (event.target == trackModalMt) {
trackModalMt.style.display = "none";
}
if (event.target == trackModalGt) {
trackModalGt.style.display = "none";
}
if (event.target == trackModalMp) {
trackModalMp.style.display = "none";
}
};
}
//////////////////////Special One time PopUp//////////////////////////
for (let sol in arr) {
let solSetting = arr[sol];
var modal = document.getElementById("gdpr-extensions-com-cookie-model");
if (modal) {
var btn = document.querySelectorAll(".gdpr-extensions-com-cookie-fab-mo");
var span = document.getElementsByClassName("close")[0];
btn.forEach((item, index) => {
item.addEventListener('click', function () {
modal.style.display = "block";
})
})
span.onclick = function () {
modal.style.display = "none";
}
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
}
var _2ClickIframePrivacy = new function () {
var consentCookieName = 'GDPR_Extensions_2ClickCookieConsent';
var toggleButtons = document.getElementsByClassName("toggleButton");
let gdprInner = document.getElementById('gdpr-inner')
// Initialize consent statuses:
var consentStatuses = getConsentStatuses();
var config = {
enableCookies: true,
useSessionCookie: true,
cookieNamespace: '_2ClickIPEnable-',
showContentLabel: 'Inhalt anzeigen',
rememberChoiceLabel: 'Auswahl merken',
privacyPolicyLabel: 'Datenschutzerklärung',
privacyPolicyUrl: false
};
this.types = new Array(
{
type: 'video',
description: solSetting.content,
heading: solSetting.heading,
btnColor: solSetting.button_color,
textColor: solSetting.text_color,
imagePath: solSetting.background_image,
imageStatus: solSetting.enable_background_image,
bgColor: solSetting.background_image_color,
buttonTextColor: solSetting.button_text_color,
btnText: solSetting.button_text,
btnShape: solSetting.button_shape,
headingColor: solSetting.heading_color,
},
{
type: 'map',
description: solSetting.content,
heading: solSetting.heading,
btnColor: solSetting.button_color,
textColor: solSetting.text_color,
imagePath: solSetting.background_image,
imageStatus: solSetting.enable_background_image,
bgColor: solSetting.background_image_color,
buttonTextColor: solSetting.button_text_color,
btnText: solSetting.button_text,
btnShape: solSetting.button_shape,
headingColor: solSetting.heading_color,
},
{
type: 'calendar',
description: '{YoutubeSettings.content} ',
heading: 'Zum Aktivieren des Videos bitte auf den Link klicken. Durch das Aktivieren von eingebetteten Videos werden Daten an den jeweiligen Anbieter übermittelt. Weitere Informationen können unserer Datenschutzerklärung entnommen werden. '
}
);
function setConsentStatus(service, status) {
consentStatuses[service] = status;
let cookie = getConsentStatuses();
if (cookie != {}) {
deleteCookie(consentCookieName);
}
var d = new Date;
d.setTime(d.getTime() + 24 * 60 * 60 * 1000 * 30);
document.cookie = consentCookieName + "=" + JSON.stringify(consentStatuses) + ";path=/;expires=" + d.toGMTString();
}
function deleteCookie(name) {
// Create an expired date.
var expiredDate = new Date();
expiredDate.setTime(expiredDate.getTime() - (1000 * 3600)); // Subtracting 1 hour from current time
// Setting the cookie with an expired date deletes it.
document.cookie = name + "=; expires=" + expiredDate.toGMTString() + "; path=/";
}
function getConsentStatuses() {
var v = document.cookie.match('(^|;) ?' + consentCookieName + '=([^;]*)(;|$)');
return v ? JSON.parse(v[2]) : {};
}
function loadPinterestScript() {
var f = document.getElementsByTagName('SCRIPT')[0],
p = document.createElement('SCRIPT');
p.type = 'text/javascript';
p.async = true;
p.src = '//assets.pinterest.com/js/pinit.js';
f.parentNode.insertBefore(p, f);
}
function removePinterestScript() {
var pinterestScript = document.querySelector("script[src='//assets.pinterest.com/js/pinit.js']");
if (pinterestScript) {
pinterestScript.parentNode.removeChild(pinterestScript);
}
}
// This function checks if the Pinterest cookie is accepted and loads or removes the script accordingly
function checkPinterestConsent() {
let consentStatuses = getConsentStatuses();
if (consentStatuses['gdpr_extensions_com_pinterest_none'] === '1') {
loadPinterestScript();
} else {
removePinterestScript();
}
}
function dispatchLoadEvent() {
let event = new Event('load');
window.dispatchEvent(event);
}
document.addEventListener('DOMContentLoaded', function () {
checkPinterestConsent();
dispatchLoadEvent();
});
//Create div-element within the respective iframe to display the defined data-security message and get consent for loading the iframe content.
function wrap(el, wrapper, type, text, heading, btnColor, textColor, imagePath, imageStatus, bgColor, buttonTextColor, btnText, btnShape, headingColor) {
el.parentNode.insertBefore(wrapper, el);
wrapper.className = 'gdpr-privacy-msg privacy-' + type + '-msg';
wrapper.style.width = el.clientWidth + 'px';
wrapper.style.height = el.clientHeight + 'px';
wrapper.innerHTML = imageStatus == 1 ? "
';
wrapper.appendChild(el);
}
this.EnableContent = function (type) {
var i;
if(type ==='gdpr_extensions_com_pinterest'){
loadPinterestScript();
}
// Cookies globally enabled by config?
var checkboxes = document.querySelectorAll('div.privacy-' + CSS.escape(type) + '-msg input');
if (config.enableCookies) {
for (let i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked == true) {
let service = checkboxes[i].parentNode.parentNode.nextElementSibling.getAttribute('data-2click-service'); // get service name from iframe
;
setConsentStatus(service + '_{rootPid}', '1');
}
}
}
var x = document.querySelectorAll('div.privacy-' + CSS.escape(type) + '-msg .wraper');
for (i = 0; i < x.length; i++) {
while (x[i].firstChild) {
x[i].removeChild(x[i].firstChild);
}
}
x = document.querySelectorAll('div.privacy-' + CSS.escape(type) + '-msg');
for (i = 0; i < x.length; i++) {
var parent = x[i].parentNode;
// Move all children out of the element
while (x[i].firstChild) parent.insertBefore(x[i].firstChild, x[i]);
// Remove the empty element
parent.removeChild(x[i]);
}
x = document.querySelectorAll('iframe[data-2click-service="' + type + '"],div[data-2click-service="' + type + '"]');
for (i = 0; i < x.length; i++) {
let serviceType = x[i].getAttribute("data-2click-service");
x[i].style.display = 'block';
if (serviceType === 'gdpr_extensions_com_gmap') {
if (i == 0) {
let parent = x[i];
let mapDiv = document.createElement('div');
mapDiv.id = "map" + i;
mapDiv.className = "map";
parent.parentNode.insertBefore(mapDiv, parent.nextSibling)
loadMapScript(x[i].nextElementSibling);
} else {
initMap((x[i].nextElementSibling));
}
}
if (serviceType === 'gdpr_extensions_com_bmap') {
gdpr_extensions_com_bmap_gdpr(x[i],'add');
}
if (serviceType === 'gdpr_extensions_com_sfc') {
gdpr_extensions_com_sfc_gdpr(x[i],'add');
}
if (serviceType === 'gdpr_extensions_com_pinterest' || serviceType === 'gdpr_extensions_com_pinterest_profile' || serviceType === 'gdpr_extensions_com_pinterest_pin') {
loadPinterestScript();
}
x[i].src = x[i].getAttribute("data-src");
}
// If available, execute the callback that is defined for the currently active type
for (i = 0; i < this.types.length; i++) {
if (this.types[i].type == type && this.types[i].callback) {
window[this.types[i].callback]();
}
}
gdprInner?.classList.remove('gdprInner');
if (toggleButtons.length !== 0) {
for (let i = 0; i < toggleButtons.length; i++) {
let extTitle = toggleButtons[i].getAttribute('data-ext-title');
// Assuming service name includes extTitle with a unique identifier
let service = extTitle + '_{rootPid}';
toggleButtons[i].checked = Boolean(Number(consentStatuses[service])); // Convert string to boolean
// Additional logic can go here if necessary
if (areAllChecked()) {
// acceptBtn.disabled = true;
// acceptBtn.classList.add('disabled');
}
}
}
}
function DisableContent(type, e) {
var i;
// Accessing all relevant checkboxes
var checkboxes = document.querySelectorAll('div.privacy-' + type + '-msg input');
for (let i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked == false) { // Checking if the checkbox is not checked
let service = checkboxes[i].parentNode.parentNode.nextElementSibling.getAttribute('data-2click-service');
setConsentStatus(service + '_{rootPid}', '0'); // Set consent status to '0' indicating disapproval
}
}
var x = document.querySelectorAll('iframe[data-2click-service="' + type + '"],div[data-2click-service="' + type + '"]');
for (i = 0; i < x.length; i++) {
let dummy = x[i].innerHTML;
x[i].style.display = 'none';
x[i].src = ''; // Disabling the iframe by setting src as empty
if (type == 'gdpr_extensions_com_gmap') {
let elementToRemove = x[i].nextElementSibling;
if (elementToRemove) {
elementToRemove.parentNode.removeChild(elementToRemove);
}
}
if (type == 'gdpr_extensions_com_bmap') {
gdpr_extensions_com_bmap_gdpr(x[i],'remove');
}
if (type == 'gdpr_extensions_com_sfc') {
gdpr_extensions_com_sfc_gdpr(x[i],'remove');
}
}
// If available, execute the callback that is defined for the currently active type
for (i = 0; i < e.length; i++) {
if (e[i].type == type && e[i].callback) {
window[e[i].callback]();
}
}
gdprInner?.classList.add('gdprInner');
// acceptBtn.disabled = false;
// acceptBtn.classList.remove('disabled');
}
const loadMapScript = function (parent) {
;
const mapScript = document.createElement("script");
const body = document.querySelector("body");
const mapsApiKey = document.getElementById("mapApiKey").innerText;
mapScript.setAttribute(
"src",
`https://maps.googleapis.com/maps/api/js?key=${mapsApiKey}&libraries=geometry`
);
console.log("exec: ", `https://maps.googleapis.com/maps/api/js?key=${mapsApiKey}&libraries=geometry`);
body.insertAdjacentElement("beforeend", mapScript);
mapScript.onload = () => {
initMap(parent);
};
mapScript.onerror = function (error) {
console.error("Error loading Google Maps API:", error);
};
};
function initMap(parent) {
const latLongData = JSON.parse(document.getElementById("LatLongData").innerText);
const markerImagePath = document.getElementById("markerImagePath").innerText;
var firstKey = Object.keys(latLongData)[0];
var firstLocation = latLongData[Object.keys(latLongData)[0]];
const zoomButton = 1;
const satelliteView = 'SATELLITE';
const mapTypeIdMapping = {
HYBRID: google.maps.MapTypeId.HYBRID,
ROADMAP: google.maps.MapTypeId.ROADMAP,
SATELLITE: google.maps.MapTypeId.SATELLITE,
TERRAIN: google.maps.MapTypeId.TERRAIN,
};
const map = new google.maps.Map(parent, {
zoom: 13,
center: {lat: firstLocation.lat / 1000000, lng: firstLocation.long / 1000000},
});
map.setOptions({
zoomControl: zoomButton ? true : false,
});
// const locationMarkers = document.querySelectorAll(".location-marker");
latLongData.forEach((markerElement) => {
const latitude = parseFloat(markerElement.lat);
const longitude = parseFloat(markerElement.long);
const bodyText = markerElement.address;
const title = markerElement.title;
let markerIcon;
if (markerImagePath) {
markerIcon = {
url: `${window.location.origin}${markerImagePath}`, // url
scaledSize: new google.maps.Size(70, 70), // scaled size
origin: new google.maps.Point(0, 0), // origin
anchor: new google.maps.Point(0, 0) // anchor
};
}
if (!isNaN(latitude) && !isNaN(longitude)) {
const marker = new google.maps.Marker({
position: {lat: latitude / 1000000, lng: longitude / 1000000},
map: map,
title: title,
icon: markerIcon,
});
let contentString = `
${title}
${bodyText}
`;
const infoWindow = new google.maps.InfoWindow({
content: contentString,
});
marker.addListener("click", () => {
infoWindow.open(map, marker);
});
}
});
}
this.init = function (Userconfig, solSetting, key) {
// Read UserConfiguration:
if (typeof Userconfig.enableCookies !== 'undefined') {
config.enableCookies = Userconfig.enableCookies;
}
if (typeof Userconfig.useSessionCookie !== 'undefined') {
config.useSessionCookie = Userconfig.useSessionCookie;
}
if (typeof Userconfig.cookieNamespace !== 'undefined') {
config.cookieNamespace = Userconfig.cookieNamespace;
}
if (typeof Userconfig.privacyPolicyUrl !== 'undefined') {
config.privacyPolicyUrl = Userconfig.privacyPolicyUrl;
}
if (typeof Userconfig.showContentLabel !== 'undefined') {
config.showContentLabel = Userconfig.showContentLabel;
}
if (typeof Userconfig.rememberChoiceLabel !== 'undefined') {
config.rememberChoiceLabel = Userconfig.rememberChoiceLabel;
}
if (typeof Userconfig.privacyPolicyLabel !== 'undefined') {
config.privacyPolicyLabel = Userconfig.privacyPolicyLabel;
}
if (Array.isArray(Userconfig.CustomTypes)) {
this.types = Userconfig.CustomTypes;
}
for (let i = 0; i < this.types.length; i++) {
var selector = document.querySelectorAll('iframe[data-2click-type="' + this.types[i].type + '"],div[data-2click-type="' + this.types[i].type + '"]');
for (let x = 0; x < selector.length; x++) {
let service = selector[x].getAttribute('data-2click-service'); // get service name from iframe
let service_root = service + '_{rootPid}';
let check = solSetting[service];
if (consentStatuses[service_root] !== '1') {
wrap(selector[x], document.createElement('div'),
service,
solSetting[service].content,
solSetting[service].heading,
solSetting[service].button_color,
solSetting[service].text_color,
solSetting[service].background_image,
solSetting[service].enable_background_image,
solSetting[service].background_image_color,
solSetting[service].button_text_color,
solSetting[service].button_text,
solSetting[service].button_shape,
solSetting[service].heading_color,
);
} else {
selector[x].src = selector[x].getAttribute("data-src");
gdprInner?.classList.remove('gdprInner');
selector[x].style.display = 'block';
if (service === 'gdpr_extensions_com_gmap') {
let parent = selector[x];
let mapDiv = document.createElement('div');
mapDiv.id = "map" + i;
mapDiv.className = "map";
parent.parentNode.insertBefore(mapDiv, parent.nextSibling)
loadMapScript(selector[x].nextElementSibling);
}
if (service === 'gdpr_extensions_com_bmap') {
gdpr_extensions_com_bmap_gdpr(selector[x],'add');
}
if (service === 'gdpr_extensions_com_sfc') {
gdpr_extensions_com_sfc_gdpr(selector[x],'add');
}
if (service === 'gdpr_extensions_com_pinterest' || service === 'gdpr_extensions_com_pinterest_profile' || service === 'gdpr_extensions_com_pinterest_pin') {
loadPinterestScript();
}
}
}
}
// Get all toggle buttons
// For each toggle button
// let GtmScriptAdded = false;
let GtmScriptAdded = {
GtmScriptAdded : false
};
let MatomoScriptAdded = {
MatomoScriptAdded : false
};
if (toggleButtons.length !== 0) {
for (let i = 0; i < toggleButtons.length; i++) {
let extTitle = toggleButtons[i].getAttribute('data-ext-title');
let service = extTitle + '_{rootPid}';
// initially set the checkbox according to the cookie value
toggleButtons[i].checked = Boolean(Number(consentStatuses[service])); // convert string to boolean
// Adding GTM custom code here
gdpr_extensions_com_gt_gdpr({service: service, track:'tag',togglebtn: toggleButtons[i].checked, fnType: 'add', state: GtmScriptAdded});
// Adding meta custom code here
gdpr_extensions_com_mp_gdpr({service: service, track:'meta',togglebtn: toggleButtons[i].checked, fnType: 'add', state:
MatomoScriptAdded});
// Adding matomo custom code here
gdpr_extensions_com_mt_gdpr({service: service, track:'matomo',togglebtn: toggleButtons[i].checked, fnType: 'add', state: MatomoScriptAdded});
let wrapperFunctionData = this.types;
// add event listener on checkbox change
toggleButtons[i].addEventListener('change', function (e) {
setConsentStatus(service, this.checked ? '1' : '0'); // convert boolean to number
this.checked;
if (this.checked == false) {
gdpr_extensions_com_gt_gdpr({service: service, track:'tag', fnType: 'remove' });
// Removing matomo custom code here
gdpr_extensions_com_mt_gdpr({service: service, track:'matomo', fnType: 'remove' });
// Removing meta custom code here
gdpr_extensions_com_mp_gdpr({service: service, track:'meta', fnType: 'remove' });
DisableContent(extTitle, wrapperFunctionData)
wrapfunction(wrapperFunctionData, arr, extTitle);
} else {
// Adding GTM custom code here
gdpr_extensions_com_gt_gdpr({service: service, track:'tag', fnType: 'add' });
// Adding matomo custom code here
gdpr_extensions_com_mt_gdpr({service: service, track:'matomo', fnType: 'add' });
// Adding meta custom code here
gdpr_extensions_com_mp_gdpr({service: service, track:'meta', fnType: 'add' });
_2ClickIframePrivacy.EnableContent(extTitle)
}
});
}
}
function wrapfunction(e, settings, key) {
for (let i = 0; i < e.length; i++) {
var selector = document.querySelectorAll('iframe[data-2click-type="' + e[i].type + '"],div[data-2click-type="' + e[i].type + '"]');
for (let x = 0; x < selector.length; x++) {
let service = selector[x].getAttribute('data-2click-service'); // get service name from iframe
if (service == key) {
if (consentStatuses[service] !== '1') {
wrap(selector[x],
document.createElement('div'),
service, settings[service].content,
settings[service].heading,
settings[service].button_color,
settings[service].button_text_color,
settings[service].background_image,
settings[service].enable_background_image,
settings[service].background_image_color,
settings[service].button_text_color,
settings[service].button_text,
settings[service].button_shape,
settings[service].heading_color,
);
} else {
selector[x].src = selector[x].getAttribute("data-src");
}
}
}
}
}
if (toggleButtons.length !== 0) {
if (areAllChecked()) {
// acceptBtn.disabled = true;
// acceptBtn.classList.add('disabled');
}
}
};
}
}
// Call the function to add the GTM script
function areAllChecked() {
for (let i = 0; i < switchs.length; i++) {
if (!switchs[i].checked) {
return false;
}
}
return true;
}
document.addEventListener("DOMContentLoaded", function () {
let gdpr_categoryHeaders = document.querySelectorAll('.category-header');
let gdpr_accordionHeaders = document.querySelectorAll('.header-accordion');
let gdpr_moreBtn = document.querySelectorAll('.category-container .more_details');
let gdpr_cookieDataContainer = document.querySelector('.cookie-data');
let gdpr_goBackBtn = document.querySelectorAll('.go-back');
let gdpr_detailTable = document.querySelectorAll('.more-detail-table');
let gdpr_modalContent = document.querySelector('.modal-content');
let gdpr_scroll = document.querySelector('.modal-content .scroll');
let gdpr_icon = document.getElementById('gdpr-cookie-consent__icon');
let gdpr_model = document.getElementById('gdpr-cookie-consent__model');
if (gdpr_model) {
gdpr_icon?.addEventListener('click', function () {
gdpr_model.style.display = 'block';
document.body.classList.add('no-scroll');
})
gdpr_categoryHeaders?.forEach(header => {
header?.addEventListener('click', function (e) {
if(e.target.closest(".switch")){
return;
}
let content = header.nextElementSibling;
if (content.classList.contains('show')) {
// First, set max-height to the scrollHeight to ensure proper calculation
content.style.maxHeight = content.scrollHeight + 'px';
// Use requestAnimationFrame instead of setTimeout for better timing control
requestAnimationFrame(() => {
content.style.maxHeight = '0';
});
content.classList.remove('show');
content.classList.add('hide');
header.querySelector('.arrow').textContent = '+';
} else {
// First, remove the hide class and set max-height to scrollHeight
content.classList.remove('hide');
content.classList.add('show');
content.style.maxHeight = content.scrollHeight + 'px';
// To trigger a transition, set max-height to 'auto' after the transition ends
content.addEventListener('transitionend', function () {
content.style.maxHeight = 'auto';
}, { once: true });
header.querySelector('.arrow').textContent = '-';
}
});
});
gdpr_accordionHeaders?.forEach(header => {
header?.addEventListener('click', function () {
// Now we are targeting the `.category-content` inside the same `.category-container`
let content = header.parentElement.nextElementSibling;
if (content.classList.contains('show')) {
// First, set max-height to the scrollHeight to ensure proper calculation
content.style.maxHeight = content.scrollHeight + 'px';
// Use requestAnimationFrame for smoother transition
requestAnimationFrame(() => {
content.style.maxHeight = '0';
});
content.classList.remove('show');
content.classList.add('hide');
header.querySelector('.arrow').textContent = '+';
} else {
// Remove 'hide' and add 'show' class
content.classList.remove('hide');
content.classList.add('show');
content.style.maxHeight = content.scrollHeight + 'px';
// To trigger a transition, set max-height to 'auto' after the transition ends
content.addEventListener('transitionend', function () {
content.style.maxHeight = 'auto';
}, { once: true });
header.querySelector('.arrow').textContent = '-';
}
});
});
let closeModal = document.getElementById('closeModal');
closeModal?.addEventListener('click', function () {
document.body.classList.remove('no-scroll');
document.getElementById('gdpr-cookie-consent__model').style.display = 'none';
});
// let modal = document.getElementById('gdpr-cookie-consent__model');
let cookiesRejected = localStorage.getItem('cookiesRejected');
console.log(cookiesRejected);
console.log(!cookiesRejected);
if (!cookiesRejected) {
console.log('inif');
gdpr_model.style.display = "block";
}
gdpr_moreBtn?.forEach((btn) => {
btn?.addEventListener('click', function () {
let btnIdentifier = this?.getAttribute('data-identifier');
const table = document.querySelector(".more-detail-table[data-identifier="+btnIdentifier+"]");
if (table) {
gdpr_cookieDataContainer.classList.add('d-none');
table.classList.remove('d-none');
gdpr_modalContent.classList.add('expanded');
gdpr_scroll.classList.add('expanded');
adjustModalWidth();
}
})
})
gdpr_goBackBtn.forEach((btn, index) => {
btn.addEventListener('click', function () {
gdpr_detailTable.forEach((item) => {
item.classList.add('d-none');
})
gdpr_cookieDataContainer.classList.remove('d-none');
if (gdpr_modalContent && gdpr_scroll) {
gdpr_modalContent.classList.remove('expanded');
gdpr_modalContent.style.width = '100%';
gdpr_scroll.classList.remove('expanded');
gdpr_scroll.style.maxWidth = '440px';
}
})
})
}
});
window.addEventListener('resize', adjustModalWidth);
function adjustModalWidth() {
// query for the elements that we want to dynamically change their widths
var gdpr_modalContent = document.querySelector('.modal-content.expanded');
var scrollElement = document.querySelector('.scroll.expanded');
var windowWidth = window.innerWidth;
var maxWidth = windowWidth - 20;
// Check if window width is less than 1400px, if so, set max-width to windowWidth - 40px
if (windowWidth < 1400) {
gdpr_modalContent? gdpr_modalContent.style.width = maxWidth + 'px' : '';
scrollElement ? scrollElement.style.maxWidth = maxWidth + 'px' : '';
} else {
gdpr_modalContent ? gdpr_modalContent.style.width = '440px' : '';
scrollElement ? scrollElement.style.maxWidth = '440px' : '';
}
}
function setCookies(value) {
if (value === 'false') {
window.yett.unblock()
}
localStorage.setItem('cookiesRejected', value);
document.getElementById('gdpr-cookie-consent__model').style.display = 'none';
document.body.classList.remove('no-scroll');
}
function gdpr_extensions_com_bmap_gdpr(iframe, type) {
if (type != 'add' ) {
const BingMap = document.getElementById('bingmap');
BingMap.remove();
let elementToRemove = iframe.nextElementSibling;
if (elementToRemove) {
elementToRemove.parentNode.removeChild(elementToRemove);
}
}else{
let parent = iframe;
let mapDiv = document.createElement('div');
mapDiv.id = "bingmap";
mapDiv.className = "bingmap";
parent.parentNode.insertBefore(mapDiv, parent.nextSibling)
const bingMapScript = document.createElement("script");
const bingBody = document.querySelector("body");
bingMapScript.setAttribute(
"src",
'https://www.bing.com/api/maps/mapcontrol?callback=GetMap'
);
bingBody.insertAdjacentElement("beforeend", bingMapScript);
bingMapScript.onload = () => {
GetMap(parent);
};
bingMapScript.onerror = function (error) {
console.error("Error loading Google Maps API:", error);
};
}
}
function gdpr_extensions_com_sfc_gdpr(iframe, type) {
if (type != 'add' ) {
let SfcDiv = iframe.nextElementSibling;
while (SfcDiv.firstChild) {
SfcDiv.removeChild(SfcDiv.firstChild);
}
SfcDiv.style.display = 'none';
}else{
let parent = iframe;
let SfcDiv = iframe.nextElementSibling;
let SfcScript = atob(SfcDiv.getAttribute('data-2click-curator'));
let scriptContent = SfcScript.match(/