/* globals $ cookie_panel ajaxData */ var $= jQuery.noConflict(); document.addEventListener('DOMContentLoaded', function () { InitCookiePolicy() $('.asd-panel-open').on('click', function () { $.gdprcookie.display() }) }) function InitCookiePolicy () { $.gdprcookie.init({ cookieTypes: [ { type: cookie_panel.essential, value: 'essential', description: 'These are cookies that are essential for the website to work correctly.' }, { type: cookie_panel.preferences, value: 'preferences', description: 'These are cookies that are related to your site preferences, e.g. remembering your username, site colours, etc.' }, { type: cookie_panel.analytics, value: 'analytics', description: 'Cookies related to site visits, browser types, etc.' }, { type: cookie_panel.marketing, value: 'marketing', description: 'Cookies related to marketing, e.g. newsletters, social media, etc' } ], title: cookie_panel.title, subtitle: cookie_panel.sub_title, message: cookie_panel.message + ' ' + '' + cookie_panel.text_cookie_info + '', delay: 600, expires: parseInt(cookie_panel.expiry), acceptBtnLabel: cookie_panel.btn_text, advancedBtnLabel: cookie_panel.pref_btn_text, acceptReload: true, cookieName: 'asd-cookie-consent-prefs' }) $(document.body) .on('gdpr:show', function () { // Insert here CSS mod and remove diaply function // Set CSS Option if (cookie_panel.position === 'bottom-left') { $('.gdprcookie').css('left', '1.5rem') } else if (cookie_panel.position === 'bottom-right') { $('.gdprcookie').css('right', '1.5rem') } $('.gdprcookie').css({ 'background': cookie_panel.back_color, 'color': cookie_panel.text_color, 'border-radius': '4px' }) $('.gdprcookie h1, .gdprcookie h2').css({ 'font-size': cookie_panel.title_font_size + 'px' }) $('.gdprcookie p, .gdprcookie label, .gdprcookie-buttons').css({ 'font-size': cookie_panel.text_font_size + 'px' }) $('.gdprcookie-buttons button:first-child').css({ 'background': cookie_panel.btn_color, 'border-color': cookie_panel.btn_color, 'color': cookie_panel.btn_text_color, 'padding': '10px' }) $('.gdprcookie-buttons button:last-child').css({ 'background': cookie_panel.pref_btn_color, 'border-color': cookie_panel.pref_btn_color, 'color': cookie_panel.pref_btn_text_color, 'padding': '10px' }) // END CSS Option }) .on('gdpr:advanced', function () { if ($.gdprcookie.preference('preferences') === true) { $('#gdpr-cookietype-1').prop('checked', true) } if ($.gdprcookie.preference('analytics') === true) { $('#gdpr-cookietype-2').prop('checked', true) } if ($.gdprcookie.preference('marketing') === true) { $('#gdpr-cookietype-3').prop('checked', true) } }) }