HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/komma.pro/resources/views/site/partials/cookieIndex.blade.php
@if($cookieConsentConfig['enabled'] && ! $alreadyConsentedWithCookies)

    @include('site.partials.cookieDialog')

    <script>

        window.laravelCookieConsent = (function () {

            var COOKIE_VALUE = 1;

            // Set has-cookie class on HTML
            var root = document.documentElement;
            root.classList.add('has-cookie-dialog');
            /**
             * The user agrees:
             * Hide dialog and set cookie
             *
             */
            function consentWithCookies() {
                setCookie('{{ $cookieConsentConfig['cookie_name'] }}', COOKIE_VALUE, 365 * 20);
                hideCookieDialog();
                root.classList.remove('has-cookie-dialog');
            }

            /**
             * Check if the cookie exists
             *
             * @param name
             * @returns {boolean}
             */
            function cookieExists(name) {
                return (document.cookie.split('; ').indexOf(name + '=' + COOKIE_VALUE) !== -1);
            }

            /**
             * Hide the dialog
             */
            function hideCookieDialog() {
                var dialogs = document.getElementsByClassName('js-cookie-consent');

                for (var i = 0; i < dialogs.length; ++i) {
                    dialogs[i].style.display = 'none';
                }
            }

            /**
             * Set cookie
             *
             * @param name
             * @param value
             * @param expirationInDays
             */
            function setCookie(name, value, expirationInDays) {
                var date = new Date();
                date.setTime(date.getTime() + (expirationInDays * 24 * 60 * 60 * 1000));
                document.cookie = name + '=' + value + '; ' + 'expires=' + date.toUTCString() +';path=/{{ config('session.secure') ? ';secure' : null }}';
            }

            /**
             * If the cookie already exists
             * Hide the dialog
             */
            if(cookieExists('{{ $cookieConsentConfig['cookie_name'] }}')) {
                hideCookieDialog();
            }

            /**
             * Add click event to button
             *
             * @type {NodeList}
             */
            var buttons = document.getElementsByClassName('js-cookie-consent-agree');
            for (var i = 0; i < buttons.length; ++i) {
                buttons[i].addEventListener('click', consentWithCookies);
            }

            return {
                consentWithCookies: consentWithCookies,
                hideCookieDialog: hideCookieDialog
            };
        })();
    </script>

@endif