1(function () { 2 var STORAGE_KEY = 'hobbiz_cookie_consent'; 3 4 function getStoredConsent() { 5 try { 6 return window.localStorage ? localStorage.getItem(STORAGE_KEY) : null; 7 } catch (e) { 8 return null; 9 } 10 } 11 12 function setStoredConsent(status) { 13 try { 14 if (window.localStorage) { 15 localStorage.setItem(STORAGE_KEY, status); 16 } 17 } catch (e) {} 18 } 19 20 function dispatchConsent(status) { 21 document.dispatchEvent(new CustomEvent('hobbiz:cookieconsent', { detail: { status: status } })); 22 } 23 24 window.HobbizCookieConsent = { 25 status: getStoredConsent, 26 hasAccepted: function () { return getStoredConsent() === 'accepted'; } 27 }; 28 29 function init() { 30 var banner = document.getElementById('hobbizCookieBanner'); 31 if (!banner) { 32 return; 33 } 34 35 var existing = getStoredConsent(); 36 if (existing === 'accepted' || existing === 'declined') { 37 if (existing === 'accepted') { 38 dispatchConsent('accepted'); 39 } 40 return; 41 } 42 43 banner.hidden = false; 44 requestAnimationFrame(function () { 45 banner.classList.add('cookie-banner--visible'); 46 }); 47 48 banner.addEventListener('click', function (event) { 49 var action = event.target.closest('[data-cookie-action]'); 50 if (!action) { 51 return; 52 } 53 var status = action.getAttribute('data-cookie-action') === 'accept' ? 'accepted' : 'declined'; 54 setStoredConsent(status); 55 dispatchConsent(status); 56 banner.classList.remove('cookie-banner--visible'); 57 window.setTimeout(function () { banner.hidden = true; }, 250); 58 }); 59 } 60 61 if (document.readyState === 'loading') { 62 document.addEventListener('DOMContentLoaded', init); 63 } else { 64 init(); 65 } 66})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.