add cookie-consent
This commit is contained in:
58
inc/cookie-consent.php
Normal file
58
inc/cookie-consent.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<div id="cookie-consent-banner" class="cookie-consent" style="display: none;">
|
||||||
|
<div class="cookie-consent-content">
|
||||||
|
<div>Мы используем файлы cookie для улучшения работы сайта. Продолжая использование сайта, вы соглашаетесь с <a style="color: white; text-decoration: underline;" href="https://profile.ru/zashita-personalnyh-dannyh/" target="_blank">условиями</a></div>
|
||||||
|
<button id="cookie-consent-accept" class="cookie-consent-button">Принять</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<style>
|
||||||
|
.cookie-consent {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: rgba(51, 51, 51, 0.95);
|
||||||
|
color: #fff;
|
||||||
|
padding: 15px;
|
||||||
|
z-index: 9999;
|
||||||
|
box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cookie-consent-content {
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cookie-consent-button {
|
||||||
|
background: black;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cookie-consent-button:hover {
|
||||||
|
background: #72757c;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
|
if (!localStorage.getItem('cookie_consent_accepted')) {
|
||||||
|
const banner = document.getElementById('cookie-consent-banner');
|
||||||
|
banner.style.display = 'block';
|
||||||
|
|
||||||
|
document.getElementById('cookie-consent-accept').addEventListener('click', function() {
|
||||||
|
localStorage.setItem('cookie_consent_accepted', 'true');
|
||||||
|
banner.style.display = 'none';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -116,6 +116,8 @@
|
|||||||
</script>
|
</script>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php get_template_part("inc/cookie-consent") ?>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user