From 06081868904640fbe752527271e38b9c446468aa Mon Sep 17 00:00:00 2001 From: bosco-ensemble Date: Mon, 8 Apr 2024 18:00:54 -0700 Subject: [PATCH] TDW-2277 minor format change --- scripts/scripts.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/scripts/scripts.js b/scripts/scripts.js index 5bf99be3..0d2eda66 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -1158,6 +1158,20 @@ export async function sendAnalyticsPageEvent() { }); } +/* setup cookie preferences */ +function getCookie(cookieName) { + const name = `${cookieName}=`; + const decodedCookie = decodeURIComponent(document.cookie); + const split = decodedCookie.split(';'); + // eslint-disable-next-line no-plusplus + for (let i = 0; i < split.length; i++) { + let c = split[i]; + while (c.charAt(0) === ' ') c = c.substring(1); + if (c.indexOf(name) === 0) return c.substring(name.length, c.length); + } + return null; +} + async function OptanonWrapper() { const geoInfo = window.Optanon.getGeolocationData(); Object.keys(geoInfo).forEach((key) => { @@ -1181,20 +1195,6 @@ async function OptanonWrapper() { await sendAnalyticsPageEvent(); } -/* setup cookie preferences */ -function getCookie(cookieName) { - const name = `${cookieName}=`; - const decodedCookie = decodeURIComponent(document.cookie); - const split = decodedCookie.split(';'); - // eslint-disable-next-line no-plusplus - for (let i = 0; i < split.length; i++) { - let c = split[i]; - while (c.charAt(0) === ' ') c = c.substring(1); - if (c.indexOf(name) === 0) return c.substring(name.length, c.length); - } - return null; -} - async function loadAds(doc) { const placeholders = await fetchPlaceholders(); const isProd = window.location.hostname.endsWith(placeholders.hostname); @@ -1256,4 +1256,3 @@ try { }, }); } catch (e) { /* ignore */ } -