');
if (appimageswitcher == 1 && productimageswitcher == 1) {
/*************** Debut Theme ************/
console.log("version >17")
setTimeout(function () {
var initval = '';
var isMobile = /iPhone|iPod|Android/i.test(navigator.userAgent);
var thumbsbackup;
var thumboptions;
jQuery(document).on("change", ".single-option-selector:eq(" + cleveroptionindex + ")", function () {
setTimeout(function () {
cleverMapper();
}, 200);
});
for (var i = 0; i < 35; i++) {
setTimeout(function () {
if (jQuery('.grid__item.product-single__media-group .product-single__media-wrapper:last').prev().find('img:first').attr('srcset') == undefined || initval == 'set') {
return false;
}
cleverMapper();
}, i * 500);
}
if (isMobile) {
// thumboptions = jQuery('.product-single__thumbnails').get(0).slick.options;
}
jQuery(document).on("click", ".product-single__thumbnails a", function (e) {
e.preventDefault();
jQuery('.product-single__thumbnails-item .active-thumb').removeClass('active-thumb');
jQuery(this).addClass('active-thumb');
jQuery('.product-single__media-group .hide').removeClass('hide');
var tumbsrc = jQuery(this).find('img').attr('src').replace("_500x500", "");
newthumbsrc = tumbsrc.split('?v=');
jQuery('.grid__item.product-single__media-group .product-single__media-wrapper').each(function (i, obj) {
imgsrc = jQuery(this).find('img:first').attr('srcset');
if (imgsrc != undefined) {
newimgsrc = imgsrc.split(',');
newimgsrc = newimgsrc[0].replace("_180x", "");
newimgsrc = newimgsrc.replace("180w", "");
newimgsrc = newimgsrc.split("?v=");
if (newthumbsrc[0] == newimgsrc[0]) {
} else {
jQuery(this).addClass('hide');
}
} else {
tumbsrc = tumbsrc.replace("_110x110@2x", "");
imgsrc = jQuery(this).find('img:first').attr('src').replace("_530x530", "");
// console.log(jQuery(this));
// console.log(imgsrc);
// console.log(tumbsrc);
if (tumbsrc == imgsrc) {
} else {
jQuery(this).addClass('hide');
}
// jQuery(this).addClass('hide');
}
});
});
jQuery(document).on("click", ".thumbnails-slider__prev", function (e) {
//console.log('clickeddddd');
jQuery('[data-slider-container]').slick('slickPrev');
});
jQuery(document).on("click", ".thumbnails-slider__next", function (e) {
jQuery('[data-slider-container]').slick('slickNext');
});
thumbsbackup = jQuery('.product-single__thumbnails li').clone();
function cleverMapper() {
var optionMap = [];
jQuery(".single-option-selector").each(function (key) {
if (jQuery(this).find('span').length > 0) {
optionMap[key] = jQuery(this).find('span').text().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
} else {
optionMap[key] = jQuery(this).val().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
}
});
if (optionMap.length == 0) {
jQuery(".single-option-selector__radio").each(function (key) {
optionMap[key] = jQuery(this).val().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
});
}
// if(isMobile && jQuery('[data-slider-container]').get(0).slick.options == undefined){
// return false;
// }
// console.log(optionMap);
var variantimagesArray = [];
var variantimagesArrayref = [];
if (1) {
if (1) {
if (cleverimages[optionMap[cleveroptionindex]] != undefined) {
while (variantimagesArray.length > 0) {
variantimagesArray.pop();
}
variantimagesArrayref = cleverimages[optionMap[cleveroptionindex]];
}
variantimagesArray = jQuery.merge(jQuery.merge([], variantimagesArrayref), cleverimages['CleverCommon']);
firstimage = variantimagesArray[0].toString();
console.log(variantimagesArray);
if (isMobile) {
if (thumboptions == undefined) {
} else {
jQuery('.product-single__thumbnails').slick('unslick');
}
jQuery('.product-single__thumbnails').html(thumbsbackup);
} else {
jQuery('.product-single__thumbnails').html(thumbsbackup);
}
if ($('.product-single__thumbnail-badge').length > 0) {
var thumbVideo = $('.product-single__thumbnail-badge').parent().parent().clone();
//console.log(thumbVideo);
}
if (variantimagesArray.length > 1) {
imgarr = [];
jQuery(variantimagesArray).each(function (i, obj) {
if (variantimagesArray[i] != 0) {
imgarr.push(cleverproductimagesnew[variantimagesArray[i]]);
}
});
}
jQuery('.product-single__thumbnails li').remove();
//console.log($('.product-single__thumbnail-badge').length);
jQuery(imgarr).each(function (i, obj) {
if (imgarr[i] != undefined) {
zoomsrc = imgarr[i].replace('500x500', '1024x1024');
jQuery('.product-single__thumbnails').append('
Use left/right arrows to navigate the slideshow or swipe left/right if using a mobile device