Skip to content

Commit

Permalink
Refactor intastellar partner domain iframe creation and postMessage h…
Browse files Browse the repository at this point in the history
…andling
  • Loading branch information
felixaschultz committed Aug 15, 2024
1 parent 36e02d5 commit d66484a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions dev/cb.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,8 @@ function setIntastellarPartnerDomain() {
intastellarSharingIframe.style.left = "-100%";

console.log("Partner domain: ", window.INTA.settings.partnerDomain);
document.body.appendChild(intastellarSharingIframe);
if (document.getElementById("intastellarCrossSiteCheck") != null) {
const intastellariframe = document.getElementById("intastellarCrossSiteCheck");
window.addEventListener("message", function (event) {
if (event.origin !== "https://consents.cdn.intastellarsolutions.com") return;
if (event.data === "ready") {
intastellariframe.contentWindow.postMessage(intaConsentsObjectVariable, "https://consents.cdn.intastellarsolutions.com");
}
});
}
//document.body.appendChild(intastellarSharingIframe);

}
}
setIntastellarPartnerDomain();
Expand Down Expand Up @@ -771,7 +763,15 @@ window.addEventListener("load", function () {
trImage.src = intastellarCookieBannerRootDomain + "/cookieSharingIframe.html";

document.body.appendChild(trImage);
console.log(trImage);
if (document.querySelector("[name=intastellar-solutions-sharinglibrary-iframe]") != null) {
const intastellariframe = document.querySelector("[name=intastellar-solutions-sharinglibrary-iframe]");
window.addEventListener("message", function (event) {
if (event.origin !== "https://consents.cdn.intastellarsolutions.com") return;
if (event.data === "ready") {
intastellariframe.contentWindow.postMessage(intaConsentsObjectVariable, "https://consents.cdn.intastellarsolutions.com");
}
});
}

gtag('set', {
'user_id': (getCookie(int_hideCookieBannerName)) ? JSON.parse(decodeIntaConsentsObject(getCookie(int_hideCookieBannerName)?.split(".")[2])).uid : intaConsentsObjectVariable.uid
Expand Down

0 comments on commit d66484a

Please sign in to comment.