Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
3.3 kB
18
Indexable
Never
// PDP SEPHORA
// Sdk Push
var script2 = document.createElement("script");
script2.type = "text/javascript";
script2.src = "https://sdk.teester.com/loader.js";
document.getElementsByTagName("head")[0].appendChild(script2);
var dataLayer = window.dataLayer || [];
var playerKey = "d9f9ae0a-c327-443d-81bf-62de3c734843";
var trackingKey = "3256b72b-4f8a-4418-9ab8-d9ac31705437";
var productId = tc_vars.product_pid;
window.onTeesterReady = window.onTeesterReady || [];
window.onTeesterReady.push(function (SDK) {
SDK.checkVideoAvailability(playerKey, productId, (value) => {
    if(value){
 SDK.getVideos(playerKey, productId, function (videos) {
    var urlOverlay = videos[0].poster.medium;
    var videoId = videos[0].id;
var sectionModal = document.createElement("div")
sectionModal.style.marginTop = "2%"
var divPopUp = document.createElement("div")
divPopUp.style.cursor = "pointer"
divPopUp.style.padding = "5px 24px 10px 24px"
divPopUp.style.marginTop = "20px"
divPopUp.style.borderRadius = "100px"
divPopUp.style.backgroundColor = "#F2F2F2"
divPopUp.style.margin = "0 auto"
divPopUp.addEventListener("click", function (e) {
    SDK.init({
      type: "player-modal",
      args: {
        key: playerKey,
        product: productId,
      },
    });
    
})
sectionModal.appendChild(divPopUp)
var divText = document.createElement("div")
divText.style.display = "inline-block";
divText.style.verticalAlign = "middle";
divText.style.float = "none";
divText.style.position = "relative"
divText.style.left = "5%"
var divTextPopUp = document.createElement("a")
divTextPopUp.style.width = "50%"
divTextPopUp.style.fontSize = "13px"
divTextPopUp.innerHTML = "Testé par nos membres Gold"
divText.appendChild(divTextPopUp)
var Box = document.createElement("div")
Box.setAttribute("id","videoBoxUgv")
Box.style.display= "inline-block";
Box.style.verticalAlign= "middle";
Box.style.float = "none";
Box.style.marginLeft= "10%";
var iconBox = document.createElement("img")
iconBox.style.width = "13px"
iconBox.src = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTggMTQuNUwxNCAxMEw4IDUuNVYxNC41Wk0xMCAwQzQuNDggMCAwIDQuNDggMCAxMEMwIDE1LjUyIDQuNDggMjAgMTAgMjBDMTUuNTIgMjAgMjAgMTUuNTIgMjAgMTBDMjAgNC40OCAxNS41MiAwIDEwIDBaTTEwIDE4QzUuNTkgMTggMiAxNC40MSAyIDEwQzIgNS41OSA1LjU5IDIgMTAgMkMxNC40MSAyIDE4IDUuNTkgMTggMTBDMTggMTQuNDEgMTQuNDEgMTggMTAgMThaIiBmaWxsPSJibGFjayIvPgo8L3N2Zz4K"
var textBox = document.createElement("a")
textBox.style.fontSize = "13px"
textBox.innerHTML = "Voir la vidéo"
textBox.style.textDecoration = "underline"
// Responsive
if ($(window).width() < 800) {
divTextPopUp.style.margin = "0 auto"
divPopUp.style.width = "260px"
Box.style.position = "relative"
Box.style.left = "15%"
sectionModal.style.marginTop = "5%"
document.querySelector("#rating_summary_wrapper").append(sectionModal)
}
else {
divPopUp.style.width = "450px"
document.querySelector("#pdpMain > div.product-top-content > div.product-col-1").append(sectionModal)
}
// Display Hierarchie
divPopUp.appendChild(divText)
Box.appendChild(iconBox)
Box.appendChild(textBox)
divPopUp.appendChild(Box)
SDK.init({
  type: 'tracking',
  args: {
      key: trackingKey,
      product: productId,
      event: 'PRODUCT_PAGE_VIEW'
  }
}); 

})
    }
})
})