/* # ----------------------------------------------------------------------------- # ~/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) 2022 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(o){var e,t=log4javascript.getLogger("j1.core.CookieConsent"),n=this,i=!1,a=!!new liteURL(window.location.href).protocol.includes("https");for(var s in t.info("\ninitializing core module: started"),t.info("\nstate: started"),this.props={autoShowDialog:!0,dialogLanguage:"content",dialogLanguages:["en","de"],contentURL:"/assets/data/cookieconsent",postSelectionCallback:"",whitelisted:[],xhrDataElement:"consent-data",dialogContainerID:"consent-modal"},o)this.props[s]=o[s];-1!==this.props.dialogLanguage.indexOf("-")&&(this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]),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=a;var l={set:function(o,e,t,n,i,a){var s=window.btoa(e),l="; expires=Thu, 01 Jan 1970 00:00:00 UTC";if(t>0){var r=new Date;r.setTime(r.getTime()+24*t*60*60*1e3),l="; expires="+r.toUTCString()}document.cookie=a?o+"="+(s||"")+l+"; Path=/; SameSite="+n+"; Secure="+a+";":o+"="+(s||"")+l+"; Path=/; SameSite="+n+";"},get:function(o){for(var e=o+"=",t=document.cookie.split(";"),n=0;n-1;var m=l.get(this.props.cookieName);void 0!==m&&"false"!==m||!this.props.autoShowDialog||e||d(),t.info("\ninitializing core module finished"),t.info("\nstate: finished"),this.showDialog=function(){(e=this.props.whitelisted.indexOf(window.location.pathname)>-1)||d()},this.getSettings=function(o){if(l.get(n.props.cookieName)){var e=JSON.parse(l.get(n.props.cookieName));return void 0===o?e:!!e&&e[o]}}}