/* # ----------------------------------------------------------------------------- # ~/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js # Provides JS Core for J1 Module BS Cookie Consent # # Product/Info: # https://shaack.com # http://jekyll.one # # Copyright (C) 2020 Stefan Haack # Copyright (C) 2021 Juergen Adams # # bootstrap-cookie-banner is licensed under MIT License. # See: https://github.com/shaack/bootstrap-cookie-banner/blob/master/LICENSE # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- # TODO: # # ----------------------------------------------------------------------------- # NOTE: # BS Cookie Consent is a MODIFIED version of bootstrap-cookie-banner # for the use with J1 Template. This modified version cannot be used # outside of J1 Template! # ----------------------------------------------------------------------------- */ "use strict";function CookieConsent(d){var v=log4javascript.getLogger("j1.core.CookieConsent");var p=this;var q=false;var e=new liteURL(window.location.href);var c=(e.protocol.includes("https"))?true:false;var j;var g;var t;v.info("\ninitializing core module: started");v.info("\nstate: started");this.props={autoShowDialog:true,dialogLanguage:"content",dialogLanguages:["en","de"],contentURL:"/assets/data/cookieconsent",postSelectionCallback:"",whitelisted:[],xhrDataElement:"consent-data",dialogContainerID:"consent-modal"};for(var f in d){this.props[f]=d[f]}if(this.props.dialogLanguage.indexOf("-")!==-1){this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]}if(!this.props.dialogLanguages.includes(this.props.dialogLanguage)){this.props.dialogLanguage=this.props.dialogLanguages[0]}this.props.xhrDataElement=this.props.xhrDataElement+"-"+this.props.dialogLanguage;this.props.cookieSecure=c;var h={set:function(w,C,E,z,D,A){var B=window.btoa(C);var x="; expires=Thu, 01 Jan 1970 00:00:00 UTC";if(E>0){var y=new Date();y.setTime(y.getTime()+(E*24*60*60*1000));x="; expires="+y.toUTCString()}if(A){document.cookie=w+"="+(B||"")+x+"; Path=/; SameSite="+z+"; Secure="+A+";"}else{document.cookie=w+"="+(B||"")+x+"; Path=/; SameSite="+z+";"}},get:function(x){var A=x+"=";var w=document.cookie.split(";");for(var y=0;y-1);var r=h.get(this.props.cookieName);if((r===undefined||r==="false")&&this.props.autoShowDialog&&!t){m()}v.info("\ninitializing core module finished");v.info("\nstate: finished");this.showDialog=function(){t=(this.props.whitelisted.indexOf(window.location.pathname)>-1);if(!t){m()}};this.getSettings=function(x){var w=h.get(p.props.cookieName);if(w){var y=JSON.parse(h.get(p.props.cookieName));if(x===undefined){return y}else{if(y){return y[x]}else{return false}}}else{return undefined}}};