Skip to content

Commit f8eac2a

Browse files
committed
Add browser compatibility tests
- build is now targeted to 2 year old browsers
1 parent dbcc221 commit f8eac2a

File tree

12 files changed

+1599
-107
lines changed

12 files changed

+1599
-107
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#### [View demo](https://replete.github.io/biscuitman)
55

6-
I didn't like sending 100KB+ for a simple cookie consent solution so I wrote this. It's currently **3.3kB/br and 3.8kB/gz**, including CSS. It's designed to be as small as possible with an adequate featureset for basic website cookie consent.
6+
100kB+ seemed too heavy for a cookie popup so I wrote this. It's currently < 4kB gz/btr, including CSS. It's designed to be as small as possible with an adequate featureset for basic website cookie consent.
77

88
- Stores consent in `localStorage`, exposes in `window.Consent` and through custom events fired on `document`
99
- Handles consent granulated by custom sections (e.g. essential, performance, analytics...)
@@ -15,8 +15,13 @@ I didn't like sending 100KB+ for a simple cookie consent solution so I wrote thi
1515
- Injects scripts when granular consent is granted (`<script data-consent="analytics" type="text/plain" src="..."></script>`)
1616
- Injects embedded `<script>` from script tags with `src` properties on onload (tidier markup)
1717
- Mobile-first
18-
- Browser support: >= 2% browserlist (No IE support, but its not impossible)
19-
- Written with latest CSS / JS features and targetted to >= 2% using browserlist
18+
- Browser support (targeted via `browserlist` in `package.json` - `>= 2%, last 2 years`):
19+
- Chrome 105+,
20+
- Edge 105+
21+
- Safari 15.4+
22+
- Firefox 121+
23+
- Samsung browser 20+
24+
- run `npm run build report` and view `index.html` to compatibility table. If you need a version to work in older browsers, update the browserlist version and modify the CSS
2025
- 'show more' functionality for long disclaimer text
2126
- include optional link in any text
2227
- CSS classes on `<html>` element for consents
@@ -158,7 +163,7 @@ The easiest way to see how events work is to view the `console.debug()` calls in
158163
- `biscuitman:close` => `{time: 1718915128298}` modal closed
159164
- `biscuitman:button` => `{id: "settings", time: 1718915128298}` button clicked
160165
- `biscuitman:save` => `{data: {consentTime: 1718914784624, advertisement:true, advertisement: fal..}, time: 1718914784624}` consent choice saved
161-
- `biscuitman:inject` => `{el: $Element, parent?: $Element, time: 1718914784624}` script injected to DOM. if parent exists, it's a new tag inserted after a `src` script loaded which also had text content (a 'dependent' script = tidier convenient markup)
166+
- `biscuitman:inject` => `{el: $Element, parent?: $Element, id?: 'script-id', time: 1718914784624}` script injected to DOM. if parent exists, it's a new tag inserted after a `src` script loaded which also had text content (a 'dependent' script = tidier convenient markup)
162167
- `biscuitman:invalidate` => `{data: {...consentObjectJustDeleted}, time: 1718915128298}` consent invalidated
163168
- `biscuitman:update` => `{data: {...currentConsentObject}, time: 1718914784624}` returns current consent object and time
164169
- `biscuitman:delete` => `{localStorage|cookie: 'cookieName', time: 1718914784624}` fires when consent is rejected or invalidated and cookies/localStorage entries are deleted

cssreport.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

dist/biscuitman.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! biscuitman.js 0.3.9 */
1+
/*! biscuitman.js 0.3.10 */
22
.biscuitman {
33
--t: #444;
44
--b: #fff;
@@ -37,7 +37,7 @@
3737
position: relative;
3838
}
3939

40-
@media (width >= 770px) {
40+
@media (min-width: 770px) {
4141
.biscuitman article {
4242
padding-right: calc(max(300px, 30vw) + 20px);
4343
}
@@ -58,7 +58,7 @@
5858
font-size: 13px;
5959
}
6060

61-
@media (width >= 575px) {
61+
@media (min-width: 575px) {
6262
.biscuitman article p {
6363
font-size: 14px;
6464
}
@@ -106,7 +106,7 @@
106106
opacity: .8;
107107
}
108108

109-
@media (width >= 576px) {
109+
@media (min-width: 576px) {
110110
.biscuitman nav {
111111
flex-direction: row-reverse;
112112
gap: 10px;
@@ -120,7 +120,7 @@
120120
}
121121
}
122122

123-
@media (width <= 575px) {
123+
@media (max-width: 575px) {
124124
.biscuitman nav {
125125
flex-direction: column;
126126
flex-grow: 1;
@@ -136,7 +136,7 @@
136136
max-height: 100%;
137137
}
138138

139-
@media (width >= 576px) {
139+
@media (min-width: 576px) {
140140
.biscuitman dialog {
141141
border-radius: 10px;
142142
width: 90vw;
@@ -147,7 +147,7 @@
147147
}
148148
}
149149

150-
@media (width >= 576px) and (height >= 1134px) {
150+
@media (min-width: 576px) and (min-height: 1134px) {
151151
.biscuitman dialog {
152152
height: 890px;
153153
}
@@ -202,7 +202,7 @@
202202
overflow-y: scroll;
203203
}
204204

205-
@media (width >= 576px) {
205+
@media (min-width: 576px) {
206206
.biscuitman .bm-sections {
207207
margin-right: -18px;
208208
padding-right: 4px;
@@ -220,7 +220,7 @@
220220
display: block;
221221
}
222222

223-
@media (width >= 576px) {
223+
@media (min-width: 576px) {
224224
.biscuitman .bm-sections > p span {
225225
font-size: 14px;
226226
}

dist/biscuitman.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! biscuitman.js 0.3.9 */
1+
/*! biscuitman.js 0.3.10 */
22
((d, w, Object1, h, bm)=>{
33
const defaults = {
44
key: 'myconsent',
@@ -67,7 +67,10 @@
6767
</label>
6868
<p>${o[`${section}Message`]}</p>
6969
</summary>
70-
${cookies ? Object1.entries(cookies).map(([k, v])=>`<dl><dt>${k}</dt><dd>${v}</dd></dl>`).join('') : `<dl><dd>${o.noCookies}</dd></dl>`}
70+
${cookies ? Object1.entries(cookies).map((param)=>{
71+
let [k, v] = param;
72+
return `<dl><dt>${k}</dt><dd>${v}</dd></dl>`;
73+
}).join('') : `<dl><dd>${o.noCookies}</dd></dl>`}
7174
</details>
7275
</section>`;
7376
}).join('')}

dist/biscuitman.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)