REmove code duplication on cn-cookie example
This commit is contained in:
parent
f59ad309f6
commit
a86ec95a28
1 changed files with 0 additions and 33 deletions
|
|
@ -212,39 +212,6 @@ SCRIPT;
|
|||
|
||||
@endphp
|
||||
|
||||
{{-- INCLUDE TEMPLATE --}}
|
||||
@include('theme::vendor.cookie-notice-templates.standard', compact(
|
||||
'site_name', 'logo_picture_url', 'logo_alt_text',
|
||||
'logo_title_text', 'confidentiality_page_url', 'strings'
|
||||
))
|
||||
|
||||
@push('scripts')
|
||||
<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>
|
||||
@endpush
|
||||
|
||||
|
||||
|
||||
{{-- INCLUDE TEMPLATE --}}
|
||||
@include('vendor.cookie-notice-templates.standard', compact(
|
||||
'site_name', 'logo_picture_url', 'logo_alt_text',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue