const cyrb53 = function(str, seed = 0) { let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed; for (let i = 0, ch; i < str.length; i++) { ch = str.charCodeAt(i); h1 = Math.imul(h1 ^ ch, 2654435761); h2 = Math.imul(h2 ^ ch, 1597334677); } h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909); h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909); return 4294967296 * (2097151 & h2) + (h1 >>> 0); }; var markup = ""; var debug = false; var domain = '.gym-store.cz'; var cookie_list = JSON.parse('{"required":["appwebrootindexphp","ORSYS-COOKIE-CONSENT","ORSYS-COOKIE-CONSENT-HIDE","cryptcookietest"],"analytical":[]}'); var cookie_settings = { required: 1 }; var cookiedomains = JSON.parse('{"appwebrootindexphp":".gym-store.eu","ORSYS-COOKIE-CONSENT":".gym-store.eu","ORSYS-COOKIE-CONSENT-HIDE":".gym-store.eu","cryptcookietest":".gym-store.eu"}'); var anonymize = JSON.parse('[]'); var ga_anonymized = false; function getCookieList(detail = false) { var theCookies = document.cookie.split(';'); var aString = ''; if (detail) { var list = []; for (var i = 1 ; i <= theCookies.length; i++) { aString = theCookies[i-1].split('='); var newItem = []; for (var j in aString) { newItem.push(aString[j]); } list.push(newItem); } } else { var list = []; for (var i = 1 ; i <= theCookies.length; i++) { aString = theCookies[i-1].split('='); list.push(aString[0].trim()); } } return list; } function isGACookie(cookiename) { var list = [ '_ga', '_gid', '_gat', ] if (list.includes(cookiename)) { return true; } if ((cookiename.substring(0, 4) == '_ga_') || (cookiename.substring(0, 8) == '_gac_gb_')) return true; return false; } function processCookies() { var list = getCookieList(true); for (var i in list) { var cdetail = list[i]; processCookie(cdetail); } } function processCookie(cookiedetail) { var cookiename = cookiedetail[0].trim(); var allowed = false; // be hard if (!debug) { for (var grp in cookie_list) { var sublist = cookie_list[grp]; if (sublist.includes(cookiename) && typeof cookie_settings[grp] != 'undefined' && cookie_settings[grp] == 1) { allowed = true; console.log('ALLOWED ' + cookiename); } } if (!allowed) { var cookiedomain = cookiedomains[cookiename] ? cookiedomains[cookiename] : domain; document.cookie = cookiename + '=; expires=Thu, 01 Jan 1970, 00:00:00 GTM; path=/; domain=' + cookiedomain; console.log('NOT ALLOWED ' + cookiename); if (isGACookie(cookiename)) { if (!ga_anonymized && (anonymize.length > 0)) { anonymizeGA(); } } } } else { console.log(cookiename); } } function insertScriptTag(src, id, callback) { if (!document.querySelector('script[src="' + src + '"]')) { var ele = document.createElement('script'); ele.src = src; ele.id = id; ele.type = 'text/javascript'; if (typeof callback == 'function') { console.log('callback ' + id); ele.onload = callback; } document.head.appendChild(ele); var script = document.querySelector('#' + id); } else { console.log('callback 2 ' + id); if (typeof callback == 'function') { callback(); } } } function anonymizeGA() { ga_anonymized = true; for (var i in anonymize) { try { insertScriptTag('https://www.googletagmanager.com/gtag/js?id=' + anonymize[i], anonymize[i], function() { insertScriptTag('https://cc.orsys.cz/get-ip/', 'cli-ip-locator', function() { let clientIP = orsys_cc_client_remote_ip; let validityInterval = Math.round (new Date() / 1000 / 3600 / 24 / 4); let clientIDSource = clientIP + ";" + window.location.host + ";" + navigator.userAgent + ";" + navigator.language + ";" + validityInterval; let clientIDHashed = cyrb53(clientIDSource).toString(16); window.dataLayer = window.dataLayer || []; if (typeof window.gtag === 'undefined') { function gtag() { window.dataLayer.push(arguments); } } gtag("js", new Date()), gtag("consent", "default", { ad_storage: "denied", analytics_storage: "denied" }), gtag("create", anonymize[i], { client_id: clientIDHashed, anonymize_ip: true, storage: "none", send_page_view: true }); console.log('nastaveno'); }); }); } catch (e) { console.log(e); } } } Element.prototype.toggle = function() { if ( this.style.display == '' || this.style.display == 'block' ) { this.style.display = 'none'; }else{ this.style.display = 'block'; } } Element.prototype.toggleClass = function(cls) { if (!this.classList.contains(cls)) { this.classList.add(cls); }else{ this.classList.remove(cls); } } function trackAction(action) { if (typeof $ != 'undefined') $.get('https://cc.orsys.cz/?key=46P8bNDwzmtd&action=' + action); //$.get('http://localhost/cookie/public/?key=46P8bNDwzmtd&action=' + action); } document.addEventListener("DOMContentLoaded", function(event) { setTimeout(function() { //testCookie(); getCookieSettings(); processCookies(); const template = document.createElement('div'); template.innerHTML = markup; document.body.appendChild(template); if (!getCookieList().includes('ORSYS-COOKIE-CONSENT') && displayCondition()) { trackAction('load'); setTimeout(function(element) { var elements = document.getElementsByClassName('cookie-consent'); for (var i in elements) { var element = elements[i]; if (typeof element === 'object') { element.classList.add('visible'); } } updateCheckboxes(); }, 10); } setTimeout(function(element) { var elements = document.getElementsByClassName('cookie-consent-minimal'); for (var i in elements) { var element = elements[i]; if (typeof element === 'object') { element.classList.add('visible'); } } updateCheckboxes(); }, 10); }, 1000); }); function updateCheckboxes() { for (var i in cookie_settings) { if (cookie_settings[i] == 1) { console.log(i); document.querySelector('input[name="' + i + '"]').checked = true; } } } function hideCookieWindow(set_reminder_cookie = false) { var elements = document.getElementsByClassName('cookie-consent'); for (var i in elements) { var element = elements[i]; if (typeof element === 'object') element.classList.remove('visible'); } document.getElementById('cookie-detail-wrap').classList.remove('visible'); if (set_reminder_cookie) { var exdays = 1; var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); document.cookie = 'ORSYS-COOKIE-CONSENT-HIDE=1;expires=' + d.toUTCString() + ';path=/'; } } function showDetailSettings() { document.getElementById('cookie-detail-wrap').toggleClass('visible'); } function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for(let i = 0; i