Free javascript Hosting


bc-smd-store-script-31-3-22.js

Uploaded on Apr 01 2022 07:14 by rounak.jain

<script>
// src="https://arizear.app/model-viewer/oQBiELEB7VhenLlKZbZOuEaikdU21645027513119"
// src="https://pepperfry-dev.avataar.me/index.html?skuid=1745297"


// const link = document.createElement('link')
// link.rel="prefetch"
// link.as="fetch"
// link.crossorigin="anonymous"
// link.href="https://arizear.app/model-viewer/oQBiELEB7VhenLlKZbZOuEaikdU21645027513119"
// link.href="https://pepperfry-dev.avataar.me/index.html?skuid=1745297"
// document.getElementsByTagName('head')[0].appendChild(link);
const bigCommerceSkuId = window.BCData.product_attributes.sku;
let productViewElement = null,
thumbnailElements = null,
arizeViewElement = null,
arizeIdElement = null,
arizeId = null,
arizeIframe = e => e
? `


<iframe id="inlineFrameExample"
title=""
width="100%"
height="100%"
style="min-height:360px"
src="https://orion-dev.avataar.me/engine/POC/index.html?skuid=1839747"

>
</iframe>`
: "";
// console.log('g', document.getElementById('inlineFrameExample'));
arizeViewElement = document.createElement("div");
console.log('SKU: ', window.BCData.product_attributes.sku)

const changeToArView = () => {
document.querySelectorAll('input[name=product_id]')[0].value = '104';
document.querySelectorAll('input[name=product_id]')[1].value = '104';

// document.getElementById('form-action-addToCart').onsubmit= ;
console.log( document.querySelectorAll('input[name=product_id]')[0].value, 'check');
console.log( document.querySelectorAll('input[name=product_id]')[1].value, 'check1');

document.getElementById('form-action-addToCart').click();


//document.getElementById('inlineFrameExample').src = document.getElementById('inlineFrameExample').src;
document.getElementById('inlineFrameExample').src = 'https://orion-dev.avataar.me/engine/POC/index.html?skuid=1839747&clientId=POC&bigCommerceSkuId=' + bigCommerceSkuId;

arizeViewElement && (arizeViewElement.style.display = "block"), productViewElement && (productViewElement.style.display = "none"); },
unSelectArizeAr = () => {arizeViewElement.style.display = "none", productViewElement.style.display = "block"},
openArDialog = e => {
e = function (e) {const i = document.createElement("template"); return i.innerHTML = e, i.content}(`
<div id="arize-modal" style="position:fixed;top:0;left:0;width:100%;height:100%;opacity:1;z-index:1000;
background-color: rgba(255,255,255,0.56);display: flex;justify-content: center;align-items: center">
<iframe id="inlineFrameExample"
title=""
width="100%"
height="100%"
style="min-height:360px"
src="https://arizear.app/model-viewer/${e}">
</iframe>

<div id="arize-modal-close" style="position: fixed;cursor: pointer;z-index:1001;width: 40px;height: 40px; background-color: white; top: 20px; left: 10px">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<line x1="19" y1="5" x2="5" y2="19" fill="#fff" stroke="#000" stroke-miterlimit="10"/>
<line x1="5" y1="5" x2="19" y2="19" fill="#fff" stroke="#000" stroke-miterlimit="10"/>
</svg>
</div>
</div>
`);
document.body.appendChild(e), document.getElementById("arize-modal-close").onclick = () => {var e = document.querySelector("#arize-modal"); e && document.body.removeChild(e)}
},
addArModal = (e, i) => {e.style.display = "block", e.onclick = () => openArDialog(i)},
addArize = () => {
var e = document.getElementsByClassName('productView-thumbnails'),
thumbnailElements = e[0]
productViewElement = document.getElementsByClassName('productView-image')[0];
arizeViewElement.style.display = "none";
productViewElement.after(arizeViewElement);
for (const a of thumbnailElements.children)
if (a.classList.contains('arize-ar-thumbnail')) return
for (const r of thumbnailElements.children)
r.addEventListener('click', unSelectArizeAr)

const n = document.createElement("li"); n.classList.add("productView-thumbnail"), n.innerHTML = `
<a class="productView-thumbnail-link arize-ar-thumbnail">
<img src="https://images.unsplash.com/photo-1493612276216-ee3925520721?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=92&q=80"
alt="View in AR"
title="View in AR"
sizes="50px">
</a>
`, n.addEventListener("click", function () {changeToArView() }), thumbnailElements.appendChild(n)


};
addArize();

arizeViewElement.innerHTML = arizeIframe(true);
window.addEventListener("message", function (e) { console.log('message event listener: ' + e.data) }, false);





</script>

Back to list