www.originalcibulak.sk Open in urlscan Pro
31.31.227.81  Public Scan

Submitted URL: https://originalcibulak.sk/user/templates/static-assets/js/cookies.js?build=132
Effective URL: https://www.originalcibulak.sk/user/templates/static-assets/js/cookies.js?build=132
Submission: On December 15 via api from US — Scanned from DK

Form analysis 0 forms found in the DOM

Text Content


var cookiesInited = false;
var cookies = {
    init: function () {
        if ($('#cookies-bar').length && $('#cookies-bar-settings').length && cookiesInited === false) {
            cookiesInited = true;
            cookies.initButtons();
            cookies.initShowMore();
            cookies.showCookieBar();
        }
    },
    removeCookieBar: function () {
        $('#cookies-bar').remove();
        $('#cookies-bar-settings').remove();
    },
    showCookieBar: function () {
        //$('#cookies-bar').show();
        $('#cookies-bar').slideDown();
    },
    initShowMore: function () {
        $('#cookies-bar-settings').first().find('.show-more').each(function () {
            $(this).click(function (e) {
                e.preventDefault();
                cookies.showMore($(this).data('class'));
            });
        });
    },
    initButtons: function () {
        $('#cookies_settings').click(function (e) {
            e.preventDefault();
            cookies.showSettings();
        });
        $('#cookies_ok2').click(function (e) {
            e.preventDefault();
            cookies.allCookies();
        });
        $('#cookies_ok').click(function (e) {
            e.preventDefault();
            cookies.allCookies();
        });
        $('#cookies_only_selected').click(function (e) {
            e.preventDefault();
            cookies.onlySelected();
        });
        $('#disable-cookies').click(function (e) {
            e.preventDefault();
            cookies.disableCookies();
        });
        $('#close-cookie-settings').click(function (e) {
            e.preventDefault();
            cookies.closeSettings();
        });
    },
    showMore: function (_c) {
        var a = $('.' + _c);
        if (a.hasClass('opened')) {
            // Close
            a.css('-webkit-line-clamp', '2').removeClass('opened');
            $('[data-class="' + _c + '"]').text($trans['show_more']);
        } else {
            // Open
            a.css('-webkit-line-clamp', '100').addClass('opened');
            $('[data-class="' + _c + '"]').text($trans['zobrazit_mene']);
        }
    },
    allCookies: function () {
        var _d = new Object();
        _d.analytics = true;
        _d.personal = true;
        _d.ads = true;
        cookies.send(_d);
    },
    onlySelected: function () {
        var _d = new Object();
        _d.analytics = (($('#cookies_analytics').is(':checked')) ? true : false);
        _d.personal = (($('#cookies_personal').is(':checked')) ? true : false);
        _d.ads = (($('#cookies_ads').is(':checked')) ? true : false);
        cookies.send(_d);
    },
    disableCookies: function () {
        var _d = new Object();
        _d.analytics = false;
        _d.personal = false;
        _d.ads = false;
        cookies.send(_d);
    },
    showSettings: function () {
        $('#cookies-bar-settings').show();
    },
    closeSettings: function () {
        $('#cookies-bar-settings').hide();
    },
    deniedOrGranted: function (r) {
        if (r === true) {
            return 'granted';
        }
        return 'denied';
    },
    send: function (_d) {
        _d.action = 'set-cookies';
        $.post(nody.functions.append_url('/action/cookies/set/'), _d, function (res) {
            if ($.trim(res) === 'ok') {
                // Dopadlo to OK, tak to jdeme provest misto refreshe
                var consentChange = {
                    'ad_storage': cookies.deniedOrGranted(_d.ads),
                    'ad_user_data': cookies.deniedOrGranted(_d.ads),
                    'ad_personalization': cookies.deniedOrGranted(_d.ads),
                    'analytics_storage': cookies.deniedOrGranted(_d.analytics),
                    'personalization_storage': cookies.deniedOrGranted(_d.personal)
                };
                if (typeof (gtag) !== 'undefined') {
                    gtag('consent', 'update', consentChange);
                    dataLayer.push({
                        event: 'update_consent'
                    });
                }
                cookies.removeCookieBar();
            } else {
                // Něco se nepovedlo
                alert('Nepodařilo se kontaktovat server. Opakujte akci později.');
            }
        }).fail(function () {
            alert('Nepodařilo se kontaktovat server. Opakujte akci později.');
        });
    },
};
window.addEventListener('load', function () {
    window.setTimeout(function () {
        cookies.init();
    }, 1500);
});