/* # ----------------------------------------------------------------------------- # ~/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! # ----------------------------------------------------------------------------- */ function BootstrapCookieConsent(c){var t=log4javascript.getLogger("j1.core.bsCookieConsent");var r="bccs-modal";var o=this;var p=false;var d=new liteURL(window.location.href);var m=(d.protocol.includes("https"))?true:false;var h;var f;var s;t.info("\ninitializing core module: started");t.info("\nstate: started");this.props={autoShowDialog:true,language:navigator.language,languages:["en","de"],contentURL:"./content",cookieName:"cookie-consent-settings",cookieStorageDays:365,postSelectionCallback:undefined,whitelisted:[],xhr_data_element:"",sameSite:"Strict",secure:false};for(var e in c){this.props[e]=c[e]}this.language=this.props.language;if(this.language.indexOf("-")!==-1){this.language=this.language.split("-")[0]}if(!this.props.languages.includes(this.language)){this.language=this.props.languages[0]}var g={set:function(w,y,B,x,z){var A=window.btoa(y);var u="";if(B){var v=new Date();v.setTime(v.getTime()+(B*24*60*60*1000));u="; expires="+v.toUTCString()}if(z){document.cookie=w+"="+(A||"")+u+"; Path=/; SameSite="+x+"; secure="+z+";"}else{document.cookie=w+"="+(A||"")+u+"; Path=/; SameSite="+x+";"}},get:function(v){var y=v+"=";var u=document.cookie.split(";");for(var w=0;w-1);if(g.get(this.props.cookieName)===undefined&&this.props.autoShowDialog&&!s){k()}t.info("\ninitializing core module finished");t.info("\nstate: finished");this.showDialog=function(){s=(this.props.whitelisted.indexOf(window.location.pathname)>-1);if(!s){k()}};this.getSettings=function(v){var u=g.get(o.props.cookieName);if(u){var w=JSON.parse(g.get(o.props.cookieName));if(v===undefined){return w}else{if(w){return w[v]}else{return false}}}else{return undefined}}};