diff --git a/company_site/public/static/public/js/tianji-consent.js b/company_site/public/static/public/js/tianji-consent.js index 067e4f5..ec708c6 100644 --- a/company_site/public/static/public/js/tianji-consent.js +++ b/company_site/public/static/public/js/tianji-consent.js @@ -28,17 +28,17 @@ } } - function hideBanner() { - var banner = document.getElementById('cookie-consent-banner'); - if (banner) { - banner.hidden = true; - } - } - function showBanner() { var banner = document.getElementById('cookie-consent-banner'); if (banner) { - banner.hidden = false; + banner.removeAttribute('hidden'); + } + } + + function hideBanner() { + var banner = document.getElementById('cookie-consent-banner'); + if (banner) { + banner.setAttribute('hidden', ''); } } @@ -140,7 +140,7 @@ }); }; - document.addEventListener('DOMContentLoaded', function () { + function initConsent() { bindBannerControls(); var consent = getConsent(); @@ -155,5 +155,7 @@ } showBanner(); - }); + } + + initConsent(); })();