Skip to content

Commit

Permalink
TDW-2277 minor format change
Browse files Browse the repository at this point in the history
  • Loading branch information
bosco-ensemble committed Apr 9, 2024
1 parent 9da752b commit 0608186
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
Expand Down Expand Up @@ -1256,4 +1256,3 @@ try {
},
});
} catch (e) { /* ignore */ }

0 comments on commit 0608186

Please sign in to comment.