mirror of
https://github.com/DerTyp7/tealcode-django-python.git
synced 2025-10-29 12:32:09 +01:00
added cookie banner
This commit is contained in:
@@ -106,4 +106,42 @@ footer .footer-links a{
|
||||
|
||||
footer .footer-links a:hover{
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* COOKIE BANNER */
|
||||
#cookie_banner{
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height: 60px;
|
||||
background-color: rgb(0, 0, 0);
|
||||
bottom:0;
|
||||
z-index: 100;
|
||||
}
|
||||
#cookie_banner p{
|
||||
font-size: 13pt;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
margin-top: 18px;
|
||||
margin-left: 200px;
|
||||
}
|
||||
|
||||
#cookie_banner button{
|
||||
float: right;
|
||||
margin-right: 200px;
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
margin-top: -30px;
|
||||
border: 3px solid green;
|
||||
background-color: rgba(77, 77, 77, 0.5);
|
||||
color: white;
|
||||
font-size: 15pt;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
transition: 0.1s;
|
||||
transition-timing-function: linear;
|
||||
}
|
||||
|
||||
#cookie_banner button:hover{
|
||||
background-color: rgba(77, 77, 77, 0.801);
|
||||
border: 3px solid rgb(1, 180, 1);
|
||||
}
|
||||
@@ -19,17 +19,29 @@
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
<div id="cookie_banner">
|
||||
<p>We only use non-technical cookies for analysis purposes. Do you want to accept? (please)</p>
|
||||
<button onclick='document.cookie = "cookies_allowed=1;path=/";window.location.reload();'>Accept</button>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
cookies_allowed = document.cookie.split("cookies_allowed=")[1];
|
||||
cookies_allowed = document.cookie.split("cookies_allowed=")[1]
|
||||
console.log(cookies_allowed)
|
||||
|
||||
if(cookies_allowed == null){
|
||||
document.cookie = "cookies_allowed=0;path=/";
|
||||
cookies_allowed = document.cookie.split("cookies_allowed=")[1]
|
||||
}
|
||||
|
||||
cookies_allowed.replace(";","");
|
||||
|
||||
if(cookies_allowed == "1"){
|
||||
console.log("LOAD ANALYTILCS");
|
||||
document.getElementById("cookie_banner").style.display = "none";
|
||||
}else if(cookies_allowed == "0"){
|
||||
console.log("DO NOT LOAD ANALYTILCS");
|
||||
}else{
|
||||
document.cookie = "cookies_allowed=1";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user