first commit
This commit is contained in:
12
resources/views/vendor/cookie-consent/dialogContents.blade.php
vendored
Normal file
12
resources/views/vendor/cookie-consent/dialogContents.blade.php
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
<div id="cookies-box" class="js-cookie-consent cookie-consent">
|
||||
<div class="container">
|
||||
<h4>Privacy and Cookies Policy</h4>
|
||||
<div class="d-lg-flex">
|
||||
<p>
|
||||
This website uses cookies to improve your user experience and collect data related to network traffic. By continuing to use this site you agree to our use of cookies. <br />Our <a href="/member-privacy-policy" target="_blank">Privacy and Cookie Policy</a> provides more information on the use and deactivation of cookies.
|
||||
</p>
|
||||
<div class="cookies-btn"><a class="js-cookie-consent-agree cookie-consent__agree">Accept</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
56
resources/views/vendor/cookie-consent/index.blade.php
vendored
Normal file
56
resources/views/vendor/cookie-consent/index.blade.php
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
@if($cookieConsentConfig['enabled'] && ! $alreadyConsentedWithCookies)
|
||||
|
||||
@include('cookie-consent::dialogContents')
|
||||
|
||||
<script>
|
||||
|
||||
window.laravelCookieConsent = (function () {
|
||||
|
||||
const COOKIE_VALUE = 1;
|
||||
const COOKIE_DOMAIN = '{{ config('session.domain') ?? request()->getHost() }}';
|
||||
|
||||
function consentWithCookies() {
|
||||
setCookie('{{ $cookieConsentConfig['cookie_name'] }}', COOKIE_VALUE, {{ $cookieConsentConfig['cookie_lifetime'] }});
|
||||
hideCookieDialog();
|
||||
}
|
||||
|
||||
function cookieExists(name) {
|
||||
return (document.cookie.split('; ').indexOf(name + '=' + COOKIE_VALUE) !== -1);
|
||||
}
|
||||
|
||||
function hideCookieDialog() {
|
||||
const dialogs = document.getElementsByClassName('js-cookie-consent');
|
||||
|
||||
for (let i = 0; i < dialogs.length; ++i) {
|
||||
dialogs[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function setCookie(name, value, expirationInDays) {
|
||||
const date = new Date();
|
||||
date.setTime(date.getTime() + (expirationInDays * 24 * 60 * 60 * 1000));
|
||||
document.cookie = name + '=' + value
|
||||
+ ';expires=' + date.toUTCString()
|
||||
+ ';domain=' + COOKIE_DOMAIN
|
||||
+ ';path=/{{ config('session.secure') ? ';secure' : null }}'
|
||||
+ '{{ config('session.same_site') ? ';samesite='.config('session.same_site') : null }}';
|
||||
}
|
||||
|
||||
if (cookieExists('{{ $cookieConsentConfig['cookie_name'] }}')) {
|
||||
hideCookieDialog();
|
||||
}
|
||||
|
||||
const buttons = document.getElementsByClassName('js-cookie-consent-agree');
|
||||
|
||||
for (let i = 0; i < buttons.length; ++i) {
|
||||
buttons[i].addEventListener('click', consentWithCookies);
|
||||
}
|
||||
|
||||
return {
|
||||
consentWithCookies: consentWithCookies,
|
||||
hideCookieDialog: hideCookieDialog
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
|
||||
@endif
|
Reference in New Issue
Block a user