Global: Add Cookies notification

just for fun xd
This commit is contained in:
veselcraft 2022-05-09 16:01:37 +03:00
parent 45fe270700
commit f481b27503
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
5 changed files with 69 additions and 1 deletions

View file

@ -275,6 +275,8 @@
</p>
</div>
{include "components/cookies.xml"}
{script "js/node_modules/msgpack-lite/dist/msgpack.min.js"}
{script "js/node_modules/soundjs/lib/soundjs.min.js"}
{script "js/node_modules/ky/umd.js"}

View file

@ -0,0 +1,35 @@
<div class="cookies-popup" style="display: none;">
<div class="contanier">
<div class="text">
{tr("cookies_popup_content")|noescape}
</div>
<div class="buttons">
<a href="javascript:agreeWithCookies()" class="button">
{_cookies_popup_agree}
</a>
</div>
</div>
</div>
<script>
let cookie = decodeURIComponent(document.cookie).split(";");
let cookiesAgreed = false;
for(let i = 0; i < cookie.length; i++) {
let c = cookie[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if(c == "cookiesAgreed=true") {
cookiesAgreed = true;
break;
}
}
if(!cookiesAgreed) {
u(".cookies-popup").nodes[0].style.display = "block";
}
function agreeWithCookies() {
document.cookie = "cookiesAgreed=true";
u(".cookies-popup").nodes[0].style.display = "none";
}
</script>

View file

@ -1913,4 +1913,25 @@ table td[width="120"] {
border-bottom: 1.5px solid #707070;
text-align: center;
user-select: none;
}
}
.cookies-popup {
position: fixed;
bottom: 0;
width: 100%;
height: 40px;
background: linear-gradient(#fff, #eee);
box-shadow: inset 0px 1px 0px #bbb, inset 0px 2px 0px #ddd;
}
.cookies-popup .contanier {
width: 760px;
display: flex;
margin: 0 auto;
align-items: center;
height: 100%;
}
.cookies-popup .contanier .text {
width: 100%;
}

View file

@ -972,3 +972,8 @@
/* User alerts */
"user_alert_scam" = "This account has been reported a lot for scam. Please be careful, especially if he asked for money.";
/* Cookies pop-up */
"cookies_popup_content" = "All kids love cookies, so this website uses cookies to identify you and nothing more. Check <a href='/privacy'>our privacy policy</a> for more information.";
"cookies_popup_agree" = "Accept";

View file

@ -1023,3 +1023,8 @@
/* User alerts */
"user_alert_scam" = "На этот аккаунт много жаловались в связи с мошенничеством. Пожалуйста, будьте осторожны, особенно если у вас попросят денег.";
/* Cookies pop-up */
"cookies_popup_content" = "Все дети любят печенья, поэтому этот вебсайт использует Cookies чтобы идентифицировать вас и ничего более. Ознакомьтесь с нашей <a href='/privacy'>политикой конфиденциальности</a> для получения дополнительной информации.";
"cookies_popup_agree" = "Согласен";