From d71910f497f6cd6dc916f8413f426891048890c4 Mon Sep 17 00:00:00 2001 From: Phil Ricketts <812139+replete@users.noreply.github.com> Date: Tue, 7 May 2024 22:28:35 +0100 Subject: [PATCH] Fix typo. Version bump. --- biscuitman.min.css | 2 +- biscuitman.min.js | 2 +- biscuitman.withcss.min.js | 2 +- index.html | 6 +++--- package.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/biscuitman.min.css b/biscuitman.min.css index ecc4bea..2efebf1 100644 --- a/biscuitman.min.css +++ b/biscuitman.min.css @@ -1 +1 @@ -/*! biscuitman 0.2.0 https://github.com/replete/biscuitman */.biscuitman{--bm-bg:#fff;--bm-text:#444;--bm-mid:#999;--bm-light:#ccc;--bm-lightest:#eee;--bm-accent:#105d89;--bm-accent-complement:#fff;--bm-pad:1.5em;background:var(--bm-bg);box-sizing:border-box;color:var(--bm-text);border:0;width:100%;font-size:16px;position:fixed;bottom:0;left:0;box-shadow:0 -2px 10px #00000029;&:has(dialog[open])>.bm-wrap{display:none}&>.bm-wrap{padding:var(--bm-pad);flex-direction:column;gap:10px;display:flex;@media (width>=770px){&{flex-direction:row}& .bm-front{flex-grow:1}}}& *{box-sizing:border-box;margin:0;padding:0;font-size:16px}& div{line-height:1.2em}& .bm-title{margin:0 0 .75em;font-weight:600;display:block}& .bm-msg{font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}@media (width<=769px){&{margin-bottom:1em}}}& .bm-btns{flex-direction:column;flex-grow:1;width:100%;display:flex;@media (width<=575px){& button:last-of-type{margin-bottom:0}}@media (width>=576px){&{flex-direction:row-reverse;gap:10px}& button{flex-grow:1;margin-bottom:0}}@media (width>=770px){&{justify-content:flex-end;align-items:flex-end;max-width:300px}}}& button{background:var(--bm-bg);border:2px solid var(--bm-accent);color:var(--bm-accent);cursor:pointer;border-radius:3px;margin-bottom:10px;padding:.85em;font-size:13px;line-height:1em;&.primary{background:var(--bm-accent);color:var(--bm-accent-complement)!important}&:hover{opacity:.8}}& dialog{border:0;width:100%;max-width:100%;height:100%;max-height:100%;top:50%;left:50%;transform:translate(-50%,-50%)translate(0,0);@media (width>=576px){&{border-radius:10px;width:90vw;max-width:860px;max-height:80vh;box-shadow:0 0 8px #0000004d}}@media (width>=576px) and (height>=1134px){&{max-height:908px}}& .bm-wrap{padding:var(--bm-pad);flex-direction:column;height:100%;display:flex;& .bm-front{flex:1}& .bm-btns{flex-grow:0;position:relative;@media (width>=576px){&{max-width:none}}&:after{content:"";background:linear-gradient(0deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;width:100%;height:1.5em;position:absolute;top:-1.5em;left:0;@media (width>=575px){&{width:calc(100% - 10px)}}}}}& .bm-cl{color:var(--text-dark);opacity:.6;user-select:none;z-index:2;border:none;outline:none;font-size:24px;line-height:1em;position:absolute;top:0;right:15px;&:hover{opacity:1}}& .bm-title{margin-bottom:0;position:relative;&:after{--height:23px;content:"";margin-bottom:calc(calc(var(--height) - 1px)*-1);height:var(--height);background:linear-gradient(180deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;z-index:1;width:100%;position:absolute;bottom:0;left:0}}& .bm-main{margin-right:-1.5em;padding:15px 0 20px;position:relative;overflow-y:auto;@media (width>=575px){&{margin-right:-1.5em}}}& .bm-msg{margin-bottom:.5em;padding-right:30px}& .bm-info{padding-right:30px;font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}& span{font-size:inherit;margin-bottom:.5em;display:block;&:has(.more)~span{display:none}}& .more{font-size:inherit;color:var(--bm-accent);cursor:pointer;text-decoration:none;display:inline-block;&:before{content:".. ";padding-right:5px;display:inline-block}}}& .bm-s{width:calc(100% - 30px);margin-top:16px;@media (width>=575px){&{max-width:calc(100% - 30px)}}& details{border:1px solid var(--bm-light);border-radius:5px;padding:10px;list-style:none;box-shadow:0 2px 4px #0000001a;&[open] .bm-s-title:after{transform:rotate(180deg)}}& summary{cursor:pointer;flex-direction:column;width:100%;padding-bottom:10px;padding-left:10px;list-style:none;display:flex;position:relative;&>*{display:inline-flex}&::marker,&::-webkit-details-marker{display:none}}& .bm-s-title{flex-grow:1;margin-bottom:10px;padding-top:4px;font-weight:700;&:after{content:"⌃";width:1em;height:1em;margin-top:2px;margin-left:3px;transition:transform .15s ease-in;display:block;transform:rotate(90deg)}}& .bm-s-title-label{font-size:14px;position:absolute;top:50%;right:10px;transform:translateY(-50%)}& .bm-s-msg{margin-right:80px;font-size:14px;line-height:18px}& .bm-tgl{--tgl-height:1.2em;--tgl-width:2.3em;--tgl-gap:2px;--tgl-font-size:20px;height:var(--tgl-height);width:var(--tgl-width);background-color:var(--bm-mid);border-radius:var(--tgl-height);margin-top:-2px;display:block;position:absolute;top:50%;right:20px;transform:translateY(-50%);font-size:var(--tgl-font-size)!important;&:before{content:"";background:var(--bm-accent-complement);height:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));width:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));height:var(--tgl-height);width:var(--tgl-height);left:var(--tgl-gap);transform-origin:50%;border-radius:100%;transition:transform .25s ease-in;display:block;position:absolute;top:50%;left:0;transform:translateY(-50%)scale(.8)}&:has(:checked){background-color:var(--bm-accent);&:before{left:auto;right:var(--tgl-gap);right:0}}&:has([disabled]:checked){opacity:.6}& input{opacity:0}}& .bm-s-main{margin:5px 10px 10px;font-size:13px;line-height:18px}& .bm-s-item{font-size:inherit;background:var(--bm-lightest);color:var(--bm-text);align-content:flex-start;margin-bottom:5px;padding:8px 10px;display:flex;& b{width:30%;max-width:120px}& span{width:100%}& *{font-size:inherit}}}}}html:not(.js-bm-hidden){&:after{content:"";user-select:none;min-height:200px;display:block}}.js-bm-hidden{& .biscuitman>.bm-wrap{display:none}} \ No newline at end of file +/*! biscuitman 0.2.1 https://github.com/replete/biscuitman */.biscuitman{--bm-bg:#fff;--bm-text:#444;--bm-mid:#999;--bm-light:#ccc;--bm-lightest:#eee;--bm-accent:#105d89;--bm-accent-complement:#fff;--bm-pad:1.5em;background:var(--bm-bg);box-sizing:border-box;color:var(--bm-text);border:0;width:100%;font-size:16px;position:fixed;bottom:0;left:0;box-shadow:0 -2px 10px #00000029;&:has(dialog[open])>.bm-wrap{display:none}&>.bm-wrap{padding:var(--bm-pad);flex-direction:column;gap:10px;display:flex;@media (width>=770px){&{flex-direction:row}& .bm-front{flex-grow:1}}}& *{box-sizing:border-box;margin:0;padding:0;font-size:16px}& div{line-height:1.2em}& .bm-title{margin:0 0 .75em;font-weight:600;display:block}& .bm-msg{font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}@media (width<=769px){&{margin-bottom:1em}}}& .bm-btns{flex-direction:column;flex-grow:1;width:100%;display:flex;@media (width<=575px){& button:last-of-type{margin-bottom:0}}@media (width>=576px){&{flex-direction:row-reverse;gap:10px}& button{flex-grow:1;margin-bottom:0}}@media (width>=770px){&{justify-content:flex-end;align-items:flex-end;max-width:300px}}}& button{background:var(--bm-bg);border:2px solid var(--bm-accent);color:var(--bm-accent);cursor:pointer;border-radius:3px;margin-bottom:10px;padding:.85em;font-size:13px;line-height:1em;&.primary{background:var(--bm-accent);color:var(--bm-accent-complement)!important}&:hover{opacity:.8}}& dialog{border:0;width:100%;max-width:100%;height:100%;max-height:100%;top:50%;left:50%;transform:translate(-50%,-50%)translate(0,0);@media (width>=576px){&{border-radius:10px;width:90vw;max-width:860px;max-height:80vh;box-shadow:0 0 8px #0000004d}}@media (width>=576px) and (height>=1134px){&{max-height:908px}}& .bm-wrap{padding:var(--bm-pad);flex-direction:column;height:100%;display:flex;& .bm-front{flex:1}& .bm-btns{flex-grow:0;position:relative;@media (width>=576px){&{max-width:none}}&:after{content:"";background:linear-gradient(0deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;width:100%;height:1.5em;position:absolute;top:-1.5em;left:0;@media (width>=575px){&{width:calc(100% - 10px)}}}}}& .bm-cl{color:var(--text-dark);opacity:.6;user-select:none;z-index:2;border:none;outline:none;font-size:24px;line-height:1em;position:absolute;top:0;right:15px;&:hover{opacity:1}}& .bm-title{margin-bottom:0;position:relative;&:after{--height:23px;content:"";margin-bottom:calc(calc(var(--height) - 1px)*-1);height:var(--height);background:linear-gradient(180deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;z-index:1;width:100%;position:absolute;bottom:0;left:0}}& .bm-main{margin-right:-1.5em;padding:15px 0 20px;position:relative;overflow-y:auto;@media (width>=575px){&{margin-right:-1.5em}}}& .bm-msg{margin-bottom:.5em;padding-right:30px}& .bm-info{padding-right:30px;font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}& span{font-size:inherit;margin-bottom:.5em;display:block;&:has(.more)~span{display:none}}& .more{font-size:inherit;color:var(--bm-accent);cursor:pointer;text-decoration:none;display:inline-block;&:before{content:".. ";padding-right:5px;display:inline-block}}}& .bm-s{width:calc(100% - 30px);margin-top:16px;@media (width>=575px){&{max-width:calc(100% - 30px)}}& details{border:1px solid var(--bm-light);border-radius:5px;padding:10px;list-style:none;box-shadow:0 2px 4px #0000001a;&[open] .bm-s-title:after{transform:rotate(180deg)}}& summary{cursor:pointer;flex-direction:column;width:100%;padding-bottom:10px;padding-left:10px;list-style:none;display:flex;position:relative;&>*{display:inline-flex}&::marker,&::-webkit-details-marker{display:none}}& .bm-s-title{flex-grow:1;margin-bottom:10px;padding-top:4px;font-weight:700;&:after{content:"⌃";width:1em;height:1em;margin-top:2px;margin-left:3px;transition:transform .15s ease-in;display:block;transform:rotate(90deg)}}& .bm-s-title-label{font-size:14px;position:absolute;top:50%;right:10px;transform:translateY(-50%)}& .bm-s-msg{margin-right:80px;font-size:14px;line-height:18px}& .bm-tgl{--tgl-height:1.2em;--tgl-width:2.3em;--tgl-gap:2px;--tgl-font-size:20px;height:var(--tgl-height);width:var(--tgl-width);background-color:var(--bm-mid);border-radius:var(--tgl-height);margin-top:-2px;display:block;position:absolute;top:50%;right:20px;transform:translateY(-50%);font-size:var(--tgl-font-size)!important;&:before{content:"";background:var(--bm-accent-complement);height:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));width:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));height:var(--tgl-height);width:var(--tgl-height);left:var(--tgl-gap);transform-origin:50%;border-radius:100%;transition:transform .25s ease-in;display:block;position:absolute;top:50%;left:0;transform:translateY(-50%)scale(.8)}&:has(:checked){background-color:var(--bm-accent);&:before{left:auto;right:var(--tgl-gap);right:0}}&:has([disabled]:checked){opacity:.6}& input{opacity:0}}& .bm-s-main{margin:5px 10px 10px;font-size:13px;line-height:18px}& .bm-s-item{font-size:inherit;background:var(--bm-lightest);color:var(--bm-text);align-content:flex-start;margin-bottom:5px;padding:8px 10px;display:flex;& b{width:30%;max-width:120px}& span{width:100%}& *{font-size:inherit}}}}}html:not(.js-bm-hidden){&:after{content:"";user-select:none;min-height:200px;display:block}}.js-bm-hidden{& .biscuitman>.bm-wrap{display:none}} \ No newline at end of file diff --git a/biscuitman.min.js b/biscuitman.min.js index 5dd897d..ebd9697 100644 --- a/biscuitman.min.js +++ b/biscuitman.min.js @@ -1 +1 @@ -/*! biscuitman 0.2.0 https://github.com/replete/biscuitman */((e,t)=>{let s;let a="biscuitman",o=e.createElement("div"),n={storageKey:"myconsent",global:"Consent",enableMore:!0,sections:["essential"],title:"Your privacy matters",msg:"We use cookies",settingsLabel:"Settings",rejectLabel:"Reject All",acceptLabel:"Accept All",saveLabel:"Save My Settings",settingsTitle:"My Consent Settings",info:"",moreLabel:"Show more",noCookiesLabel:"No cookies to display",acceptNonEU:!1},i=t.biscuitman?{...n,...t.biscuitman}:n;function l(e){let t=e.target.id.replace(`${a}_`,"");switch(t){case"accept":case"accept2":m(!0);break;case"close":s.close();break;case"settings":r();break;case"save":m();break;case"reject":case"reject2":m(!1)}v("buttonPress",{id:t})}function c(){v("closeModal")}function r(){s.showModal(),v("openModal")}let d=t=>e.documentElement.classList[t?"remove":"add"]("js-bm-hidden");function b(){try{return JSON.parse(localStorage.getItem(i.storageKey))}catch(e){return console.error(`${a} readConsent error:`,e.message),localStorage.removeItem(i.storageKey),{}}}function m(e){let a=void 0===e;t[i.global].consentTime=+new Date,i.sections.forEach(s=>{if("essential"===s)return!1;t[i.global][s]=a?o.querySelector(`[data-s=${s}]`).checked:e,a||(o.querySelector(`[data-s=${s}]`).checked=e)}),localStorage.setItem(i.storageKey,JSON.stringify(t[i.global])),u(),v("saveConsent",{data:t[i.global]}),s.close(),d(!1)}function v(t,s){let o=`${a}:${t}`,n={...void 0!==s&&s,time:+new Date};e.dispatchEvent(new CustomEvent(o,n)),console.debug(o,n)}function u(){e.querySelectorAll("script[data-consent]").forEach(s=>{if(!t[i.global][s.dataset.consent])return!1;let a=e.createElement("script");for(let{name:e,value:t}of s.attributes)e.startsWith("data-")||"type"===e||a.setAttribute(e,t);a.setAttribute("type",s.dataset.type||"text/javascript"),s.src||(a.textContent=s.textContent),s.parentNode.replaceChild(a,s),v("scriptInjected",{data:s.outerHTML}),s.src&&""!==s.textContent.trim()&&a.addEventListener("load",()=>{let t=e.createElement("script");t.textContent=s.textContent,a.insertAdjacentElement("afterend",t),v("scriptLoaded",{data:t.outerHTML})})})}t[i.global]=b()||{},t[i.global].consentTime&&(d(!1),u());let p=Intl.DateTimeFormat().resolvedOptions().timeZone,$=/^(GMT|UTC)$/.test(p)||/(Europe|BST|CEST|CET|EET|IST|WEST|WET|GMT-1|GMT-2|UTC+1|UTC+2|UTC+3)/.test(p);i.acceptNonEU&&!$&&(m(!0),d(!1)),function(){let n;o.id=a,o.classList.add(a),o.innerHTML=`
${i.title}
${i.msg}
${i.settingsTitle}
${i.msg}
${i.info.split("\n").map((e,t,s)=>{let a=s.length>1&&i.enableMore&&0==t?`${i.moreLabel}`:"";return`${e}${a}`}).join("")}
${n="",i.sections.forEach(e=>{let s=t[i.global][e],o="essential"===e,l=o?"checked":"";void 0!==s&&(l=s?"checked":"");let c=i[`${e}Title`],r=i[`${e}Message`],d=i[`${e}Cookies`],b=d?Object.entries(d).map(([e,t])=>`
${e}${t}
`).join(""):`
${i.noCookiesLabel}
`;n+=`
${c}
${r}
${b}
`}),n}
`.trim(),o.querySelectorAll("button").forEach(e=>e.addEventListener("click",l)),(s=o.querySelector("dialog")).addEventListener("close",c);let r=o.querySelector(".more");r&&r.addEventListener("click",r.remove),e.body.appendChild(o)}(),t.bmInvalidateConsent=()=>{m(!1),localStorage.removeItem(i.storageKey),d(!0),v("invalidateConsent",b())},t.bmUpdateConsent=()=>{r(),v("updateConsent",b())}})(document,window); \ No newline at end of file +/*! biscuitman 0.2.1 https://github.com/replete/biscuitman */((e,t)=>{let s;let a="biscuitman",o=e.createElement("div"),n={storageKey:"myconsent",global:"Consent",enableMore:!0,sections:["essential"],title:"Your privacy matters",msg:"We use cookies",settingsLabel:"Settings",rejectLabel:"Reject All",acceptLabel:"Accept All",saveLabel:"Save My Settings",settingsTitle:"My Consent Settings",info:"",moreLabel:"Show more",noCookiesLabel:"No cookies to display",acceptNonEU:!1},i=t.biscuitman?{...n,...t.biscuitman}:n;function l(e){let t=e.target.id.replace(`${a}_`,"");switch(t){case"accept":case"accept2":m(!0);break;case"close":s.close();break;case"settings":r();break;case"save":m();break;case"reject":case"reject2":m(!1)}v("buttonPress",{id:t})}function c(){v("closeModal")}function r(){s.showModal(),v("openModal")}let d=t=>e.documentElement.classList[t?"remove":"add"]("js-bm-hidden");function b(){try{return JSON.parse(localStorage.getItem(i.storageKey))}catch(e){return console.error(`${a} readConsent error:`,e.message),localStorage.removeItem(i.storageKey),{}}}function m(e){let a=void 0===e;t[i.global].consentTime=+new Date,i.sections.forEach(s=>{if("essential"===s)return!1;t[i.global][s]=a?o.querySelector(`[data-s=${s}]`).checked:e,a||(o.querySelector(`[data-s=${s}]`).checked=e)}),localStorage.setItem(i.storageKey,JSON.stringify(t[i.global])),u(),v("saveConsent",{data:t[i.global]}),s.close(),d(!1)}function v(t,s){let o=`${a}:${t}`,n={...void 0!==s&&s,time:+new Date};e.dispatchEvent(new CustomEvent(o,n)),console.debug(o,n)}function u(){e.querySelectorAll("script[data-consent]").forEach(s=>{if(!t[i.global][s.dataset.consent])return!1;let a=e.createElement("script");for(let{name:e,value:t}of s.attributes)e.startsWith("data-")||"type"===e||a.setAttribute(e,t);a.setAttribute("type",s.dataset.type||"text/javascript"),s.src||(a.textContent=s.textContent),s.parentNode.replaceChild(a,s),v("scriptInjected",{data:s.outerHTML}),s.src&&""!==s.textContent.trim()&&a.addEventListener("load",()=>{let t=e.createElement("script");t.textContent=s.textContent,a.insertAdjacentElement("afterend",t),v("scriptLoaded",{data:t.outerHTML})})})}t[i.global]=b()||{},t[i.global].consentTime&&(d(!1),u());let p=Intl.DateTimeFormat().resolvedOptions().timeZone,$=/^(GMT|UTC)$/.test(p)||/(Europe|BST|CEST|CET|EET|IST|WEST|WET|GMT-1|GMT-2|UTC+1|UTC+2|UTC+3)/.test(p);i.acceptNonEU&&!$&&(m(!0),d(!1)),function(){let n;o.id=a,o.classList.add(a),o.innerHTML=`
${i.title}
${i.msg}
${i.settingsTitle}
${i.msg}
${i.info.split("\n").map((e,t,s)=>{let a=s.length>1&&i.enableMore&&0==t?`${i.moreLabel}`:"";return`${e}${a}`}).join("")}
${n="",i.sections.forEach(e=>{let s=t[i.global][e],o="essential"===e,l=o?"checked":"";void 0!==s&&(l=s?"checked":"");let c=i[`${e}Title`],r=i[`${e}Message`],d=i[`${e}Cookies`],b=d?Object.entries(d).map(([e,t])=>`
${e}${t}
`).join(""):`
${i.noCookiesLabel}
`;n+=`
${c}
${r}
${b}
`}),n}
`.trim(),o.querySelectorAll("button").forEach(e=>e.addEventListener("click",l)),(s=o.querySelector("dialog")).addEventListener("close",c);let r=o.querySelector(".more");r&&r.addEventListener("click",r.remove),e.body.appendChild(o)}(),t.bmInvalidateConsent=()=>{m(!1),localStorage.removeItem(i.storageKey),d(!0),v("invalidateConsent",b())},t.bmUpdateConsent=()=>{r(),v("updateConsent",b())}})(document,window); \ No newline at end of file diff --git a/biscuitman.withcss.min.js b/biscuitman.withcss.min.js index 96b3d7b..d6f28c5 100644 --- a/biscuitman.withcss.min.js +++ b/biscuitman.withcss.min.js @@ -1 +1 @@ -/*! biscuitman 0.2.0 https://github.com/replete/biscuitman */((e,t)=>{let s;let a="biscuitman",o=e.createElement("div"),n={storageKey:"myconsent",global:"Consent",enableMore:!0,sections:["essential"],title:"Your privacy matters",msg:"We use cookies",settingsLabel:"Settings",rejectLabel:"Reject All",acceptLabel:"Accept All",saveLabel:"Save My Settings",settingsTitle:"My Consent Settings",info:"",moreLabel:"Show more",noCookiesLabel:"No cookies to display",acceptNonEU:!1},i=t.biscuitman?{...n,...t.biscuitman}:n;function l(e){let t=e.target.id.replace(`${a}_`,"");switch(t){case"accept":case"accept2":m(!0);break;case"close":s.close();break;case"settings":r();break;case"save":m();break;case"reject":case"reject2":m(!1)}v("buttonPress",{id:t})}function c(){v("closeModal")}function r(){s.showModal(),v("openModal")}let d=t=>e.documentElement.classList[t?"remove":"add"]("js-bm-hidden");function b(){try{return JSON.parse(localStorage.getItem(i.storageKey))}catch(e){return console.error(`${a} readConsent error:`,e.message),localStorage.removeItem(i.storageKey),{}}}function m(e){let a=void 0===e;t[i.global].consentTime=+new Date,i.sections.forEach(s=>{if("essential"===s)return!1;t[i.global][s]=a?o.querySelector(`[data-s=${s}]`).checked:e,a||(o.querySelector(`[data-s=${s}]`).checked=e)}),localStorage.setItem(i.storageKey,JSON.stringify(t[i.global])),u(),v("saveConsent",{data:t[i.global]}),s.close(),d(!1)}function v(t,s){let o=`${a}:${t}`,n={...void 0!==s&&s,time:+new Date};e.dispatchEvent(new CustomEvent(o,n)),console.debug(o,n)}function u(){e.querySelectorAll("script[data-consent]").forEach(s=>{if(!t[i.global][s.dataset.consent])return!1;let a=e.createElement("script");for(let{name:e,value:t}of s.attributes)e.startsWith("data-")||"type"===e||a.setAttribute(e,t);a.setAttribute("type",s.dataset.type||"text/javascript"),s.src||(a.textContent=s.textContent),s.parentNode.replaceChild(a,s),v("scriptInjected",{data:s.outerHTML}),s.src&&""!==s.textContent.trim()&&a.addEventListener("load",()=>{let t=e.createElement("script");t.textContent=s.textContent,a.insertAdjacentElement("afterend",t),v("scriptLoaded",{data:t.outerHTML})})})}t[i.global]=b()||{},t[i.global].consentTime&&(d(!1),u());let p=Intl.DateTimeFormat().resolvedOptions().timeZone,$=/^(GMT|UTC)$/.test(p)||/(Europe|BST|CEST|CET|EET|IST|WEST|WET|GMT-1|GMT-2|UTC+1|UTC+2|UTC+3)/.test(p);i.acceptNonEU&&!$&&(m(!0),d(!1)),function(){let n;o.id=a,o.classList.add(a),o.innerHTML=`
${i.title}
${i.msg}
${i.settingsTitle}
${i.msg}
${i.info.split("\n").map((e,t,s)=>{let a=s.length>1&&i.enableMore&&0==t?`${i.moreLabel}`:"";return`${e}${a}`}).join("")}
${n="",i.sections.forEach(e=>{let s=t[i.global][e],o="essential"===e,l=o?"checked":"";void 0!==s&&(l=s?"checked":"");let c=i[`${e}Title`],r=i[`${e}Message`],d=i[`${e}Cookies`],b=d?Object.entries(d).map(([e,t])=>`
${e}${t}
`).join(""):`
${i.noCookiesLabel}
`;n+=`
${c}
${r}
${b}
`}),n}
`.trim(),o.querySelectorAll("button").forEach(e=>e.addEventListener("click",l)),(s=o.querySelector("dialog")).addEventListener("close",c);let r=o.querySelector(".more");r&&r.addEventListener("click",r.remove),e.body.appendChild(o)}(),t.bmInvalidateConsent=()=>{m(!1),localStorage.removeItem(i.storageKey),d(!0),v("invalidateConsent",b())},t.bmUpdateConsent=()=>{r(),v("updateConsent",b())}})(document,window);;((d)=>{let c=d.createElement('style');c.textContent=`.biscuitman{--bm-bg:#fff;--bm-text:#444;--bm-mid:#999;--bm-light:#ccc;--bm-lightest:#eee;--bm-accent:#105d89;--bm-accent-complement:#fff;--bm-pad:1.5em;background:var(--bm-bg);box-sizing:border-box;color:var(--bm-text);border:0;width:100%;font-size:16px;position:fixed;bottom:0;left:0;box-shadow:0 -2px 10px #00000029;&:has(dialog[open])>.bm-wrap{display:none}&>.bm-wrap{padding:var(--bm-pad);flex-direction:column;gap:10px;display:flex;@media (width>=770px){&{flex-direction:row}& .bm-front{flex-grow:1}}}& *{box-sizing:border-box;margin:0;padding:0;font-size:16px}& div{line-height:1.2em}& .bm-title{margin:0 0 .75em;font-weight:600;display:block}& .bm-msg{font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}@media (width<=769px){&{margin-bottom:1em}}}& .bm-btns{flex-direction:column;flex-grow:1;width:100%;display:flex;@media (width<=575px){& button:last-of-type{margin-bottom:0}}@media (width>=576px){&{flex-direction:row-reverse;gap:10px}& button{flex-grow:1;margin-bottom:0}}@media (width>=770px){&{justify-content:flex-end;align-items:flex-end;max-width:300px}}}& button{background:var(--bm-bg);border:2px solid var(--bm-accent);color:var(--bm-accent);cursor:pointer;border-radius:3px;margin-bottom:10px;padding:.85em;font-size:13px;line-height:1em;&.primary{background:var(--bm-accent);color:var(--bm-accent-complement)!important}&:hover{opacity:.8}}& dialog{border:0;width:100%;max-width:100%;height:100%;max-height:100%;top:50%;left:50%;transform:translate(-50%,-50%)translate(0,0);@media (width>=576px){&{border-radius:10px;width:90vw;max-width:860px;max-height:80vh;box-shadow:0 0 8px #0000004d}}@media (width>=576px) and (height>=1134px){&{max-height:908px}}& .bm-wrap{padding:var(--bm-pad);flex-direction:column;height:100%;display:flex;& .bm-front{flex:1}& .bm-btns{flex-grow:0;position:relative;@media (width>=576px){&{max-width:none}}&:after{content:"";background:linear-gradient(0deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;width:100%;height:1.5em;position:absolute;top:-1.5em;left:0;@media (width>=575px){&{width:calc(100% - 10px)}}}}}& .bm-cl{color:var(--text-dark);opacity:.6;user-select:none;z-index:2;border:none;outline:none;font-size:24px;line-height:1em;position:absolute;top:0;right:15px;&:hover{opacity:1}}& .bm-title{margin-bottom:0;position:relative;&:after{--height:23px;content:"";margin-bottom:calc(calc(var(--height) - 1px)*-1);height:var(--height);background:linear-gradient(180deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;z-index:1;width:100%;position:absolute;bottom:0;left:0}}& .bm-main{margin-right:-1.5em;padding:15px 0 20px;position:relative;overflow-y:auto;@media (width>=575px){&{margin-right:-1.5em}}}& .bm-msg{margin-bottom:.5em;padding-right:30px}& .bm-info{padding-right:30px;font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}& span{font-size:inherit;margin-bottom:.5em;display:block;&:has(.more)~span{display:none}}& .more{font-size:inherit;color:var(--bm-accent);cursor:pointer;text-decoration:none;display:inline-block;&:before{content:".. ";padding-right:5px;display:inline-block}}}& .bm-s{width:calc(100% - 30px);margin-top:16px;@media (width>=575px){&{max-width:calc(100% - 30px)}}& details{border:1px solid var(--bm-light);border-radius:5px;padding:10px;list-style:none;box-shadow:0 2px 4px #0000001a;&[open] .bm-s-title:after{transform:rotate(180deg)}}& summary{cursor:pointer;flex-direction:column;width:100%;padding-bottom:10px;padding-left:10px;list-style:none;display:flex;position:relative;&>*{display:inline-flex}&::marker,&::-webkit-details-marker{display:none}}& .bm-s-title{flex-grow:1;margin-bottom:10px;padding-top:4px;font-weight:700;&:after{content:"⌃";width:1em;height:1em;margin-top:2px;margin-left:3px;transition:transform .15s ease-in;display:block;transform:rotate(90deg)}}& .bm-s-title-label{font-size:14px;position:absolute;top:50%;right:10px;transform:translateY(-50%)}& .bm-s-msg{margin-right:80px;font-size:14px;line-height:18px}& .bm-tgl{--tgl-height:1.2em;--tgl-width:2.3em;--tgl-gap:2px;--tgl-font-size:20px;height:var(--tgl-height);width:var(--tgl-width);background-color:var(--bm-mid);border-radius:var(--tgl-height);margin-top:-2px;display:block;position:absolute;top:50%;right:20px;transform:translateY(-50%);font-size:var(--tgl-font-size)!important;&:before{content:"";background:var(--bm-accent-complement);height:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));width:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));height:var(--tgl-height);width:var(--tgl-height);left:var(--tgl-gap);transform-origin:50%;border-radius:100%;transition:transform .25s ease-in;display:block;position:absolute;top:50%;left:0;transform:translateY(-50%)scale(.8)}&:has(:checked){background-color:var(--bm-accent);&:before{left:auto;right:var(--tgl-gap);right:0}}&:has([disabled]:checked){opacity:.6}& input{opacity:0}}& .bm-s-main{margin:5px 10px 10px;font-size:13px;line-height:18px}& .bm-s-item{font-size:inherit;background:var(--bm-lightest);color:var(--bm-text);align-content:flex-start;margin-bottom:5px;padding:8px 10px;display:flex;& b{width:30%;max-width:120px}& span{width:100%}& *{font-size:inherit}}}}}html:not(.js-bm-hidden){&:after{content:"";user-select:none;min-height:200px;display:block}}.js-bm-hidden{& .biscuitman>.bm-wrap{display:none}}`;d.documentElement.appendChild(c)})(document); \ No newline at end of file +/*! biscuitman 0.2.1 https://github.com/replete/biscuitman */((e,t)=>{let s;let a="biscuitman",o=e.createElement("div"),n={storageKey:"myconsent",global:"Consent",enableMore:!0,sections:["essential"],title:"Your privacy matters",msg:"We use cookies",settingsLabel:"Settings",rejectLabel:"Reject All",acceptLabel:"Accept All",saveLabel:"Save My Settings",settingsTitle:"My Consent Settings",info:"",moreLabel:"Show more",noCookiesLabel:"No cookies to display",acceptNonEU:!1},i=t.biscuitman?{...n,...t.biscuitman}:n;function l(e){let t=e.target.id.replace(`${a}_`,"");switch(t){case"accept":case"accept2":m(!0);break;case"close":s.close();break;case"settings":r();break;case"save":m();break;case"reject":case"reject2":m(!1)}v("buttonPress",{id:t})}function c(){v("closeModal")}function r(){s.showModal(),v("openModal")}let d=t=>e.documentElement.classList[t?"remove":"add"]("js-bm-hidden");function b(){try{return JSON.parse(localStorage.getItem(i.storageKey))}catch(e){return console.error(`${a} readConsent error:`,e.message),localStorage.removeItem(i.storageKey),{}}}function m(e){let a=void 0===e;t[i.global].consentTime=+new Date,i.sections.forEach(s=>{if("essential"===s)return!1;t[i.global][s]=a?o.querySelector(`[data-s=${s}]`).checked:e,a||(o.querySelector(`[data-s=${s}]`).checked=e)}),localStorage.setItem(i.storageKey,JSON.stringify(t[i.global])),u(),v("saveConsent",{data:t[i.global]}),s.close(),d(!1)}function v(t,s){let o=`${a}:${t}`,n={...void 0!==s&&s,time:+new Date};e.dispatchEvent(new CustomEvent(o,n)),console.debug(o,n)}function u(){e.querySelectorAll("script[data-consent]").forEach(s=>{if(!t[i.global][s.dataset.consent])return!1;let a=e.createElement("script");for(let{name:e,value:t}of s.attributes)e.startsWith("data-")||"type"===e||a.setAttribute(e,t);a.setAttribute("type",s.dataset.type||"text/javascript"),s.src||(a.textContent=s.textContent),s.parentNode.replaceChild(a,s),v("scriptInjected",{data:s.outerHTML}),s.src&&""!==s.textContent.trim()&&a.addEventListener("load",()=>{let t=e.createElement("script");t.textContent=s.textContent,a.insertAdjacentElement("afterend",t),v("scriptLoaded",{data:t.outerHTML})})})}t[i.global]=b()||{},t[i.global].consentTime&&(d(!1),u());let p=Intl.DateTimeFormat().resolvedOptions().timeZone,$=/^(GMT|UTC)$/.test(p)||/(Europe|BST|CEST|CET|EET|IST|WEST|WET|GMT-1|GMT-2|UTC+1|UTC+2|UTC+3)/.test(p);i.acceptNonEU&&!$&&(m(!0),d(!1)),function(){let n;o.id=a,o.classList.add(a),o.innerHTML=`
${i.title}
${i.msg}
${i.settingsTitle}
${i.msg}
${i.info.split("\n").map((e,t,s)=>{let a=s.length>1&&i.enableMore&&0==t?`${i.moreLabel}`:"";return`${e}${a}`}).join("")}
${n="",i.sections.forEach(e=>{let s=t[i.global][e],o="essential"===e,l=o?"checked":"";void 0!==s&&(l=s?"checked":"");let c=i[`${e}Title`],r=i[`${e}Message`],d=i[`${e}Cookies`],b=d?Object.entries(d).map(([e,t])=>`
${e}${t}
`).join(""):`
${i.noCookiesLabel}
`;n+=`
${c}
${r}
${b}
`}),n}
`.trim(),o.querySelectorAll("button").forEach(e=>e.addEventListener("click",l)),(s=o.querySelector("dialog")).addEventListener("close",c);let r=o.querySelector(".more");r&&r.addEventListener("click",r.remove),e.body.appendChild(o)}(),t.bmInvalidateConsent=()=>{m(!1),localStorage.removeItem(i.storageKey),d(!0),v("invalidateConsent",b())},t.bmUpdateConsent=()=>{r(),v("updateConsent",b())}})(document,window);;((d)=>{let c=d.createElement('style');c.textContent=`.biscuitman{--bm-bg:#fff;--bm-text:#444;--bm-mid:#999;--bm-light:#ccc;--bm-lightest:#eee;--bm-accent:#105d89;--bm-accent-complement:#fff;--bm-pad:1.5em;background:var(--bm-bg);box-sizing:border-box;color:var(--bm-text);border:0;width:100%;font-size:16px;position:fixed;bottom:0;left:0;box-shadow:0 -2px 10px #00000029;&:has(dialog[open])>.bm-wrap{display:none}&>.bm-wrap{padding:var(--bm-pad);flex-direction:column;gap:10px;display:flex;@media (width>=770px){&{flex-direction:row}& .bm-front{flex-grow:1}}}& *{box-sizing:border-box;margin:0;padding:0;font-size:16px}& div{line-height:1.2em}& .bm-title{margin:0 0 .75em;font-weight:600;display:block}& .bm-msg{font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}@media (width<=769px){&{margin-bottom:1em}}}& .bm-btns{flex-direction:column;flex-grow:1;width:100%;display:flex;@media (width<=575px){& button:last-of-type{margin-bottom:0}}@media (width>=576px){&{flex-direction:row-reverse;gap:10px}& button{flex-grow:1;margin-bottom:0}}@media (width>=770px){&{justify-content:flex-end;align-items:flex-end;max-width:300px}}}& button{background:var(--bm-bg);border:2px solid var(--bm-accent);color:var(--bm-accent);cursor:pointer;border-radius:3px;margin-bottom:10px;padding:.85em;font-size:13px;line-height:1em;&.primary{background:var(--bm-accent);color:var(--bm-accent-complement)!important}&:hover{opacity:.8}}& dialog{border:0;width:100%;max-width:100%;height:100%;max-height:100%;top:50%;left:50%;transform:translate(-50%,-50%)translate(0,0);@media (width>=576px){&{border-radius:10px;width:90vw;max-width:860px;max-height:80vh;box-shadow:0 0 8px #0000004d}}@media (width>=576px) and (height>=1134px){&{max-height:908px}}& .bm-wrap{padding:var(--bm-pad);flex-direction:column;height:100%;display:flex;& .bm-front{flex:1}& .bm-btns{flex-grow:0;position:relative;@media (width>=576px){&{max-width:none}}&:after{content:"";background:linear-gradient(0deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;width:100%;height:1.5em;position:absolute;top:-1.5em;left:0;@media (width>=575px){&{width:calc(100% - 10px)}}}}}& .bm-cl{color:var(--text-dark);opacity:.6;user-select:none;z-index:2;border:none;outline:none;font-size:24px;line-height:1em;position:absolute;top:0;right:15px;&:hover{opacity:1}}& .bm-title{margin-bottom:0;position:relative;&:after{--height:23px;content:"";margin-bottom:calc(calc(var(--height) - 1px)*-1);height:var(--height);background:linear-gradient(180deg,var(--bm-bg)20%,transparent);user-select:none;pointer-events:none;z-index:1;width:100%;position:absolute;bottom:0;left:0}}& .bm-main{margin-right:-1.5em;padding:15px 0 20px;position:relative;overflow-y:auto;@media (width>=575px){&{margin-right:-1.5em}}}& .bm-msg{margin-bottom:.5em;padding-right:30px}& .bm-info{padding-right:30px;font-size:13px;line-height:18px;@media (width>=770px){&{font-size:14px}}& span{font-size:inherit;margin-bottom:.5em;display:block;&:has(.more)~span{display:none}}& .more{font-size:inherit;color:var(--bm-accent);cursor:pointer;text-decoration:none;display:inline-block;&:before{content:".. ";padding-right:5px;display:inline-block}}}& .bm-s{width:calc(100% - 30px);margin-top:16px;@media (width>=575px){&{max-width:calc(100% - 30px)}}& details{border:1px solid var(--bm-light);border-radius:5px;padding:10px;list-style:none;box-shadow:0 2px 4px #0000001a;&[open] .bm-s-title:after{transform:rotate(180deg)}}& summary{cursor:pointer;flex-direction:column;width:100%;padding-bottom:10px;padding-left:10px;list-style:none;display:flex;position:relative;&>*{display:inline-flex}&::marker,&::-webkit-details-marker{display:none}}& .bm-s-title{flex-grow:1;margin-bottom:10px;padding-top:4px;font-weight:700;&:after{content:"⌃";width:1em;height:1em;margin-top:2px;margin-left:3px;transition:transform .15s ease-in;display:block;transform:rotate(90deg)}}& .bm-s-title-label{font-size:14px;position:absolute;top:50%;right:10px;transform:translateY(-50%)}& .bm-s-msg{margin-right:80px;font-size:14px;line-height:18px}& .bm-tgl{--tgl-height:1.2em;--tgl-width:2.3em;--tgl-gap:2px;--tgl-font-size:20px;height:var(--tgl-height);width:var(--tgl-width);background-color:var(--bm-mid);border-radius:var(--tgl-height);margin-top:-2px;display:block;position:absolute;top:50%;right:20px;transform:translateY(-50%);font-size:var(--tgl-font-size)!important;&:before{content:"";background:var(--bm-accent-complement);height:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));width:calc(var(--tgl-height) - calc(var(--tgl-gap)*2));height:var(--tgl-height);width:var(--tgl-height);left:var(--tgl-gap);transform-origin:50%;border-radius:100%;transition:transform .25s ease-in;display:block;position:absolute;top:50%;left:0;transform:translateY(-50%)scale(.8)}&:has(:checked){background-color:var(--bm-accent);&:before{left:auto;right:var(--tgl-gap);right:0}}&:has([disabled]:checked){opacity:.6}& input{opacity:0}}& .bm-s-main{margin:5px 10px 10px;font-size:13px;line-height:18px}& .bm-s-item{font-size:inherit;background:var(--bm-lightest);color:var(--bm-text);align-content:flex-start;margin-bottom:5px;padding:8px 10px;display:flex;& b{width:30%;max-width:120px}& span{width:100%}& *{font-size:inherit}}}}}html:not(.js-bm-hidden){&:after{content:"";user-select:none;min-height:200px;display:block}}.js-bm-hidden{& .biscuitman>.bm-wrap{display:none}}`;d.documentElement.appendChild(c)})(document); \ No newline at end of file diff --git a/index.html b/index.html index 1d84905..0839bfc 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - Biscuitman.js development test + Biscuitman.js demo @@ -46,7 +46,7 @@ While you have the option to enable or disable some or all of these cookies, note that disabling certain ones may impact your browsing experience.`, sections: ['essential','functional','analytics','performance','advertisement','uncategorized'], essentialTitle: 'Essential', - essentialMessage: 'Essential cookies are reuired for basic site functionality', + essentialMessage: 'Essential cookies are required for basic site functionality', functionalTitle: 'Functional', functionalMessage: 'Functional cookies allow us to perform specific tasks such as sharing website content on social media platforms, gathering feedback, and enabling other third-party features', analyticsTitle: 'Analytics', @@ -124,7 +124,7 @@
-

🍪 biscuitman.js

+

🍪 biscuitman.js

Lightweight Consent Manager (4kB br)

diff --git a/package.json b/package.json index 1001dc4..8e5f280 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "biscuitman", - "version": "0.2.0", + "version": "0.2.1", "description": "Lightweight client-side cookie consent manager with dependency hooks and script injection", "browser": "biscuitman.js", "keywords": ["privacy", "cookie", "cookies", "trackers" ,"cookie-consent", "gdpr", "consents", "consent-manager"],