(function (window) { function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } let cookie = getCookie('obfx-policy-consent'); if(cookie !== 'accepted'){ document.getElementById('obfx-cookie-bar').style.display = 'block'; } document.getElementById('obfx-accept-cookie-policy').addEventListener('click', function (e) { e.preventDefault(); var days = 365; var date = new Date(); // @TODO add an option to select expiry days date.setTime(date.getTime() + 24 * days * 60 * 60 * 1e3); // save the cookie document.cookie = 'obfx-policy-consent=accepted; expires=' + date.toGMTString() + '; path=/'; // after we get the acceptance cookie we can close the box document.getElementById('obfx-checkbox-cb').checked = true; }, false); })(window);