From 663adb225bba5f09afe8c4126e03bddb7f2fe378 Mon Sep 17 00:00:00 2001 From: bosco-ensemble Date: Tue, 9 Apr 2024 10:19:32 -0700 Subject: [PATCH] TDW-2277 call loadAds function in loadPage --- scripts/scripts.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/scripts.js b/scripts/scripts.js index 1af9d56d..5071c509 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -710,6 +710,8 @@ async function loadPage(doc) { // eslint-disable-next-line no-use-before-define await loadLazy(doc); // eslint-disable-next-line no-use-before-define + await loadAds(); + // eslint-disable-next-line no-use-before-define loadDelayed(doc); } @@ -1070,10 +1072,6 @@ async function loadLazy(doc) { doc.querySelectorAll('div:not([class]):not([id]):empty').forEach((empty) => empty.remove()); - window.setTimeout(async () => { - // eslint-disable-next-line no-use-before-define - await loadAds(); - }, 1000); } /** @@ -1231,8 +1229,8 @@ async function loadAds() { window.OptanonWrapper = OptanonWrapper; - if (doc.querySelector('.marketing')) { - const marketingBlock = doc.querySelector('.marketing'); + if (document.querySelector('.marketing')) { + const marketingBlock = document.querySelector('.marketing'); decorateBlock(marketingBlock); await loadBlock(marketingBlock); }