mirror of
https://github.com/Aroy-Art/Rinkusu.git
synced 2024-12-27 07:44:23 +01:00
Added cookie box
This commit is contained in:
parent
604d75b972
commit
4fbbf5dc3d
1 changed files with 24 additions and 0 deletions
|
@ -62,3 +62,27 @@
|
|||
{{ "<!-- Google Map API -->" | safeHTML }}
|
||||
<script src="{{ site.Params.map.gmap_api | safeURL }}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{ if site.Params.cookies.enable }}
|
||||
{{ "<!-- Cookie Box -->" | safeHTML }}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js"></script>
|
||||
<div id="js-cookie-box" class="cookie-box cookie-box-hide">
|
||||
This site uses cookies. By continuing to use this website, you agree to their use. <span id="js-cookie-button" class="btn btn-transparent">I Accept</span>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
const cookieBox = document.getElementById('js-cookie-box');
|
||||
const cookieButton = document.getElementById('js-cookie-button');
|
||||
if (!Cookies.get('cookie-box')) {
|
||||
cookieBox.classList.remove('cookie-box-hide');
|
||||
cookieButton.onclick = function () {
|
||||
Cookies.set('cookie-box', true, {
|
||||
expires: {{ site.Params.cookies.expire_days }}
|
||||
});
|
||||
cookieBox.classList.add('cookie-box-hide');
|
||||
};
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
{{ "<!-- /Cookie Box -->" | safeHTML }}
|
||||
{{ end }}
|
Loading…
Reference in a new issue