change the way checking if onetrust is available

This commit is contained in:
Anthony 2021-12-14 20:40:27 +01:00 committed by Thomas Zarebczan
parent d675d3234c
commit dfaa848ab7
2 changed files with 20 additions and 3 deletions

View file

@ -70,3 +70,7 @@
#ot-sdk-btn-floating {
display: none;
}
.gdprPrivacyFooter {
display: none;
}

View file

@ -4,10 +4,23 @@ import { SIMPLE_SITE } from 'config';
export default function Footer() {
useEffect(() => {
const maxTimeout = 2000;
let elapsedTime = 0;
function checkForOneTrust() {
elapsedTime = elapsedTime + 500;
if (elapsedTime > maxTimeout) return;
if (!window.Optanon) {
window.setTimeout(checkForOneTrust, 500);
} else {
const privacyFooterButton = document.getElementById('gdprPrivacyFooter');
if (privacyFooterButton) privacyFooterButton.style.display = 'none';
if (privacyFooterButton) privacyFooterButton.style.display = 'block';
}
}
checkForOneTrust();
}, []);
if (!SIMPLE_SITE) {