Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use a init method instead of the constructor
  • Loading branch information
Debatty-Tom committed Oct 10, 2025
commit 1364f688c31580f4baea47b28f9dea7c6794d145
2 changes: 1 addition & 1 deletion dist/modal.js

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

1 change: 0 additions & 1 deletion resources/js/Cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,5 @@ class LaravelCookieConsent {
/*
Config is set to 1 here, but it is modified by ScriptController depending on the different actions.
*/

window.LaravelCookieConsent = new LaravelCookieConsent({config:1});
window.dispatchEvent(new Event('LARAVEL_COOKIE_CONSENT_SCRIPT_LOAD'));
15 changes: 10 additions & 5 deletions resources/js/Modal.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
window.LaravelCookieModalLoaded = false;

class LaravelCookieModal {
element;

constructor() {
this.element = document.querySelector('#cookies-policy');
if (!window.LaravelCookieConsent || window.LaravelCookieModal) {
init() {
if (!window.LaravelCookieConsent || window.LaravelCookieModalLoaded) {
return;
}

this.element = document.querySelector('#cookies-policy');

if (!this.element) {
return;
}
Expand All @@ -20,10 +23,12 @@ class LaravelCookieModal {
this.element.classList.remove('cookies--pre-init');
this.element.classList.remove('cookies--closing');
}, 60);
}

window.LaravelCookieModalLoaded = true;
};

getValues() {
this.reset = document.querySelector('.cookiereset');
this.reset = document.querySelector('#reset-button');
this.customize = this.element.querySelector('.cookies__btn--customize');
this.details = this.element.querySelectorAll('.cookies__details');
this.acceptAll = this.element.querySelector('.cookiesBtn--accept');
Expand Down