Skip to content

Commit

Permalink
Merge pull request #22 from tagconcierge/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
mfrankiewicz authored Jun 18, 2024
2 parents 09ec482 + b122d90 commit 76756f7
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 184 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.2.3

- fixed consent settings modal closing issue
- improved consent settings opener event listener

## 1.2.2

- fixed appearance issues on mobile devices

## 1.2.1

- changed the element on which the 'consent-banner.ready' event is called from document.body to window
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

First, include simple CSS for the banner in the `<head>` of the page:
```html
<link rel="stylesheet" href="https://public-assets.tagconcierge.com/consent-banner/1.2.1/styles/light.css" />
<link rel="stylesheet" href="https://public-assets.tagconcierge.com/consent-banner/1.2.3/styles/light.css" />
```

Then in the footer you can include the actual JS:

```html
<script src="https://public-assets.tagconcierge.com/consent-banner/1.2.1/cb.min.js" integrity="sha384-s3Z3P3jRWfGRi77peX7uOoW8f5AbSZ862qubQFqICB7mJ/mGtr1iGt/w986DleFP" crossorigin="anonymous"></script>
<script src="https://public-assets.tagconcierge.com/consent-banner/1.2.3/cb.min.js" integrity="sha384-zXUdInIfEJI2FEImKEFc2cmja+Jn7TViSXzqt6OhABX0jMgz6Mctrc864uJaN5PX" crossorigin="anonymous"></script>
<script>
cookiesBannerJs(
loadConsentState,
Expand All @@ -33,7 +33,7 @@ Then in the footer you can include the actual JS:

Or if you want to load the library script asynchronously, you can use the following `consent-banner.ready` event listener, which will execute the function only when the library is loaded:
```html
<script defer src="https://public-assets.tagconcierge.com/consent-banner/1.2.1/cb.min.js" integrity="sha384-s3Z3P3jRWfGRi77peX7uOoW8f5AbSZ862qubQFqICB7mJ/mGtr1iGt/w986DleFP" crossorigin="anonymous"></script>
<script defer src="https://public-assets.tagconcierge.com/consent-banner/1.2.3/cb.min.js" integrity="sha384-zXUdInIfEJI2FEImKEFc2cmja+Jn7TViSXzqt6OhABX0jMgz6Mctrc864uJaN5PX" crossorigin="anonymous"></script>
<script>
window.addEventListener('consent-banner.ready', () => {
cookiesBannerJs(
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tagconcierge/consent-banner",
"version": "1.2.1",
"version": "1.2.3",
"description": "A zero-dependency, lightweight (~3kB), consent platform agnostic, cookie banner for any website.",
"main": "src/app.js",
"keywords": ["consent banner", "consent mode", "gtm consent", "cookie banner"],
Expand Down
8 changes: 5 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function showSettings(main) {
function hideSettings(main) {
main.style.display = 'block';
main.querySelector('#consent-banner-settings').style.display = 'none';
if ('true' !== main.getAttribute('data-wall')) {
if ('true' !== main.getAttribute('data-wall') || isConsentStateProvided(loadConsentState())) {
hideWall(main);
}
}
Expand Down Expand Up @@ -283,8 +283,10 @@ function consentBannerJsMain(config) {
addEventListener(settings.querySelector('[href="#close"]'), 'click', function(ev) {
ev.preventDefault();
hideSettings(main);
if (!isConsentStateProvided(existingConsentState)) {
if (!isConsentStateProvided(loadConsentState())) {
showModal(main);
} else {
dispatchBodyEvent('hidden');
}
});

Expand Down Expand Up @@ -340,7 +342,7 @@ function consentBannerJsMain(config) {
dispatchBodyEvent('hidden');
});

addEventListener(body.querySelector('[href$="#consent-banner-settings"]'), 'click', function(ev) {
addEventListener(body.querySelectorAll('[href$="#consent-banner-settings"]'), 'click', function(ev) {
ev.preventDefault();
showSettings(main);
hideModal(main);
Expand Down
Loading

0 comments on commit 76756f7

Please sign in to comment.