1$(function () { 2 const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 3 let quick_trigger_class = '.quick-view-trigger'; 4 const quickViewEvent = new Event(`quickVievPopupInited`, { bubbles: true }); 5 const imageZoom = new Event(`zoomInit`, { bubbles: true }); 6 7 const quickRemodal = $('.remodal[data-remodal-id="quick-view-remodal"]'); 8 9 10 let $quick_view_trigger; 11 let obj = {}; 12 13 $(document).on("click", ".quick-view-trigger", function (e) { 14 e.preventDefault(); 15 16 let $this = $(this); 17 18 if (!$quick_view_trigger) { 19 $quick_view_trigger = $(".quick-view-trigger"); 20 }; 21 22 obj.currentItem = $this.parents('.shop2-product-item').length > 0 ? $this.parents('.shop2-product-item') : $this.parents('.kind-item'); 23 24 if ($this.parents('.product-item-wrap').length > 0) { 25 obj.currentItem = $this.parents('.product-item-wrap'); 26 }; 27 28 obj.kindId = $this.closest('form').find('[name=kind_id]').val(); 29 30 loadProduct(); 31 }); 32 33 shop2.on('beforeGetProductListItem', function(currentKindId) { 34 if (quickRemodal.hasClass('remodal-is-opened')) { 35 loadProduct(currentKindId); 36 }; 37 }) 38 39 quickRemodal.on('closed', function() { 40 window.gr_quick_more_active = false; 41 }); // ÐбнÑлÑем Ñлаг ÑÑÐ¾Ð±Ñ Ð¿Ð¾Ð·Ð¸ÑÐ¸Ñ Ð¾ÑкÑÑÑÑÑ Ð¿Ð°ÑамеÑÑов бÑла ÑолÑко Ñ Ð²ÑплÑвÑего ÑоваÑа и его модиÑикаÑий 42 43 function loadProduct(kind_id) { 44 let gr_images_view = $('.quick-view-popup').data("images-view"); 45 let gr_images_size = $('.quick-view-popup').data('images-size'); 46 let ajaxUrl = "/-/x-api/v1/public/?method=shop2/getProductPageData"; 47 48 49 if (typeof kind_id != 'undefined') { 50 obj.kindId = kind_id; 51 }; 52 53 $.ajax({ 54 url: ajaxUrl, 55 data: { 56 param: { 57 "kind_id": obj.kindId, 58 "mode": "quick-view" 59 }, 60 "gr_images_view":gr_images_view, 61 "gr_images_size": gr_images_size, 62 }, 63 success: function (res) { 64 65 if (!quickRemodal.hasClass('remodal-is-opened')) { 66 quickRemodal.remodal().open(); 67 }; 68 69 $('.quick-view-popup__body').html(res.result.html); 70 71 $('#shop2-tooltip').hide(); 72 73 initSlider(); // Ð¡Ð»Ð°Ð¹Ð´ÐµÑ 74 75 initZoom(); // ÐÑпа, лайÑгалеÑи 76 77 initMoreBtn(); // Ðнопка "ÐÑе паÑамеÑÑÑ" 78 79 shop2_gr.methods.amountInit(); // СкÑÐ¸Ð¿Ñ ÐºÐ¾Ð»-ва 80 81 productArrows(); // ÐеÑеклÑÑаÑели. СледÑÑÑий и пÑедÑдÑÑий 82 83 document.dispatchEvent(quickViewEvent); // СобÑÑие поÑле оÑÑабоÑки вÑÐµÑ ÑкÑипÑов 84 85 setTimeout(function () { 86 document.dispatchEvent(imageZoom); // СобÑÑие поÑле оÑÑабоÑки вÑÐµÑ ÑкÑипÑов и галеÑеи 87 }, 500); 88 89 if(shop2.my.gr_update_buy_button && $('.buy-button-name-has').length){ 90 cookieUpdateBuy.updateQuickProductButtons("product_ids"); 91 } 92 } 93 }); 94 }; 95 96 function productArrows() { 97 var prev_product_caller, 98 next_product_caller; 99 100 $('.quick-card-page__body').prepend('<div class="prev-product-caller prev_product_caller hide"><span><svg class="gr-svg-icon"><use xlink:href="#icon_shop_quick_view_prev"></use></svg></span></div><div class="next-product-caller next_product_caller hide"><span><svg class="gr-svg-icon"><use xlink:href="#icon_shop_quick_view_next"></use></svg></span></div>'); 101 prev_product_caller = $('.quick-card-page__body').find(".prev_product_caller"); 102 next_product_caller = $('.quick-card-page__body').find(".next_product_caller"); 103
104 if (obj.currentItem.parents('.product-list:not(.tns-slider)').length) { 105 var prev_product = obj.currentItem.prev().length ? obj.currentItem.prev().find(quick_trigger_class) : null; 106 var next_product = obj.currentItem.next().length ? obj.currentItem.next().find(quick_trigger_class) : null; 107 }; 108 109 if (obj.currentItem.parents('.kinds_slider:not(.tns-slider)').length) { 110 var prev_product = obj.currentItem.prev().length ? obj.currentItem.prev().find(quick_trigger_class) : null; 111 var next_product = obj.currentItem.next().length ? obj.currentItem.next().find(quick_trigger_class) : null; 112 }; // ТоваÑÑ Ð² каÑегоÑии или в коллекÑии без ÑлайдеÑа 113 114 if (obj.currentItem.parents('.product-list.tns-slider').length) { 115 var prev_product = obj.currentItem.prev().length ? obj.currentItem.prev().find(quick_trigger_class) : null; 116 var next_product = obj.currentItem.next().length ? obj.currentItem.next().find(quick_trigger_class) : null; 117 118 if (obj.currentItem.parents('.product-list.tns-slider').find('.shop2-product-item').attr('id') == undefined && obj.currentItem.parents('.product-list.tns-slider').find('.product-item-wrap').attr('id') == undefined) { 119 $('.prev_product_caller, .next_product_caller').remove(); 120 } 121 }; 122 123 124 if (obj.currentItem.parents('.kinds_slider.tns-slider').length) { 125 var prev_product = obj.currentItem.prev().length ? obj.currentItem.prev().find(quick_trigger_class) : null; 126 var next_product = obj.currentItem.next().length ? obj.currentItem.next().find(quick_trigger_class) : null; 127 128 if (obj.currentItem.parents('.kinds_slider.tns-slider').find('.kind-item').attr('id') == undefined) { 129 $('.prev_product_caller, .next_product_caller').remove(); 130 } 131 }; // tiny slider 132 133 134 if (prev_product) { 135 prev_product_caller.removeClass("hide").on("click", function () { 136 prev_product.trigger("click"); 137 window.gr_quick_more_active = false; 138 }); 139 }; // ÐÑобÑажение кнопки "ÐÑедÑдÑÑий" 140 141 if (next_product) { 142 next_product_caller.removeClass("hide").on("click", function () { 143 next_product.trigger("click"); 144 window.gr_quick_more_active = false; 145 }); 146 }; // ÐÑобÑажение кнопки "СледÑÑÑий" 147 }; 148 149 function initSlider() { 150 if ($(".quick-card-slider__thumbs-slider").length > 0) { 151 var vslider = tns({ 152 container: ".quick-card-slider__items-slider", 153 slideBy: 1, 154 mode: "gallery", 155 axis: "horizontal", 156 autoplay: false, 157 mouseDrag: true, 158 center: true, 159 autoWidth: false, 160 loop: false, 161 rewind: true, 162 swipeAngle: false, 163 preventActionWhenRunning: true, 164 navAsThumbnails: true, 165 nav: true, 166 controls: true, 167 navPosition: "bottom", 168 navContainer: ".quick-card-slider__thumbs-slider" 169 }); 170 171 172 var small_slider = tns({ 173 container: ".quick-card-slider__thumbs-slider", 174 loop: false, 175 gutter: 10, 176 center: false, 177 mouseDrag: true, 178 nav: false, 179 controls: false, 180 navPosition: "bottom", 181 preventActionWhenRunning: true, 182 axis: "horizontal", 183 responsive: { 184 320: { 185 items: 3 186 }, 187 480: { 188 items: 3 189 }, 190 768: { 191 items: 3 192 }, 193 1024: { 194 items: 4 195 } 196 } 197 }); 198 199 vslider.events.on("indexChanged", function () { 200 small_slider.goTo(vslider.getInfo().index); 201 }); 202 203 $('.quick-card-slider__thumbs .tns-controls button[data-controls="next"]').on('click', function () { 204 $('.quick-card-slider__items .tns-controls button[data-controls="next"]').click(); 205 }); 206 207 $('.quick-card-slider__thumbs .tns-controls button[data-controls="prev"]').on('click', function () { 208 $('.quick-card-slider__items .tns-controls button[data-controls="prev"]').click(); 209 }); 210 }; 211 }; 212 213 function initZoom() { 214 if (!isMobile && jQuery().zoom) { 215 $('.gr-image-zoom').zoom({ 216 magnify: 1, 217 duration: 10, 218 onZoomIn: function () { 219 $(this).parent().addClass('hide_small_pic'); 220 }, 221 onZoomOut: function () { 222 $(this).parent().removeClass('hide_small_pic'); 223 }, 224 callback: function () { 225 var $zoomImg = $(this); 226 var containerHeight = $zoomImg.parent().outerHeight(); 227 var containerWidth = $zoomImg.parent().outerWidth(); 228 var zoomImgHeight = Math.floor($zoomImg.height()); 229 var zoomImgWidth = Math.floor($zoomImg.width()); 230 var floatHeight = Math.floor(20 * zoomImgHeight / 100); 231 var floatWidth = Math.floor(20 * zoomImgWidth / 100); 232 var prevWidth = Math.floor($(this).prev().outerWidth()); 233 var prevHeight = Math.floor($(this).prev().outerHeight()); 234 235 var zoomFloatHeight = zoomImgHeight + floatHeight; 236 var zoomFloatWidth = zoomImgWidth + floatWidth; 237 var finalHeight = prevHeight + floatHeight; 238 var finalWidth = prevWidth + floatWidth; 239 240 if (zoomFloatHeight <= prevHeight - floatHeight || zoomFloatWidth <= prevWidth - floatWidth) { 241 $(this).parent().addClass('hide_big_pic'); 242 }; 243 244 if (zoomImgHeight <= prevHeight || zoomImgWidth <= prevWidth) { 245 $zoomImg.css({
246 'width': finalWidth, 247 'height': finalHeight 248 }); 249 } 250 251 if (finalHeight <= containerHeight && finalWidth <= containerWidth) { 252 $(this).parent().addClass('hide_zoom_pic'); 253 } 254 } 255 }); 256 }; 257 258 $(".quick-card-slider__items").lightGallery({ 259 thumbnail: false, 260 download: false, 261 loop: false, 262 counter: false, 263 getCaptionFromTitleOrAlt: true, 264 selector: ".quick-card-slider__image a" 265 }); 266 267 $('.quick-card-slider__items-slider img').on('load', function () { 268 setTimeout(function () { 269 $('.card_slider_loader').hide(); 270 }, 10); 271 }); 272 }; 273 274 function initMoreBtn() { 275 let $cardHiddenOptions = $('.quick-card-page .gr-product-options .option-item:hidden'); 276 277 if ($cardHiddenOptions.length > 0) { 278 $('.quick-card-page .gr-product-options-more').addClass('show_more_btn'); 279 }; 280 281 $('.quick-card-page .gr-product-options-more__btn').on('click', function () { 282 let currentText = $(this).data('text'); 283 let hideText = $('html').attr('lang') == 'ru' ? 'СвеÑнÑÑÑ' : 'Hide'; 284 285 if ($(this).hasClass('active')) { 286 $(this).removeClass('active'); 287 $(this).find('ins').text(currentText); 288 289 window.gr_quick_more_active = false; 290 } else { 291 $(this).addClass('active'); 292 $(this).find('ins').text(hideText); 293 294 window.gr_quick_more_active = true; 295 }; 296 297 $cardHiddenOptions.stop().slideToggle(250); 298 }); 299 300 if (window.gr_quick_more_active) { 301 let hideText = $('html').attr('lang') == 'ru' ? 'СвеÑнÑÑÑ' : 'Hide'; 302 303 $('.quick-card-page .gr-product-options .option-item').show(); 304 $('.quick-card-page .gr-product-options-more__btn').addClass('active'); 305 $('.quick-card-page .gr-product-options-more__btn ins').text(hideText); 306 }; // ÐенÑем ÑекÑÑ ÐºÐ½Ð¾Ð¿ÐºÐ¸ "ÐÑе паÑамеÑÑÑ" еÑли она бÑла оÑкÑÑÑа пеÑед пеÑеклÑÑением модиÑикаÑии 307 } 308});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.