document.addEventListener('DOMContentLoaded',function(){
var policy=document.getElementById('policy');
var cookie=document.cookie.match(new RegExp('(?:^|; )'+
'policy_confirm'.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,'\\$1')+
'=([^;]*)'));
if(!cookie||cookie[1]!='Y'){
var policy_box=document.querySelector('div.policy-container');
if(policy_box){
if(!navigator.cookieEnabled){
policy_box.innerHTML='<div class="policy-text"><?php echo $text_privacy_enabled; ?></div>'
} else {
policy_box.innerHTML='<div class="policy-text"><?php echo $text_privacy; ?></div><a href="javascript:void(0)" class="policy-confirm"><?php echo $text_btn_privacy; ?></a>'
} setTimeout(function(){
policy.appendChild(policy_box);
policy.classList.add('active');
setTimeout(function(){
policy.classList.add('activated')
},400);
var policy_confirm=document.querySelector('.policy-confirm');
if(policy_confirm){
policy_confirm.addEventListener('click',function(){
policy.classList.remove('activated');
setTimeout(function(){
policy.remove()
},300);
document.cookie='policy_confirm=Y; path=/'
})
}
},100)
}
} else {
policy.remove()
}
})
document.addEventListener('DOMContentLoaded', () => {
const policy = document.getElementById('policy');
const policyReplaced = 'policy_confirm'.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,'\\$1');
const regExp = new RegExp(`(?:^|;)${policyReplaced}=([^;]*)`);
const cookie = document.cookie.match(regExp);
if (cookie[1] === 'Y') {
policy.remove()
return;
}
const policy_box = document.querySelector('div.policy-container');
if (policy_box) {
return;
}
const confirmButton = '<a href="javascript:void(0)" class="policy-confirm"><?php echo $text_btn_privacy; ?></a>';
policy_box.innerHTML = `
<div class="policy-text">
<?php echo ${!navigator.cookieEnabled ? '$text_privacy_enabled;' : '$text_privacy;'} ?>
</div>
<a href="javascript:void(0)" class="policy-confirm"><?php echo $text_btn_privacy; ?></a>
${navigator.cookieEnabled && confirmButton || ''}
`;
setTimeout(() => {
policy.appendChild(policy_box);
policy.classList.add('active');
setTimeout(() => policy.classList.add('activated'), 400);
const policy_confirm = document.querySelector('.policy-confirm');
policy_confirm && policy_confirm.addEventListener('click', () => {
policy.classList.remove('activated');
setTimeout(() => policy.remove(), 300);
document.cookie='policy_confirm=Y; path=/'
})
},100)
})