$(document).ready(function() { // replace cookie setting window.Cookie = { 'isAllowed': function() { return !!(window.Cookie.get('cookie_allowed') && window.Cookie.get('cookie_allowed').length > 0); }, 'getAllowedDomains': function(level) { var domains = []; if(level && level > 0) { domains = []; domains[1] = []; domains[1].push('internal'); domains[2] = []; domains[2].push('internal'); domains[2].push('script'); domains[3] = []; domains[3].push('internal'); domains[3].push('frame'); domains[4] = []; domains[4].push('internal'); domains[4].push('script'); domains[4].push('frame'); return domains[level]; } else if(window.Cookie.isAllowed()) { domains = window.Cookie.get('cookie_allowed').split("+"); if(domains && domains.length > 0) { for(var n = 0; n < domains.length; n++) { if(domains[n] === "self" || domains[n] === "internal") { domains[n] = window.location.hostname; } } } } return []; }, 'get': function(sKey) { return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; }, 'set': function (sKey, sValue, vEnd, sPath, sDomain, bSecure) { if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } var sExpires = ""; if (vEnd) { switch (vEnd.constructor) { case Number: sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; break; case String: sExpires = "; expires=" + vEnd; break; case Date: sExpires = "; expires=" + vEnd.toUTCString(); break; } } document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); return true; }, 'disable': function() { if(!document.__defineGetter__ && !document.__defineSetter__) { Object.defineProperty(document, 'cookie', { get: function() { return '' }, set: function() { return true } }); } else { document.__defineGetter__("cookie", function() {return ''; }); document.__defineSetter__("cookie", function() { }); } return true; }, 'enable': function(level) { var domains = window.Cookie.getAllowedDomains(level); if(domains && domains.length > 0) { // allow to access external frames and other sources $('script,iframe').each(function() { var $el = $(this); var tmpSrc = $el.attr('data-src'); var tag = $el.prop('tagName'); for(var n = 0; n < domains.length; n++) { var domain = domains[n]; if(tmpSrc && tmpSrc.indexOf(domain) !== -1 || (domain === "script" && tag === "SCRIPT") || (domain === "frame" && tag === "IFRAME")) { // domain of source allowed $el.attr('src', tmpSrc); } } }); } return true; }, 'init': function() { if(!window.Cookie.isAllowed()) { console.log('FYI: Cookies are disabled.'); // display cookie box // display the cookie box var $outerBox = $('
', {'class': 'box-cookie-outer'}); var $box = $('
', {'class': 'box-cookie'}); var $boxIcon = $('
', {'class': 'box-cookie-icon', 'html': ''}); var $title = $('', {'class': 'box-cookie-title', 'text': 'This website uses cookies'}); var $description = $('
', {'class': 'box-cookie-description', 'html': 'We use cookies to personalize the content and to allow a better user experience on the website. We only use website-internal cookies, which are required for the usage of the website. Therefore, we don\'t share any cookie information with any third party.'}); var $buttons = $('
', {'class': 'box-cookie-action'}); var $accept = $('