if (typeof isAutomirrorLoaded !== 'undefined') {
throw new Error('automirror already loaded');
}
if (typeof isAutomirrorLoaded !== 'undefined') {
throw new Error('automirror already loaded');
}
var dermacolPageType;
var isAutomirrorLoaded=1;
var virtooalMirrorSettings = {
userName: "5239",
apiKey: "ab81728ec03560d8afcf18260534b3e5",
mirrorWidth: "260",
lang: "en",
title: "Virtual Mirror",
titleLeft: "Virtual",
titleRight: "Mirror",
color: "000000",
color2: "000000",
side: "left",
maxContentWidth: 0,
marginFromContent: 10,
model:"13",
modelMale:"18",
modelKids:"79",
modelC:"9",
modelMaleC:"4",
fullscreenWidth:1,
loadFirstProduct:"yes",
LiveAsDefault:"1",
hideIfNoProduct:"yes",
browse:true,
state:"minimized",
iconShowMobile:"1",
closeLiveOnMinimize:"0",
ps_enabled: "0",
ps_color_primary: "000000",
ps_color_secondary: "000000",
ps_info: "",
ps_btn_pos: "0",
ps_model_list: ""
}
if (window.location.href.indexOf('?preview=1') > -1){
//preview mode
virtooalAddBtnsPreview();
}
else {
virtooalAddBtns();
}
var elemDivVirtooal = document.createElement('div');
elemDivVirtooal.innerHTML = '
';
document.body.appendChild(elemDivVirtooal);
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://mirrorear.virtooal.com/assets/js/widget_min.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
if (window.location.href.indexOf('?test=1') < 1) {
po.src = 'https://mirrorear.virtooal.com/assets/js/crossmirror.php?v=1635921684';
}
else {
po.src = 'https://mirrorparts.virtooal.com/assets/js/crossmirror.php?v=186';
}
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
//add buttons personalized functions
function virtooalAddBtns(refresh){
//check personalized function
jQuery(document).ready(function(){
console.log('[virtooal.com] automirror script loaded');
function virtooalAddButtonProductPage(){
item_id = jQuery('#productSelect[name="id"]').val();
var btn_html = ''+
''+
'
';
jQuery('#try-on-button-placeholder').remove();
jQuery(btn_html).insertAfter('.cart-functions');
//jQuery(btn_html).insertAfter('form[action="/cart/add"]');
virtooalRefreshBtns();
}
function virtooalInitProductPage(){
virtooalAddButtonProductPage();
history.pushState = (f => function pushState() {
var ret = f.apply(this, arguments);
window.dispatchEvent(new Event('pushState'));
window.dispatchEvent(new Event('locationchange'));
return ret;
})(history.pushState);
history.replaceState = (f => function replaceState() {
var ret = f.apply(this, arguments);
window.dispatchEvent(new Event('replaceState'));
window.dispatchEvent(new Event('locationchange'));
return ret;
})(history.replaceState);
window.addEventListener('locationchange', function() {
setTimeout(function(){
virtooalAddButtonProductPage();
}, 1000);
});
}
// initialize when virtooalRefreshBtns() is already defined
var checkvirtooalRefreshBtns = setInterval(function(){
if (typeof virtooalRefreshBtns === 'function'){
clearInterval(checkvirtooalRefreshBtns);
if (jQuery('.template-product').length == 1){
virtooalInitProductPage();
}
}
}, 100);
});
}
//preview mode
function virtooalAddBtnsPreview(refresh){
//check personalized function
}