var EZwidth, EZoffsetX, EZEnabled, bigimg; String.prototype.replaceAll = function(target, replacement) { return this.split(target).join(replacement); }; jQuery(document).ready(function($) { startPinfoTimer(); $('#pinfo_360_button').click(function() { open_presentation($(this).attr('data-360'),800,700); }); $('.pinfo-top-copy').html($('.pinfo-top').html() .replaceAll('id="','id="copy-') .replaceAll('itemprop=','data-itemprop=') .replaceAll('itemscope=','data-itemscope=') .replaceAll('itemtype=','data-itemtype=') ); bindCopyStarOnPinfo(); bindCopyTimerPriceOnPinfo(); bigimg = $('#images'), thumbs = $('#pinfo-thumbs'); var initialSlide = typeof bigimg.attr('data-initial-slide') != 'undefined' ? bigimg.attr('data-initial-slide') : 0; bigimg.slick({ slidesToShow: 1, slidesToScroll: 1, adaptiveHeight: true, arrows: false, infinite: false, fade: true, cssEase: 'ease', responsive: [ { breakpoint: 480, settings: { fade: false } } ] }); thumbs.slick({ arrows: true, slidesToShow: dget('pinfo-thumbs','items',true), infinite: false, draggable: false, vertical: dget('pinfo-thumbs','vertical',true) === 1 ? true : false, responsive: [ { breakpoint: 480, settings: { arrows: true, vertical: false } } ] }); thumbs.on('click','.slick-slide', function() { var index = thumbs.find('.thumb').index(this); bigimg.slick('slickGoTo',index, false); }); $('#img_Prev, #img_Next').on('click', function() { var t = $(this).attr('id').split('_')[1]; bigimg.slick('slick'+t); }); if(initialSlide > 0) bigimg.slick('slickGoTo', initialSlide, true); //showMobileInfo(); zoomConfig(); //$(window).on('resize', showMobileInfo); $(window).on('viewport_changed', function() { zoomConfig(); initZoom(true); }); bigimg.on('beforeChange',syncGallery); bigimg.trigger('beforeChange',[bigimg,0,0]); if(dget('rc_pid','is-set') == '1') inventorySet(dget('rc_pid','id')); else inventory(dget('rc_pid','id')); //inventory(dget('rc_pid','id')); if(dget('rc_pid','sell-type') == '1') { buy_quantity_sum($('#buy_quantity_input'),$('#buy_quantity_prive')); } initZoom(); lightbox.option({ showImageNumberLabel: false }); $(document).on('shown.bs.collapse', '.tabs-container .panel-group', function(e,e2,e3) { var target = $(e.target) if($(document).scrollTop() > target.prev().offset().top) { $(document).scrollTop(target.prev().offset().top) } }) }); function startPinfoTimer() { if(jQuery('.promotionOver').length > 0) { var element = jQuery('.promotionOver'); var elementVal = element.attr('data-value'); var time = elementVal + '000' // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = Date.now(); // Find the distance between now an the count down date var distance = time - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); if (days == 1){ var days_def = def.units.day; }else{ var days_def = def.units.days; } // Display the result in the element with id="demo" var allTimers = document.querySelectorAll(".pinfo-promotion__time"); allTimers.forEach(timersElement => { timersElement.innerHTML = days + ' ' + days_def + ' ' + hours + ":" + minutes + ":" + seconds; }); // If the count down is finished, write some text if (distance < 0) { clearInterval(x); var allTimers = document.querySelectorAll(".pinfo-promotion__time"); allTimers.forEach(timersElement => { timersElement.innerHTML = def.index['WmFrb8WEY3pvbmE=']; }); } }, 1000); } } function syncGallery(e,slick,current,next) { initZoom(current,next); var idx_last = jQuery('#images').find('.slick-slide').length - 1; if(next === 0) { jQuery('#img_Prev').fadeOut('fast'); } else { jQuery('#img_Prev').fadeIn('fast'); } if(next === idx_last) { jQuery('#img_Next').fadeOut('fast'); } else { jQuery('#img_Next').fadeIn('fast'); } var thumbs = jQuery('#pinfo-thumbs'); thumbs.slick('slickGoTo',next,false); /* if(thumbs.find('.thumb').eq(next).is('.slick-active') == false) { var tvis = thumbs.find('.thumb').filter('.slick-active'); if(next < tvis.first().data('slick-index')) { thumbs.slick('slickPrev'); } if(next > tvis.last().data('slick-index')) { thumbs.slick('slickNext'); } }*/ } /* function showMobileInfo() { if(viewport_check.is_in(['xs','sm'])) { if(jQuery('#pinfo-topinfo').length > 0) return; var topinfo = jQuery('