Untitled
unknown
plain_text
a year ago
6.2 kB
5
Indexable
Never
//MOULINEX SCRIPT var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://sdk.teester.com/loader.js"; document.getElementsByTagName("head")[0].appendChild(script); window.onTeesterReady = window.onTeesterReady || []; window.onTeesterReady.push(function(SDK) { var productSku = tc_vars.product_id; var playerKey = "4b0238e7-a704-4449-80f1-a6bd6919dd9a"; var trackingKey = "ce8997f3-28f5-465f-8d69-6ed1785ddd44"; SDK.checkVideoAvailability(playerKey, productSku, (value) => { SDK.getVideos(playerKey, productSku, function(videos) { const urlOverlay = videos[0].poster.medium; const videoId = videos[0].id; //Function Destroy function doSomething() { console.log('URL change detected!'); } let currentUrl = location.href; setInterval(() => { if (location.href !== currentUrl) { currentUrl = location.href; window.location.reload(true); doSomething(); } }, 500); // Section var section = document.createElement("sd-arguments"); section.setAttribute( "class", "is-default is-spaced is-theme-promo-1 ng-star-inserted" ); section.style.marginBottom = "3%"; section.style.paddingBottom = "3%"; section.style.display = "block"; var divContent = document.createElement("div"); divContent.setAttribute("class", "c__content"); section.appendChild(divContent); var titlePlayer = document.createElement("h2"); titlePlayer.setAttribute("class", "brand--h3 ng-star-inserted"); titlePlayer.innerHTML = "Découvrez ce produit testé en vidéo"; titlePlayer.style.textAlign = "center"; titlePlayer.style.color = "white"; divContent.appendChild(titlePlayer) let myArray = videos; for (let i = 0; i < videos.length; i++) { let videoArray = videos[i].id; console.log(videos[i].id); var divPlayer2 = document.createElement("div"); divPlayer2.setAttribute("id", "playerSkeepers") divPlayer2.style.margin = "auto"; var player2 = document.createElement("div"); player2.style.aspectRatio = "16/9"; player2.style.paddingBottom = "56.25%"; player2.style.marginBottom = "1.5rem" SDK.init({ type: "player", args: { key: playerKey, id: videoArray, width: "100%", classname: "player-teester", }, }, player2 ); divPlayer2.appendChild(player2); section.appendChild(divPlayer2); } // CTA var ctaCont = document.createElement("div"); ctaCont.style.marginTop = "1rem"; ctaCont.style.marginLeft = '-1px'; ctaCont.style.marginBottom = '1%'; ctaCont.setAttribute( "class", "" ); var divCta = document.createElement("a"); divCta.setAttribute("id", "teesterCta"); divCta.setAttribute("class", "teesterText"); divCta.innerHTML = "Découvrez ce produit testé en vidéo"; divCta.style.color = "#dc2f2f"; divCta.style.fontFamily = 'Inter var,"system-ui"'; divCta.style.fontWeight = "bold"; divCta.style.fontSize = "15px"; divCta.style.cursor = "pointer"; // init icon & set attributes var divIcon = document.createElement("img"); divIcon.setAttribute("id", "iconCta"); divIcon.style.position = "relative"; divIcon.style.top = "3px"; divIcon.style.marginRight = "0.5rem"; divIcon.src = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiPjxwYXRoIGQ9Ik0xNiAwQzcuMTY0IDAgMCA3LjE2NCAwIDE2czcuMTY0IDE2IDE2IDE2IDE2LTcuMTY0IDE2LTE2UzI0LjgzNiAwIDE2IDB6bS02IDI0VjhsMTYuMDA4IDhMMTAgMjR6IiBmaWxsPSIjZGMyZjJmIiBjbGFzcz0iZmlsbC00ZTRlNTAiPjwvcGF0aD48L3N2Zz4="; divIcon.style.width = "16px"; ctaCont.appendChild(divIcon); ctaCont.appendChild(divCta); if (window.innerWidth < 600 ) { document.querySelector("#overview > sd-product-overview > div.c__title-wrapper.ng-star-inserted").append(ctaCont); divPlayer2.style.width = "390px"; document.querySelector("#overview").append(section) } else if (window.innerWidth > 600) { document .querySelector( "#overview > sd-product-overview > div > div.c__content.col-24.col-l-9.col-m-12.offset-l-1 > div.c__title-wrapper.ng-star-inserted > p").prepend(ctaCont); document.querySelector("#characteristics").append(section); divPlayer2.style.width = "800px"; } // On Click Scroll To Player Desc divCta.addEventListener("click", function(i) { var scroll = document.querySelector("#playerSkeepers"); scroll.scrollIntoView({ block: "end" }); //top of the player }); }); }) SDK.init({ type: 'tracking', args: { key: trackingKey, product: productSku, event: 'PRODUCT_PAGE_VIEW' } }); });