130 lines
5.1 KiB
PHP
130 lines
5.1 KiB
PHP
{{-- blade-formatter-disable --}}
|
|
@php
|
|
|
|
$site_name = Str::ucfirst(config('app.name'));
|
|
$logo_picture_url = asset('assets/images/logo-doux.png');
|
|
$logo_title_text = Str::ucfirst(__('cookie-notice.logo_title_text', ['name' => $site_name]));
|
|
$logo_alt_text = Str::ucfirst(__('cookie-notice.logo_alt_text'));
|
|
|
|
|
|
|
|
$strings = (object)[
|
|
'modal_title' => __('cookie-notice.modal_title'),
|
|
'button_customize_cookies' => __('cookie-notice.button_customize_cookies'),
|
|
'button_close_cookies' => __('cookie-notice.button_close_cookies'),
|
|
'button_title_open_new_tab' => __('cookie-notice.button_title_open_new_tab'),
|
|
'button_toggle_cookie' => __('cookie-notice.button_toggle_cookie'),
|
|
'button_forbid_all' => Str::upper(__('cookie-notice.button_forbid_all')),
|
|
'button_allow_all' => Str::upper(__('cookie-notice.button_allow_all')),
|
|
'button_customize' => Str::upper(__('cookie-notice.button_customize')),
|
|
'button_forbid_all_title' => __('cookie-notice.button_forbid_all_title'),
|
|
'button_allow_all_title' => __('cookie-notice.button_allow_all_title'),
|
|
'button_validate_and_close' => Str::upper(__('cookie-notice.button_validate_and_close')),
|
|
'banner_title' => __('cookie-notice.banner_title', ['site_name' => $site_name]),
|
|
'banner_text' => sprintf(
|
|
"%s<br><br>%s",
|
|
__('cookie-notice.banner_text'),
|
|
"<a class='underline' href='" . route($routeprefixer . 'policy') . "'>" . __('Charte de confidentialité') . "</a>"
|
|
),
|
|
'panel_content' => __('cookie-notice.panel_content'),
|
|
'picture_cookie_title' => __('cookie-notice.picture_cookie_title'),
|
|
'navigation_title' => __('cookie-notice.navigation_title'),
|
|
];
|
|
|
|
$cookies = [];
|
|
|
|
// RECAPTCHA
|
|
$cookies['recaptcha'] = [
|
|
'name' => __('cookie-notice.custom.recaptcha.title'),
|
|
'description' => __('cookie-notice.custom.recaptcha.description'),
|
|
'link' => 'https://policies.google.com/privacy',
|
|
'labelLink' => __('En savoir +'),
|
|
'cookies' => ['NID', '__Secure-3PAPISID', '__Secure-3PSID', '__Secure-3PSIDCC']
|
|
];
|
|
|
|
$cookies['recaptcha']['script'] = <<<SCRIPT
|
|
function () {
|
|
if (window.__CN_Recaptcha) {
|
|
window.__CN_Recaptcha();
|
|
}
|
|
[...document.getElementsByClassName('cn-cookie-activate')].forEach(function(el) {
|
|
if (el.dataset.cookieName === 'recaptcha') {
|
|
el.classList.add('d-none');
|
|
}
|
|
});
|
|
}
|
|
SCRIPT;
|
|
$cookies['recaptcha']['fallback'] = <<<FALLBACK
|
|
function () {
|
|
if (window.__CN_Recaptcha_Reset) {
|
|
window.__CN_Recaptcha_Reset();
|
|
}
|
|
|
|
[...document.getElementsByClassName('cn-cookie-activate')].forEach(function(el) {
|
|
if (el.dataset.cookieName === 'recaptcha') {
|
|
el.classList.remove('d-none');
|
|
}
|
|
});
|
|
}
|
|
FALLBACK;
|
|
|
|
// MATOMO
|
|
$cookies['matomo'] = [
|
|
'name' => __('cookie-notice.custom.matomo.title'),
|
|
'description' => __('cookie-notice.custom.matomo.description'),
|
|
'link' => 'https://fr.matomo.org/gdpr-analytics/',
|
|
'labelLink' => __('En savoir +'),
|
|
'cookies' => ['_pk']
|
|
];
|
|
|
|
$cookies['matomo']['script'] = <<<SCRIPT
|
|
function () {
|
|
var _paq = window._paq = window._paq || [];
|
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
|
_paq.push(['trackPageView']);
|
|
_paq.push(['enableLinkTracking']);
|
|
(function() {
|
|
var u="//yl.s-web.fr/";
|
|
_paq.push(['setTrackerUrl', u+'rainbow']);
|
|
_paq.push(['setSiteId', '
|
|
SCRIPT;
|
|
$cookies['matomo']['script'] .= config("services.matomo.site_id");
|
|
$cookies['matomo']['script'] .= <<<SCRIPT
|
|
']);
|
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
|
g.async=true; g.src=u+'unicorn'; s.parentNode.insertBefore(g,s);
|
|
})();
|
|
}
|
|
SCRIPT;
|
|
|
|
@endphp
|
|
|
|
{{-- INCLUDE TEMPLATE --}}
|
|
@include('vendor.cookie-notice.templates.standard', compact(
|
|
'site_name', 'logo_picture_url', 'logo_alt_text',
|
|
'logo_title_text', 'strings'
|
|
))
|
|
|
|
|
|
<script nonce="{{ $nonce ?? '' }}">
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
window.WebCookieNotice = {};
|
|
@foreach($cookies as $index_name => $cookie)
|
|
window.WebCookieNotice['{{ $index_name }}'] = {};
|
|
window.WebCookieNotice['{{ $index_name }}'].tmp = {};
|
|
// SCRIPT
|
|
window.WebCookieNotice['{{ $index_name }}'].tmp.script = {!! strip_tags($cookie['script']) !!};
|
|
@php unset($cookie['script']); @endphp
|
|
// FALLBACK
|
|
@if(isset($cookie['fallback']))
|
|
window.WebCookieNotice['{{ $index_name }}'].tmp.fallback = {!! strip_tags($cookie['fallback']) !!};
|
|
@php unset($cookie['fallback']); @endphp
|
|
@endif
|
|
window.WebCookieNotice['{{ $index_name }}'].conf = @json($cookie);
|
|
window.WebCookieNotice['{{ $index_name }}'].conf.script = window.WebCookieNotice['{{ $index_name }}'].tmp.script;
|
|
window.WebCookieNotice['{{ $index_name }}'].conf.fallback = window.WebCookieNotice['{{ $index_name }}'].tmp.fallback;
|
|
window.WebCookieNotice['{{ $index_name }}'] = window.WebCookieNotice['{{ $index_name }}'].conf;
|
|
@endforeach
|
|
window.WebCookieNotice = new window.CookieNotice(window.WebCookieNotice);
|
|
});
|
|
</script>
|