add cookie

This commit is contained in:
SBD
2024-01-11 19:10:30 +03:00
parent 6c1011e59e
commit b2abb3046b
3 changed files with 63 additions and 0 deletions

View File

@@ -2910,4 +2910,44 @@
.handler_curtain_left{
display: none;
}
/*cookie*/
.cookie_block{
background: #000000;
width: 50%;
position: fixed;
bottom: 5px;
z-index: 100000000000000;
box-sizing: border-box;
display: none;
}
.cookie_block.show{
display: block;
}
.txt_cookie{
color: #FFFFFF;
font-size: 14px;
}
.a_cookie{
color: #FFFFFF;
font-size: 14px;
}
.container_content_cookie_block{
display: flex;
justify-content: space-between;
padding: 15px;
}
.cookie_btn{
background: none;
border: 2px solid white;
color: #FFFFFF;
height: 25px;
width: 95px;
cursor: pointer;
}

View File

@@ -11,6 +11,7 @@ window.onload = function (){
middleWareJS()
openOrCloseCurtainSupportChat()
openOverlayOrClose()
checkStateCookie()
}
//
@@ -151,3 +152,17 @@ function scroll_ev (event,el){
}
}
function checkStateCookie () {
if (window.document.cookie.includes("allow_cookie=true")){
document.querySelector(".cookie_block").classList.remove("show")
}
}
function setCokie () {
let date = new Date();
let days = 182;
date.setTime(+ date + (days * 86400000));
window.document.cookie = "allow_cookie=true" + "; expires=" + date.toGMTString() + "; path=/";
document.querySelector(".cookie_block").classList.remove("show")
return value;
}

View File

@@ -59,6 +59,14 @@
</head>
<body{% if page_type == 'routes' %} onscroll="scroll_ev(event,this)"{% endif %}>
<div class="cookie_block show">
<div class="container_content_cookie_block">
<div class="txt_cookie">Сайт использует файлы cookie. Просматривая этот сайт, Вы соглашаетесь
<a class="a_cookie" href="#">с условиями использования cookie-файлов</a>
</div>
<button class="cookie_btn" onclick="setCokie()">Понятно</button>
</div>
</div>
{% if page_type != 'routes' %}
<script>