PageSourceSearch

https://rvdmarket.ru/g/templates/shop2/2.110.2/conditioning-equipm…/product_preview_popup.js

js rvdmarket.ru collected 2026-10-07 17:13:13 UTC 4,310 bytes, 143 lines download raw bytes

1$(function(){
2
3    var quick_view_class = "product-quick-view2";
4    var $quick_view_trigger;
5
6    $(document).on('click', '.card_popup_close', function(){
7    	myo.close();
8    });
9
10    var obj = {
11    	popupFlag: true
12    };
13    
14    $(document).on("click", ".shop-product-btn", function (e) {
15        var $this = $(this);
16        var url = $this.attr("data-url") || $this.attr("href");
17        
18		obj.currentProductUrl = url;
19		
20		if ($this.parents('.popover-body').length>0) {
21			obj.popupFlag = false;
22		} else {
23			obj.popupFlag = true;
24		}
25		
26		return obj
27    });
28    
29    shop2.on('afterCartAddItem', function(d, status) {
30		if (!d.errstr && obj.popupFlag) { // если ошибок нет
31			$('#shop2-msg').hide();
32			loadProduct(obj.currentProductUrl);
33		}
34	});
35
36    if (shop2 && shop2.product && shop2.product._reload) {
37        var reload = shop2.product._reload;
38        
39        shop2.product._reload = function(node) {
40            var args = Array.prototype.slice.call(arguments, 0);
41            var popoverDiv = $(node).closest("." + quick_view_class);
42            if (popoverDiv.length) {
43                reloadProduct(node);
44            } else {
45                reload.apply(this, args);
46            }
47        }
48    }
49
50    function loadProduct (url, callback) {
51    	
52        if (!myo) return false;
53        if ($('.product-quick-view2').length>0) {
54        	myo.close();
55        };      
56        myo.open({
57            ajax: url + '?&products_only=1&product_preview=1',
58            wrapClass: quick_view_class,
59            onLoad: function () {
60				
61				if (typeof amountInit === "function") {
62                	amountInit();
63				};
64                
65                const imageObserver = new IntersectionObserver((entries, imgObserver) => {
66                    entries.forEach((entry) => {
67                        if (entry.isIntersecting) {
68                            const lazyImage = entry.target
69                            lazyImage.src = lazyImage.dataset.src
70                            lazyImage.classList.remove("gr_lazy_load");
71                            imgObserver.unobserve(lazyImage);
72                        }
73                    })
74                });
75                const arr = document.querySelectorAll("img.gr_lazy_load")
76                arr.forEach((v) => {
77                    imageObserver.observe(v);
78                });
79                
80                
81                var $popupKindClass = $(".popup_kinds_slider");
82                
83                // слайдер в коллекциях
84                
85			    $popupKindClass.each(function() {
86					$(this).slick({
87						dots: false,
88						arrows: true,
89						infinite: false,
90						speed: 800,
91						autoplay: false,
92						draggable: true,
93						slidesToShow: 2,
94						responsive: [
95							{
96								breakpoint: 768,
97								settings: {
98									arrows: false,
99									dots: true,
100									slidesToShow: 1
101								}
102							}
103						]
104					});
105			    });
106                
107                
108                if ($.isFunction(callback)) {
109                    callback();
110                };
111            }
112        });
113    };
114
115    function reloadProduct (node) {
116        var $node = $(node),
117            kinds = shop2.product.getNodeData(node, 'kinds', true),
118            paramName = shop2.product.getNodeData(node, 'name'),
119            paramValue = shop2.product.getNodeData(node, 'value'),
120            $form = $node.closest('form'),
121            form = $form.get(0),
122            meta, kind_id, product_id;
123            
124        if (kinds && $.type(paramName) !== 'undefined' && $.type(paramValue) !== 'undefined' && form) {
125
126            if (form.elements.meta) {
127                meta = $.parseJSON(form.elements.meta.value);
128            }
129
130            product_id = form.elements.product_id.value;
131
132            $form.find('[name=submit]').prop('disabled', true);
133
134            kind_id = shop2.product.findKindId(product_id, kinds, paramName, paramValue, meta);
135
136            if (kind_id === 0) return false;
137
138            var url = window.location.protocol + "//" + window.location.host + shop2.uri + "/product/" + kind_id;
139
140            loadProduct(url);
141        }
142    };
143});

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.