PageSourceSearch

https://www.mirkrasok.ru/local/templates/mirkrasok_2026v2/js/scripts.js?175310265011453

js mirkrasok.ru collected 2026-10-03 20:57:41 UTC 11,453 bytes, 412 lines download raw bytes

1var lazyLoadInstance = new LazyLoad({
2    elements_selector: ".lazy"
3});
4
5
6var obLazyDivs = {
7
8    loadbufferFrame:function(id,extData=false) {
9        let data=id;
10        if(extData)
11        {
12
13            data={[id]:'',filterCrossex:extData.filterProduct}
14           // console.log(["crossProducts",id])
15        }
16        //console.log(["crossProducts",id])
17         $.ajax({
18            url: "/local/php_interface/ajax/ajax.handler.php",
19            type: "POST",
20            dataType: "html",
21            data: data,
22            success: function(data){
23            $('#' + id).html(data);
24            if(id=="formsCapcha")
25            {
26                const currentUrl = window.location.pathname;
27		if(currentUrl == '/personal/'){
28                	obLogin.bind();
29		}
30                obCallback.bind();
31		
32            }
33            var $list = $('#' + id);
34
35            $list.each(function(){
36                var $parent = $(this);
37                var count = $parent.children().data("items-count");
38                var $arrowsParent = $parent.find("[data-arrows-parent]");
39                var $slider = $parent.find("[data-slider]");
40                $slider.slick({
41                    /*dots: true,*/
42                    arrows: true,
43                    autoplay: true,
44                    infinite: true,
45                    slidesToShow: count,
46                    slidesToScroll: count,
47                    appendArrows:$arrowsParent,
48                    responsive: [
49                       {
50                            breakpoint: 5000,
51                            settings:{
52                                slidesToShow: count || 5,
53                                slidesToScroll: count || 5
54                            }
55
56                        },
57                        {
58                            breakpoint: 1200,
59                            settings:{
60                                slidesToShow: 3,
61                                slidesToScroll: 3
62                            }
63
64                        },
65                        {
66                            breakpoint: 769,
67                            settings:{
68                                slidesToShow: 1,
69                                slidesToScroll: 1,
70                                dots:true
71                            }
72
73                        }
74                    ]
75                });
76
77                });
78             }
79        });
80
81        },
82
83    elInit:function(el) {
84        var result = {};
85        result.winH = $(window).height();
86        result.elH = el.height();
87        result.elOffset = el.offset();
88        result.elViewFrom = result.elOffset.top - result.winH;
89        result.elViewTo = result.elOffset.top + result.winH - result.elH;
90        return result;
91      },
92
93    elStatus: function(el, elPos) {
94
95        // проверяем элемент виден на экране
96        if ($(window).scrollTop() > elPos.elViewFrom && $(window).scrollTop() < elPos.elViewTo ) {
97
98            if($(el).attr("view") != "open") {
99               $(el).attr("view", "open");
100
101                //console.log($(el).attr("id"));
102                obLazyDivs.loadbufferFrame($(el).attr("id"));
103            }
104        }
105
106      },
107    bindFormLogin:function(){
108        var $elements = $('.content').find('[lazyDiv]');
109
110        $elements.each(function(){
111
112            var id = $(this).attr('id');
113
114            if(id == 'formsCapcha'){
115                //console.log("formsCapcha")
116                obLazyDivs.loadbufferFrame(id);
117            }
118        });
119    },
120    bind:function(){
121
122      var $elements = $('.content').find('[lazyDiv]');
123
124      $elements.each(function(){
125
126           var id = $(this).attr('id');
127
128		   if(id == 'watchedProducts'){
129			   $('#'+id).attr('view', 'open');
130			   obLazyDivs.loadbufferFrame(id);
131		   }else if(id == 'crossProducts'){
132               obLazyDivs.loadbufferFrame(id,{filterProduct:JSON.parse($(this).attr('data-filter'))});
133           }else if(id == 'formsCapcha'){
134		       //console.log("formsCapcha")
135               obLazyDivs.loadbufferFrame(id);
136           } else{
137			   var element = $("#" + id);
138			   var elPos = obLazyDivs.elInit(element);
139
140			   $(window).scroll(function() {
141				  obLazyDivs.elStatus(element, elPos);
142			   });
143		   }
144      });
145
146    }
147
148}
149
150// Свайпер меню
151// menu swipe
152
153var initialPoint;
154var finalPoint;
155document.addEventListener('touchstart', function(event) {
156initialPoint=event.changedTouches[0];
157}, false);
158document.addEventListener('touchend', function(event) {
159	finalPoint=event.changedTouches[0];
160	var xAbs = Math.abs(initialPoint.pageX - finalPoint.pageX);
161	var yAbs = Math.abs(initialPoint.pageY - finalPoint.pageY);
162
163//	obMenu.scroll_pos_y  = window.pageYOffset;
164//
165//	console.log(obMenu.scroll_pos_y)
166
167//	console.log(initialPoint.pageY)
168
169	// получаем позицию карты
170	if($('#map').length > 0){
171		map_pos = $('#map').offset()
172	}else{
173		map_pos = false
174	}
175
176	if (xAbs > 100 || yAbs > 100) {
177		if (xAbs > yAbs) {
178			if (finalPoint.pageX < initialPoint.pageX){
179			/*СВАЙП ВЛЕВО*/
180			if(map_pos!== false){
181				// если драг начинается на карте, то игнорим
182				if(initialPoint.pageY > map_pos.top && initialPoint.pageY < (map_pos.top+$('#map').height())){
183//					console.log('Карта Не')
184				}else{
185					if($("#main").children().attr("menu") == 'true' ) {
186					  console.log('saving')
187					  obMenu.scroll_pos_y  = window.pageYOffset;
188                        /* отключаеи времено  touchstart*/
189					  //obMenu.toggle();
190					}
191				}
192
193			}else{
194
195				if($("#main").children().attr("menu") == 'true' ) {
196                    /* отключаеи времено  touchstart*/
197				 // obMenu.toggle();
198				}
199			}
200			}else{
201		//alert("Вправо");
202				if($("#main").children().attr("menu") != 'true' ) {
203				  obMenu.toggle();
204				}
205			}
206		}else{
207
208	// if (finalPoint.pageY < initialPoint.pageY){
209	// alert("Вверх");
210	// }
211	// else{
212	// alert("Вниз");
213	// }
214
215		}
216	}
217}, false);
218
219
220$(document).ready(function(){
221
222
223    //    Мобильное меню
224
225    $('.navigation-back-btn').click(function(e) {
226        $('.sel-navigation').addClass("hide");
227        $('.navigation-item').removeClass('active show-dropdown');
228        $('.navigation-item[dropdown="1"]').addClass("has-drop");
229        $(".navigation-list-primary").animate({left: "0px"}, 300, function() {});
230        $(".navigation-top-holder").animate({right: "0px"}, 300, function() { });
231    });
232
233
234    $('.navigation-item.has-drop').click(function(e) {
235        if(!$(this).hasClass('active')) e.preventDefault();
236        $(this).addClass('active show-dropdown').removeClass("has-drop")
237        $(this).parent().css("position","static");
238        $(this).children().next().removeClass("hide");
239        $.scrollTo('.navigation');
240        $(".navigation-list-primary").animate({left: "-258px"}, 300, function() {});
241        $(".navigation-top-holder").animate({right: "258px"}, 300, function() {});
242    });
243
244
245    if ($("#popularProducts").length > 0 || $("#watchedProducts").length > 0)
246        obLazyDivs.bind();
247
248    $('.slider_discount').slick({
249        dots: true
250    });
251
252    $('.sliderArticle').slick({
253        dots: true,
254        responsive: [
255            {
256                breakpoint:10000,
257                settings:"unslick"
258            },
259            {
260                breakpoint: 768
261            }
262        ]
263    });
264
265    seoMakeLink();
266
267});
268
269$(document).ajaxComplete(function(event, xhr, settings) {
270	seoMakeLink();
271});
272
273
274var obCompare ={
275
276    productAdded:function(iProductID,bTurn){
277        var $obAddBlocks = $("[data-product-id="+iProductID+"] [data-compare-block=add]");
278        var $obAddedBlocks = $("[data-product-id="+iProductID+"] [data-compare-block=added]");
279        if(!bTurn)
280        {
281            $obAddBlocks.removeClass("hidden");
282            $obAddedBlocks.addClass("hidden");
283        }
284        else
285        {
286            $obAddBlocks.addClass("hidden");
287            $obAddedBlocks.removeClass("hidden");
288        }
289        return false;
290    },
291
292    ajax:function(self,obData){
293        'use strict';
294        var $self=$(self);
295        var $parent = $self.parents("[data-compare-parent]");
296
297        if(!$parent.hasClass("loading"))
298        {
299            $.ajax({
300                type:"post",
301                data:obData,
302                url:"/local/components/art-fresh/compare.list/ajax.php",
303                beforeSend:function(){
304                    $parent.addClass("loading");
305                },
306                success:function(){
307                    $parent.removeClass("loading");
308                    var bTurn = false;
309                    if(obData.action=="add") bTurn=true;
310                    var iProductID = obData.ID;
311                    obCompare.productAdded(iProductID,bTurn);
312                }
313            });
314        }
315        return false;
316    }
317};
318
319
320var obCompareNew ={
321
322
323
324    ajax:function(self,obData){
325        'use strict';
326        var $self=$(self);
327        var $parent = $self.parents("[data-compare-parent]");
328
329        if(!$parent.hasClass("loading"))
330        {
331            $.ajax({
332                type:"post",
333                data:obData,
334                url:"/local/components/art-fresh/compare.list/ajax.php",
335                beforeSend:function(){
336                    $parent.addClass("loading");
337                },
338                success:function(){
339                    $parent.removeClass("loading");
340                    $parent.toggleClass("compare-new-block-active");
341
342                }
343            });
344        }
345        return false;
346    }
347};
348
349function seoMakeLink(target) {
350//	console.log('seoMakeLink')
351    if (target === undefined) target = "div.lin";
352
353    $(target).each(function() {
354
355        var element = this;
356
357        var new_element = document.createElement('a'),
358            old_attributes = element.attributes,
359            new_attributes = new_element.attributes,
360            child = element.firstChild;
361
362        if(child === null) {
363            child = document.createTextNode(' ');
364        }
365            for (var i = 0, len = old_attributes.length; i < len; i++) {
366                new_attributes.setNamedItem(old_attributes.item(i).cloneNode());
367            }
368
369            do {
370
371                new_element.appendChild(child);
372            } while (child = element.firstChild);
373
374            element.parentNode.replaceChild(new_element, element);
375    });
376}//seoMakeLin
377
378
379$(document).ready(function(){
380    let _device={};
381    _device.touch=false;
382    try {
383        document.createEvent("TouchEvent");
384        _device.touch = true;
385    } catch (e) {
386        _device.touch = false;
387    }
388    if(!_device.touch)
389    {
390        $( '.catalog-link' ).hover( function() {
391            $( '.menuOpenCatalog' ).addClass( "hovered" );
392            $( '.menuOpenCatalog .cat_nav' ).show();
393        }, function() {
394            $( '.menuOpenCatalog' ).removeClass( "hovered" );
395            $( '.menuOpenCatalog .cat_nav' ).hide();
396        });
397    }
398	
399	$( '.catalog-section-box .item .open' ).click(function(e){
400		$( this ).closest("ul").find( "li" ).removeClass('hide');
401		$( this ).remove();
402	});
403
404	$( '.UPAKOVKA .property-filter-value' ).click(function(e){
405        var pack=$(this).children('span').text();
406        console.log(pack);
407        $('.complect .card-wrapper').removeClass('active');
408        $('[data-pack="'+pack+'"]').addClass('active');
409	});
410    
411    
412});

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.