PageSourceSearch

https://dstkom.com/g/templates/shop2/2.112.2/js/main.js

js dstkom.com collected 2026-10-05 00:03:58 UTC 66,322 bytes, 2,311 lines download raw bytes

1shop2.search.getParams = function(folder_id, func) {
2    var url;
3
4    shop2.trigger('beforeGetFolderCustomFields');
5  
6    if (folder_id > 0) {
7	    if (shop2.my.gr_search_old_color) {
8	      
9	      url = '/-/shop2-api/?cmd=getFolderCustomFields' +
10	              '&hash=' + shop2.apiHash.getFolderCustomFields +
11	              '&ver_id=' + shop2.verId +
12	              '&folder_id=' + folder_id +
13	              '&new_color_ext=1' +
14	              '&' + decodeURIComponent(document.location.search).replace(/[^&]*=(&|$)/g, '');
15	  
16	          $.getJSON(url, function(d, status) {
17	              shop2.fire('afterGetFolderCustomFields', func, d, status);
18	              shop2.trigger('afterGetFolderCustomFields', d, status);
19	          });
20	      
21	    } else {
22	      
23	      url = '/-/shop2-api/?cmd=getFolderCustomFields' +
24	              '&hash=' + shop2.apiHash.getFolderCustomFields +
25	              '&ver_id=' + shop2.verId +
26	              '&folder_id=' + folder_id +
27	              '&' + decodeURIComponent(document.location.search).replace(/[^&]*=(&|$)/g, '');
28	  
29	          $.getJSON(url, function(d, status) {
30	              shop2.fire('afterGetFolderCustomFields', func, d, status);
31	              shop2.trigger('afterGetFolderCustomFields', d, status);
32	          });
33	      
34	    };
35    }
36};
37
38shop2.queue.addToCart = function() {
39	
40	$(document).on('mouseenter', '.main-blocks-wrapper .shop2-product-btn', function(){
41		$('.main-blocks-wrapper .shop2-product-amount input').blur();
42	});
43
44    $(document).on('click', '.shop2-product-btn:not(.preorder-btn-js)', function(e) {
45
46        var $this = $(this),
47            $form = $this.closest('form'),
48            form = $form.get(0),
49            adds = $form.find('.additional-cart-params'),
50            len = adds.length,
51            i, el,
52            a4 = form.amount.value,
53            kind_id = form.kind_id.value;
54
55        e.preventDefault();
56        
57
58
59        if (len) {
60            a4 = {
61                amount: a4
62            };
63
64            for (i = 0; i < len; i += 1) {
65                el = adds[i];
66                if (el.value) {
67                    a4[el.name] = el.value;
68                }
69            }
70        }
71
72        shop2.cart.add(kind_id, a4, function(d) {
73
74            $('#shop2-cart-preview').replaceWith(d.data);
75        	
76        	var totalCartAmount = +$(d.data).find('.gr-cart-total-amount').text(),
77        		totalCartSummText = $(d.data).find('.gr-cart-total-sum').text();
78		
79			if (totalCartAmount>0) {
80				$('.gr-cart-popup-btn').removeClass('pointer_events_none');
81				$('.gr-cart-total-amount').text(totalCartAmount);
82				$('.gr-cart-total-sum').text(totalCartSummText);
83				$('.title-text-cart').hide();
84				$('.body-text-cart').show();
85				$('.shopping-cart').removeClass('amount--count-none');
86				$('.shopping-cart').addClass('amount--count');
87			} else{
88				$('.gr-cart-popup-btn').addClass('pointer_events_none');
89				$('.gr-cart-total-amount').text('0');
90				$('.gr-cart-total-sum').text('0');
91				$('.body-text-cart').hide();
92				$('.title-text-cart').show();
93				$('.shopping-cart').removeClass('amount--count');
94				$('.shopping-cart').addClass('amount--count-none');
95			};
96			
97			
98			if ($('html').attr('lang') == 'ru') {
99				var addToCartBtn = '<a href="' + shop2.uri + '/cart">в корзину</a>';
100				var addToCartBtn2 = '<a href="' + shop2.uri + '/cart">Товар добавлен в корзину</a>';
101			} else {
102				var addToCartBtn = '<a href="' + shop2.uri + '/cart">to cart</a>';
103				var addToCartBtn2 = '<a href="' + shop2.uri + '/cart">Product added to cart</a>';
104			};
105			
106			
107			if (d.errstr) {
108				shop2.msg(d.errstr, $this);
109			} else {
110				
111				if ($('html').attr('lang') == 'ru') {
112					shop2.msg('Товар добавлен ' + addToCartBtn + '  ', $('body'));
113				} else {
114					shop2.msg('Product added to ' + addToCartBtn + '  ', $('body'));
115				};
116			
117			}
118
119            if (d.panel) {
120                $('#shop2-panel').replaceWith(d.panel);
121            }
122        });
123
124    });
125
126};
127shop2.filter.sort = function(name, elem) {
128    var re = new RegExp(this.escape('s[sort_by]') + '=([^&]*)'),
129        params = this.str.match(re),
130        desc = name + ' desc',
131        asc = name + ' asc',
132        isDesc = (elem.is('.sort-param-desc'));
133
134
135    params = (params && params.length > 1) ? params[1] : '';
136    
137    params = (isDesc) ? desc : asc;
138
139    this.remove('s[sort_by]');
140    this.add('s[sort_by]', params);
141    return this;
142},
143
144shop2.queue.sort = function() {
145    var wrap = $('.sorting');
146
147    wrap.find('.sort-param').on('click', function(e) {
148        var $this = $(this),
149            name = $this.data('name');
150
151        e.preventDefault();
152        shop2.filter.sort(name, $this);
153        shop2.filter.go();
154    });
155
156    wrap.find('.sort-reset').on('click', function(e) {
157        e.preventDefault();
158        shop2.filter.remove('s[sort_by]');
159        shop2.filter.go();
160    });
161},
162
163shop2.queue.product = function() {
164
165	shop2.product._reload = function(node) {
166
167		var $node = $(node);
168		var kinds = shop2.product.getNodeData(node, 'kinds', true);
169		var paramName = shop2.product.getNodeData(node, 'name');
170		var paramValue = shop2.product.getNodeData(node, 'value');
171		var $form = $node.closest('form');
172		var form = $form.get(0);
173		var meta;
174		var kind_id;
175		var product_id;
176		var keys = {};
177
178		if (kinds && $.type(paramName) !== 'undefined' && $.type(paramValue) !== 'undefined' && form) {
179
180			meta = $form.find('input[name=meta]').val();
181
182			product_id = $form.find('input[name=product_id]').val();
183
184			$form.find('[name=submit]').prop('disabled', true);
185
186			$form.find('select.shop2-cf>option, li.shop2-cf, li.shop2-color-ext-selected, ul.shop2-color-ext-list>li').each(function() {
187				var name = $(this).data('name');
188				if (name) {
189					keys[name] = true;
190				}
191			});
192
193			kind_id = shop2.product.findKindId(product_id, kinds, paramName, paramValue, meta, keys);
194
195			if (shop2.mode == 'product') {
196
197				if (shop2.uri) {
198					document.location = shop2.uri + '/product/' + kind_id;
199				} else {
200					document.location = document.location.href.replace(/\/product\/.+/, '/product/' + kind_id);
201				}
202
203			} else {
204
205				shop2.product.getProductListItem(product_id, kind_id, function(d, status) {
206					var cont, newCont, body;
207					if (status === 'success') {
208
209						cont = $node.closest('.shop2-product-item');
210						cont.hide();
211
212						body = $.trim(d.data.body);
213						newCont = $(body).insertBefore(cont);
214
215						cont.remove();
216						
217						setTimeout(function(){
218						
219							$('#shop2-tooltip').hide();
220							
221						}, 2000);
222						
223
224						shop2.queue.heights();
225						
226						$('.shop2-cart-table__item, .shop2-product-item, .shop2-product').each(function() {
227							var $this = $(this);
228							var $amountWrap = $this.find('.shop2-product-amount');
229							var $input = $amountWrap.find('input[type="text"]');
230							var $buttons = $amountWrap.find('button');
231							var $minus = $amountWrap.find('button.amount-minus');
232							var $plus = $amountWrap.find('button.amount-plus');
233							var inputVal = +$input.val();
234			                var $amountMin         = $amountWrap.find('input[type="text"]').data('min');
235							
236							if (inputVal==$amountMin) {
237								$minus.attr('disabled', 'disabled');
238							}
239							
240							$buttons.on('click', function(){
241								var parent = $(this).parent();
242								var input = parent.find('input');
243
244								setTimeout(function(){
245									var inputVal = +input.val();
246									
247									if (inputVal==$amountMin) {
248										$minus.attr('disabled', 'disabled');
249									} else {
250										$minus.removeAttr('disabled');
251									}
252								}, 100);
253							});
254							
255							$input.on('change', function(e) {
256					        	var curVal = +$(this).val();
257					        	
258					        	if (curVal < $amountMin) {
259					        		$(this).val($amountMin);
260					        	} else if (curVal == $amountMin) {
261					        		$minus.attr('disabled', 'disabled');
262					        	} else if (curVal > $amountMin) {
263					        		$minus.removeAttr('disabled');
264					        	}
265					        });
266						});
267					}
268
269				});
270
271			}
272		}
273
274	};
275
276	$.on('select.shop2-cf', {
277		change: function() {
278			shop2.product._reload(this);
279		}
280	});
281
282	$.on('li.shop2-cf:not(.active-color, .active-texture)', {
283		click: function() {
284			shop2.product._reload(this);
285		}
286	});
287
288},
289
290shop2.queue.filter = function() {
291
292    var wrap = $('.shop2-filter'),
293        result = $('.result');
294
295    shop2.filter.init();
296
297    var handle;
298
299    shop2.on('afterGetSearchMatches', function (d, status) {
300
301        if (d.data.total_found === 0) {
302
303            result.addClass('no-result');
304        } else {
305            result.removeClass('no-result');
306        }
307        
308        if (shop2.facets.enabled) {
309            shop2.facets.set('filter');
310        }
311
312        $('#filter-result').html(d.data.total_found);
313
314        result.removeClass('hide');
315    });
316
317    wrap.find('.param-val').on('click', function(e) {
318        var $this = $(this),
319            name = $this.data('name'),
320            value = $this.data('value');
321
322        e.preventDefault();
323
324        $this.toggleClass('active-val');
325        shop2.filter.toggle(name, value);
326        shop2.filter.count();
327
328		var x = $('.table-filter-param').offset().top;
329		var y = $(this).offset().top;
330		var offsetTop = y - x;
331
332		$('.result-popup').css({
333			'top': offsetTop,
334			'visibility': 'visible',
335			'opacity': '1',
336			'display': 'block'
337		});
338    });
339
340    wrap.find('select').on('change', function() {
341        var $this = $(this),
342            name = this.name,
343            value = $this.val();
344
345        shop2.filter.add(name, value);
346        shop2.filter.count();
347
348        var offsetTop = $(this).parent().position().top;
349
350		$('.result-popup').css({
351			'top': offsetTop,
352			'visibility': 'visible',
353			'opacity': '1',
354			'display': 'block'
355		});
356    });
357
358    wrap.find('input:text').keyup(function() {
359        var $this = $(this),
360            name = $this.attr('name');
361
362        $.s3throttle('filter: ' + name, function() {
363            var value = $this.val();
364
365            shop2.filter.add(name, value);
366            shop2.filter.count();
367        }, 500);
368
369
370      	var offsetTop = $(this).parent().position().top;
371
372		$('.result-popup').css({
373			'top': offsetTop,
374			'visibility': 'visible',
375			'opacity': '1',
376			'display': 'block'
377		});
378
379    });
380    wrap.find('.inputRangeSlider').on('slide', function(e){
381        var $this = $(this),
382            $parent = $this.closest('.rangeSliderWrapper'),
383            $input = $parent.find('input:text');
384        
385        $.each($input, function(i, elem) {
386            var name = $(elem).attr('name');
387
388            $.s3throttle('filter: ' + name, function() {
389                var value = $(elem).val();
390        
391                shop2.filter.add(name, value);
392                shop2.filter.count();
393
394                var offsetTop = $parent.position().top;
395
396				$('.result-popup').css({
397					'top': offsetTop,
398					'visibility': 'visible',
399					'opacity': '1',
400					'display': 'block'
401				});
402
403            }, 500);
404        });
405    });
406
407    wrap.find('.shop2-filter-go').on('click', function(e) {
408        e.preventDefault();
409        shop2.filter.go();
410    });
411},
412
413shop2.queue.colorPopup = function() {
414	var handle;
415
416	$(document).on('click', '.shop2-color-ext-list li', function() {
417		var caption = $(this);
418		var wrap = caption.closest('.shop2-color-ext-popup');
419		var ul = wrap.find('.shop2-color-ext-list');
420		var offset = caption.offset();
421		var $this = $(this);
422		var data = $this.data();
423		var input = $this.parent().find('input.additional-cart-params');
424		var isSelected = $this.is('.shop2-color-ext-selected');
425
426		colors = ul.children('li');
427
428		if (typeof data.kinds !== 'undefined' || input.length) {
429			$this.addClass('shop2-color-ext-selected').siblings().removeClass('shop2-color-ext-selected');
430
431			if (input.length) {
432				input.val(data.value);
433			} else {
434				if (!isSelected) {
435					shop2.product._reload(this);
436				}
437			}
438
439		} else {
440			var index = $this.index();
441			
442			colors.eq(index).toggleClass('shop2-color-ext-selected');
443			shop2.filter.toggle(data.name, data.value);
444			shop2.filter.count();
445
446			var offsetTop = $(this).position().top;
447
448			$('.result-popup').css({
449				'top': offsetTop,
450				'visibility': 'visible',
451				'opacity': '1',
452				'display': 'block'
453			});
454
455		}
456		return false;
457	});
458},
459
460shop2.queue.cart = function() {
461
462    var updateBtn = $('.shop2-cart-update'),
463        cartTable = $('.shop2-cart-table'),
464        form = $('#shop2-cart');
465
466    shop2.on('afterCartRemoveItem, afterCartUpdate', function() {
467        document.location.reload();
468    });
469
470    function updateBtnShow() {
471        updateBtn.addClass('show');
472        $('.cart-total__order').hide();
473    }
474
475    cartTable.find('.shop2-cart-table__item input:text').on('keypress', function(e) {
476        if (e.keyCode == 13) {
477            shop2.cart.update(form);
478        } else {
479            updateBtnShow();
480        }
481    });
482
483    cartTable.find('.amount-minus, .amount-plus').on('click', updateBtnShow);
484
485    updateBtn.on('click', function(e) {
486        e.preventDefault();
487        shop2.cart.update(form);
488        return false;
489    });
490
491
492    $('.cart-delete a').on('click', function(e) {
493        var $this = $(this),
494            id = $this.data('id');
495
496        e.preventDefault();
497
498        shop2.cart.remove(id);
499
500    });
501
502},
503
504shop2.queue.product = function() {
505
506      shop2.product._reload = function(node) {
507        var $node = $(node);
508        var kinds = shop2.product.getNodeData(node, 'kinds', true);
509        var paramName = shop2.product.getNodeData(node, 'name');
510        var paramValue = shop2.product.getNodeData(node, 'value');
511        var $form = $node.closest('form');
512        var form = $form.get(0);
513        var meta;
514        var kind_id;
515        var product_id;
516        var keys = {};
517        var params = {};
518        var is_param_select = false;
519        if (kinds && $.type(paramName) !== 'undefined' && $.type(paramValue) !== 'undefined' && form) {
520          meta = $form.find('input[name=meta]').val();
521          product_id = $form.find('input[name=product_id]').val();
522          $form.find('[name=submit]').prop('disabled', true);
523          $form.find('select.shop2-cf>option, li.shop2-cf, li.shop2-color-ext-selected, ul.shop2-color-ext-list>li').each(function() {
524            var name = $(this).data('name');
525            if (name) {
526              keys[name] = true;
527            }
528          });
529          kind_id = shop2.product.findKindId(product_id, kinds, paramName, paramValue, meta, keys);
530          if (!kind_id) {
531              kind_id = $form.find('[name=kind_id]').val();
532              is_param_select = true;
533          }
534          // select
535            $form.find('.js-calc-custom-fields.additional-cart-params').each(function() {
536                var ref_code = $(this).attr('name');
537                params[ref_code] = $(this).find('option:selected').data('item-id');
538            });
539          // colore ref
540            $form.find('.js-calc-custom-fields.shop2-color-ext-selected').each(function() {
541                var ref_code = $(this).data('name');
542                params[ref_code] = $(this).data('item-id');
543            });
544          // Selected params
545          if (is_param_select) {
546              shop2.product.getProductListItem(product_id, kind_id, function (d, status) {
547                  if (status === 'success') {
548                      var body = $.trim(d.data.body);
549                      var product_price = $(".product-price", body).html();
550                      var product_actions = $(".shop2-product-actions", body).html();
551                      $form.find('.product-price').html(product_price);
552                      $form.find('.shop2-product-actions').html(product_actions);
553                      shop2.trigger('afterProductReloaded');
554                      shop2.queue.heights();
555                  }
556              }, params);
557          } else {
558              if (shop2.mode === 'product') {
559                  if (shop2.uri) {
560                      document.location = shop2.uri + '/product/' + kind_id;
561                  } else {
562                      document.location = document.location.href.replace(/\/product\/.+/, '/product/' + kind_id);
563                  }
564              } else {
565                  shop2.product.getProductListItem(product_id, kind_id, function (d, status) {
566                      var cont, newCont, body;
567                      if (status === 'success') {
568                          shop2.trigger('afterProductReloaded');
569                          cont = $node.closest('.shop2-product-item');
570                          cont.hide();
571                          body = $.trim(d.data.body);
572                          newCont = $(body).insertBefore(cont);
573                          cont.remove();
574                          shop2.queue.heights();
575                          
576                        if (shop2.my.gr_img_lazyload) {
577						    var myLazyLoad = new LazyLoad();
578						        myLazyLoad.update();
579						}
580                      }
581                  }, params);
582              }
583          }
584        }
585      };
586
587      $.on('select.shop2-cf', {
588        change: function() {
589          shop2.product._reload(this);
590        }
591      });
592
593      $.on('li.shop2-cf:not(.active-color, .active-texture)', {
594        click: function() {
595          shop2.product._reload(this);
596        }
597      });
598
599      $.on('span.shop2-path-show-folders', {
600        click: function(e) {
601          e.preventDefault();
602          $(this).next().show();
603          $(this).hide();
604        }
605      });
606
607 },
608
609(function($, myObject) {
610
611	function fixImg(element, time) {
612		var $this = this;
613		var windowTimeout;
614		$this.time = time || 700;
615		$this.element = element;
616		$this.imgMethod = $(element).data('method') || 'cover';
617
618		$($this.element).removeAttr('style').bgdSize($this.imgMethod);
619
620		window.addEventListener('resize', function(){
621			if (windowTimeout !== undefined) {
622	            clearTimeout(windowTimeout);
623	        }
624
625			windowTimeout = setTimeout(function(){
626				$($this.element).removeAttr('style').bgdSize($this.imgMethod);
627			}, time);
628		});
629	};
630	
631    $.fn.mgStyler = function() {
632		return this.each(function() {
633			var $this      	  = $(this),
634				isChecked  	  = $this.is(':checked'),
635				isDisabled 	  = $this.is(':disabled'),
636				isRadio 	  = $this.is(':radio'),
637				jqLabel    	  = $this.parent('label')
638				radioClass 	  = "mg-styler-label--radio",
639				checkboxClass = "mg-styler-label--checkbox",
640				labelClass    = isRadio ? radioClass : checkboxClass;
641				
642			if (jqLabel.length) {
643				jqLabel.addClass(labelClass);
644			} else {
645				jqLabel = $this
646							.wrap('<label></label>')
647							.parent('label')
648							.addClass(labelClass);
649			}
650			
651			jqLabel.toggleClass('disabled', isDisabled);
652			
653			jqLabel
654				.on('click.mgStyler', function(e){
655					toggle($(this));
656					e.preventDefault();
657				});
658
659			if (isChecked) {
660				jqLabel.addClass('checked');
661			}
662
663			function toggle(jqInput) {
664				if ( jqInput.find('input').is(':radio') ) {
665					var radioGroup = jqInput.find('input').attr('name');
666					$('input[name="' + radioGroup + '"]').closest('.' + radioClass).removeClass('checked');
667					
668					jqInput.addClass('checked').find('input[type=radio]').prop('checked', true);
669				} else {
670					jqInput.toggleClass('checked').find('input[type=checkbox]').prop('checked', !jqInput.find('input[type=checkbox]').prop('checked'));
671				}
672			}
673		});
674	}; /*Чекбоксы и радиокнопки*/
675
676	function setEqualHeight(columns) {
677	    var tallestcolumn = 0;
678	    columns.removeAttr('style');
679	    columns.each(function(){
680	        currentHeight = $(this).height();
681	            if(currentHeight > tallestcolumn) {
682	                tallestcolumn = currentHeight;
683	            }
684	        }
685	    );
686	    columns.height(tallestcolumn);
687	}; /*Выравнивание высоты*/
688
689	function resizeController() {
690		var $win = $(window),
691			winWidth = window.innerWidth,
692			range = [],
693			func = [],
694			toggleState = [undefined, undefined];
695
696		if (!!arguments.length) {
697			for (var i = 0; i <= arguments.length-1; i++) {
698				
699				if ($.isArray(arguments[i])) {
700					range = arguments[i];
701				} else if ($.isNumeric(arguments[i])) {
702					range.push(arguments[i]);
703				} else if ($.isFunction(arguments[i])) {
704					func.push(arguments[i]);
705				} 
706			};
707		}
708
709		$win.resize(function(event) {
710			winWidth = window.innerWidth;
711			
712			if (range.length > 1) {
713				if (winWidth >= range[0] && winWidth <= range[range.length-1] && typeof toggleState[0] === "undefined") {
714					func[0]();
715					toggleState[0] = true;
716					toggleState[1] = undefined;												
717				} else if ((winWidth < range[0] || winWidth > range[range.length-1]) && typeof toggleState[1] === "undefined") {						
718					toggleState[0] = undefined;
719					toggleState[1] = true;
720
721					if ($.isFunction(func[1])) {
722						func[1]();
723					}
724				}
725			} else if (range.length == 1) {
726				if (winWidth <= range[0] && typeof toggleState[0] === "undefined") {
727					func[0]();
728					toggleState[0] = true;
729					toggleState[1] = undefined;
730				} else if (winWidth > range[0] && typeof toggleState[1] === "undefined") {
731					toggleState[0] = undefined;
732					toggleState[1] = true;
733
734					if ($.isFunction(func[1])) {
735						func[1]();
736					}
737				}
738			}
739		}).trigger('resize');
740	}; /*Для проверки на ресайз*/
741
742	var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
743		isApple = /iPod|iPad|iPhone/i.test(navigator.userAgent),
744		$doc = $(document),
745		$win = $(window),
746		$html = $(document.documentElement);
747
748	if (document.location.search.indexOf('mobile') != -1) {isMobile = true};
749		
750	var shop2_gr = {
751			queue: {},
752			methods : {},
753			init: function() {
754
755				$(function() {
756
757					var queue = shop2_gr.queue;
758					
759
760					if (isMobile) $html.addClass('mobile');
761
762					$.each(queue, function(method) {
763						var f = queue[method];
764						if ($.isFunction(f)) {
765							f();
766						}
767					});
768					
769				});
770
771			}
772	};
773
774
775	shop2_gr.queue = {
776	
777		ajaxRequestsComplete: function() {
778
779            shop2.on('afterProductReloaded', function(){
780                
781                setTimeout(function(){
782                    
783                    $('#shop2-tooltip').hide();
784
785                });
786            });
787
788        }, /*Обновление скриптов при аякс-запросах*/
789
790		burgerBlock: function() {
791
792				$('.catalogue-menu').on('click', function() {
793					if ($(window).width()<1261) {
794						$(this).toggleClass('close');
795						$('.burger-block').toggleClass('opened');
796						$html.toggleClass('overflowHidden');
797					};
798				});
799
800				$('.burger-block__ico').on('click', function(){
801					$html.removeClass('overflowHidden');
802					$('.burger-block').removeClass('opened');
803				});
804
805			
806			
807
808		},
809
810
811		cabinet: function(){
812			// var $loginForm = $('.for-js-append').removeClass().addClass('mob-login');
813			
814			// $loginForm.appendTo('.cabinet-block__body');
815
816			// $('.burger-block__cabinet').on('click', function() {
817			// 	$(this).toggleClass('close');
818			// 	$('.cabinet-block').toggleClass('opened');
819			// 	$html.toggleClass('overflowHidden');
820			// });
821			
822			// $('.cabinet-block__back').on('click', function(){
823			// 	$html.removeClass('overflowHidden');
824			// 	$('.cabinet-block').removeClass('opened');
825			// });
826			
827			
828
829			resizeController([0, 1023], function() {
830				$('.site-header__bottom__wrap').append($('.login__wrap').addClass('appended'));
831			});
832
833			resizeController([1024, Infinity], function() {
834				$('.login').append($('.login__wrap').removeClass('appended'));
835			});
836				
837		},
838
839
840		catalogueMenu: function(){
841		
842			$('.menu .menu__inner > li').each(function(){
843				if (!$(this).find('ul').length) {
844					$(this).removeClass();
845				};
846			});
847		
848			if (isMobile) {
849				$('.catalogue-menu .catalogue-menu__inner li.has-child > a').one('click', false);
850				$('.menu .menu__inner li.has-child > a').one('click', false);
851			}
852
853			var $ctm = $('.catalogue-menu__inner').clone().removeClass().addClass('mob-catalog');
854			var $menuSi = $('.menu__inner').clone().removeClass().addClass('mob-menu');
855
856			$ctm.appendTo('.burger-block__folders-list');
857			$menuSi.appendTo('.burger-block__navigation');			
858
859			var $wrapCatMenu = $('.catalogue-menu');
860
861			$wrapCatMenu.find('.catalogue-menu__title').on('click', function() {
862				if ($(window).width()>1260) {
863					$(this).next().toggleClass('active');
864				}
865			});
866			
867            $('.catalogue-menu ul ul').parent().each(function() {
868	            var o = $(this);
869	            var s = o.find('>ul');
870	            var l = o.parents('ul').length;
871	            var k = false;
872	            o.hover(
873	                function() {
874	                    o.find('>a').attr('class','active');
875	                    for (i=$('ul.menu__inner ul').length; i>=0; i--){
876	                        o.parent().find('>li').not(o).find('ul').eq(i).hide();
877	                    }
878	                    k = true;
879
880	                    s.show();
881	                },
882	                function() {
883	                    o.find('>a').attr('class','normal');
884	                    k = false;
885	                    window.setTimeout(function() {
886	                        if (!k) s.hide();                           
887	                    }, 250);
888	                }
889	            );
890	        });		
891					
892					
893					
894					
895			var $li = $('.catalogue-menu__inner > li');
896			var maxHeight = 450;
897			var countHeight = 0;
898		
899			$li.each(function() {
900				
901				countHeight += $(this).height();
902		
903				if (countHeight>=maxHeight) {
904					$(this).addClass('hide_item');
905					$('.catalogue-menu__btn').show();
906				} else {
907					$('.catalogue-menu__btn').hide();	
908				}
909		
910				return countHeight;
911			});
912			
913			$('.catalogue-menu__btn').on('click', function(){
914				if ($(this).hasClass('active')) {
915					$('.catalogue-menu__inner > li.hide_item').hide();
916					$(this).removeClass('active').text('Еще категории');
917				} else {
918					$('.catalogue-menu__inner > li.hide_item').show();
919					$(this).addClass('active').text('Скрыть');
920				}
921			});
922
923
924		},
925
926
927		topMenu: function(){
928			
929			setTimeout(function(){
930			
931				$('.menu__inner ').flexMenu({
932				     linkText:'...',
933	                cutoff: 0
934				}); 
935				
936			}, 250);
937			var waSlideLang = ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') ? 'back' : 'Назад';
938
939			var $forward = 0,
940			    $folderWaslide = $('.burger-block');
941		
942			function arrVisible(cnt) {
943				if (cnt > 0) {
944					$('.popup-folders__list > li > ul > .waSlideMenu-back a').css('display', 'block');
945					$('.burger-block__folders-title').hide();
946				} else {
947					$('.popup-folders__list > li > ul > .waSlideMenu-back a').css('display', 'none');
948					$('.burger-block__folders-title').show();
949				}
950			}
951
952
953			$('.burger-block__folders-list').waSlideMenu({
954				backOnTop: true,
955				scrollToTopSpeed: 100,
956				minHeightMenu: 0,
957				slideSpeed: 100,
958				backLinkContent: waSlideLang,
959			    
960			    onSlideForward: function() {
961					if ( $('.burger-block').hasClass('opened') ) {
962						$forward += 1;
963						arrVisible($forward);
964					}
965				},
966
967				onSlideBack: function() {
968					if ( $('.burger-block').hasClass('opened') ) {
969						$forward -= 1;
970						arrVisible($forward);
971					}
972				}
973			});
974
975			$('ul.menu__inner ul').parent().each(function() {
976	            var o = $(this);
977	            var s = o.find('>ul');
978	            var l = o.parents('ul').length;
979	            var k = false;
980	            o.hover(
981	                function() {
982	                    o.find('>a').attr('class','active');
983	                    for (i=$('ul.menu__inner ul').length; i>=0; i--){
984	                        o.parent().find('>li').not(o).find('ul').eq(i).hide();
985	                    }
986	                    k = true;
987	                    var p = o.position();
988	                    var ts, ls;
989	                    if (l == 1) {
990	                        ts =  p.top + o.height();
991	                        ls = p.left;
992	                    } else {
993	                        ts = p.top;
994	                        ls = p.left + o.width();
995	                    }
996	                    s.css({
997	                        top: ts,
998	                        left: ls
999	                    }).show();
1000	                    
1001	                    if ($(document).outerWidth()>$(window).outerWidth()) {
1002	                    	o.find('>ul').addClass('right_level');
1003	                    };
1004	                },
1005	                function() {
1006	                    o.find('>a').attr('class','normal');
1007	                    k = false;
1008	                    window.setTimeout(function() {
1009	                        if (!k) s.hide();    
1010	                        o.find('>ul').removeClass('right_level');     
1011	                    }, 600);
1012	                }
1013	            );
1014	        });			
1015
1016		},
1017
1018		bottomMenu: function(){
1019			
1020			$('.menu-bottom .has-child a span , .menu-bottom-left .has-child a span, .mob-menu .has-child a span').on('click', function(e){
1021				e.preventDefault();
1022				$(this).parent().toggleClass('active');
1023				$(this).parent().siblings("ul").slideToggle(200);
1024			});
1025			
1026		},
1027		formInBlock: function(){
1028
1029			// console.log('form')
1030
1031		},
1032
1033
1034		topSlider: function(){
1035
1036			$('.top-slider__inner').slick({
1037			  slidesToShow: 1,
1038			  slidesToScroll: 1
1039			});
1040
1041		},
1042
1043
1044		stocksSlider: function(){
1045			if ($('.stocks__items .stocks__item').length > 1) {
1046				$('.stocks__items').slick({
1047				  slidesToShow: 1,
1048				  slidesToScroll: 1,
1049				  dots: true,
1050				  adaptiveHeight: true
1051				});
1052			}
1053		},
1054
1055
1056
1057		artReviews: function(){
1058			if ($('.art_reviews__items .art_reviews__item').length > 1) {
1059				$('.art_reviews__items').slick({
1060				  slidesToShow: 1,
1061				  slidesToScroll: 1,
1062				  dots: true
1063				});
1064			}
1065		},
1066
1067
1068		mainBlocksWrapper: function(){
1069
1070			var	ThumbWidth = 18.8,
1071				ThumbMargin = 1.52;
1072
1073			if ($(window).width() <= 1150) {
1074				ThumbWidth = 23.89705,
1075				ThumbMargin = 1.6;
1076			}
1077			if ($(window).width() <= 800) {
1078				ThumbWidth = 30.67,
1079				ThumbMargin = 4.1;
1080			} 
1081			if ($(window).width() <= 640) {
1082				ThumbWidth = 32.5,
1083				ThumbMargin = 1.4;
1084			} 			
1085			if ($(window).width() <= 560) {
1086				ThumbWidth = 49.4,
1087				ThumbMargin = 1.49;
1088			} 			
1089			// console.log(ThumbWidth);
1090			
1091			var wrapperWidth = $('.wrap').outerWidth(true),
1092			collectionThumbWidth = Math.floor((wrapperWidth/100)*ThumbWidth),
1093			collectionThumbMargin = Math.floor((wrapperWidth/100)*ThumbMargin);
1094
1095			$('.main-blocks-wrapper').each(function() {
1096				
1097				var $frame  = $(this).find('.frame');
1098				var $slidee = $frame.children('.wrap').eq(0);
1099				var $wrap   = $frame.parent();
1100				
1101				var $slideWr = $(this).find('.wrap'),
1102				    $slideItems = $frame.find('.shop2-product-item');
1103				    
1104				resizeController([550, 789], function() {
1105					if($slideItems.length <= 2){
1106						$slideWr.find('.scrollbar, .items-switcher').hide();
1107					}
1108				});
1109				    
1110				resizeController([790, 1039], function() {
1111					if($slideItems.length <= 3){
1112						$slideWr.find('.scrollbar, .items-switcher').hide();
1113					}
1114				});
1115				    
1116				resizeController([1040, 1289], function() {
1117					if($slideItems.length <= 4){
1118						$slideWr.find('.scrollbar, .items-switcher').hide();
1119					}
1120				});
1121				    
1122				resizeController([1290, 1539], function() {
1123					if($slideItems.length <= 5){
1124						$slideWr.find('.scrollbar, .items-switcher').hide();
1125					}
1126				});
1127				    
1128				resizeController([1540, 1759], function() {
1129					if($slideItems.length <= 6){
1130						$slideWr.find('.scrollbar, .items-switcher').hide();
1131					}
1132				});
1133				    
1134				resizeController([1760, Infinity], function() {
1135					if($slideItems.length <= 7){
1136						$slideWr.find('.scrollbar, .items-switcher').hide();
1137					}
1138				});
1139				
1140				$(this).find('.product-item-thumb').css({
1141					// 'width': collectionThumbWidth,
1142					// 'marginRight': collectionThumbMargin
1143				});		
1144				
1145				$frame.sly({
1146				    horizontal: 1,
1147				    itemNav: 'basic',
1148				    smart: 1,
1149				    mouseDragging: 1,
1150				    touchDragging: 1,
1151				    releaseSwing: 1,
1152				    startAt: 0,
1153				    scrollBar: $wrap.find('.scrollbar'),
1154				    pagesBar: $wrap.find('.pages'),
1155				    activatePageOn: 'click',
1156				    speed: 500,
1157				    elasticBounds: 2,
1158				    dragHandle: 1,
1159				    scrollSource: 0,
1160				    dynamicHandle: 1,
1161					pauseOnHover: 1,
1162				    prevPage: $wrap.find('.prev'),
1163				    nextPage: $wrap.find('.next')
1164				});
1165				setTimeout(function() {
1166					$frame.sly('reload');
1167				}, 400);
1168				var itemsSwitcher = $(this).find('.items-switcher'),
1169					mainBlockTitle = $(this).find('.shop2-main-header');
1170					itemsSwitcher.appendTo(mainBlockTitle);
1171			});
1172
1173		},
1174
1175
1176		shopViews: function() {
1177
1178			$('.view-shop2__btn').on('click', function(){
1179				$('.view-shop2__wrap').stop();
1180				$('.view-shop2__wrap').toggleClass('active');
1181			});
1182			
1183			$('.view-shop2__inner .view-param').on('click', function(){
1184				$('.view-shop2__wrap').stop();
1185				$('.view-shop2__wrap').removeClass('active');
1186			});
1187
1188			var $btnThumbs = $('.view-shop2 .thumbs'),
1189				$btnSimple = $('.view-shop2 .simple'),
1190				$btnPrice = $('.view-shop2 .pricelist'),
1191				$lotsWrap = $('.product-list'),
1192				$products = $('.product-item');
1193
1194			function thumbsLots() {
1195				$btnThumbs.addClass('active-view');
1196				$btnSimple.removeClass('active-view');
1197				$btnPrice.removeClass('active-view');
1198
1199
1200				$products.each(function() {
1201
1202					var $this = $(this);
1203				
1204					var $productBottomRight = $this.find('.product-item__bottom-right');
1205					var $actions = $this.find('.shop2-product-actions');
1206
1207					$productBottomRight.prepend($actions);
1208					
1209				
1210					if (shop2.my.gr_product_info_head_hide == true) {
1211						var $productItemTop = $this.find('.product-item__top-copy');
1212						var $productName = $this.find('.product-name');
1213	
1214						$productItemTop.prepend($productName);
1215					}
1216
1217				});
1218				
1219
1220				$lotsWrap.addClass('product-list-thumbs');
1221				$lotsWrap.removeClass('product-list-simple');
1222				$lotsWrap.removeClass('product-list-price');
1223			}
1224
1225			function simpleLots() {
1226				$btnSimple.addClass('active-view');
1227				$btnThumbs.removeClass('active-view');
1228				$btnPrice.removeClass('active-view');
1229
1230				$products.each(function() {
1231
1232					var $this = $(this);
1233
1234					var $productBottomRight = $this.find('.product-item__bottom-right');
1235					var $actions = $this.find('.shop2-product-actions');
1236
1237					$productBottomRight.prepend($actions);
1238					
1239				
1240					if (shop2.my.gr_product_info_head_hide == true) {
1241						var $productInfoHead = $this.find('.product-info__head');
1242						var $productName = $this.find('.product-name');
1243	
1244						$productInfoHead.prepend($productName);
1245					}
1246				});
1247
1248				$lotsWrap.addClass('product-list-simple');
1249				$lotsWrap.removeClass('product-list-thumbs');
1250				$lotsWrap.removeClass('product-list-price');
1251			}
1252
1253			function priceLots() {
1254				$btnPrice.addClass('active-view');
1255				$btnThumbs.removeClass('active-view');
1256				$btnSimple.removeClass('active-view');
1257
1258
1259				$products.each(function() {
1260					var $this = $(this);
1261
1262					var $productLabelsLeft = $this.find('.product-info__labels_left');
1263					var $actions = $this.find('.shop2-product-actions');
1264
1265					$productLabelsLeft.append($actions);
1266					
1267				
1268					if (shop2.my.gr_product_info_head_hide == true) {
1269						var $productInfoHead = $this.find('.product-info__head');
1270						var $productName = $this.find('.product-name');
1271	
1272						$productInfoHead.prepend($productName);
1273					}
1274
1275				});
1276
1277				$lotsWrap.addClass('product-list-price');
1278				$lotsWrap.removeClass('product-list-thumbs');
1279				$lotsWrap.removeClass('product-list-simple');
1280			}
1281
1282			$btnThumbs.on('click', function(e) {
1283				e.preventDefault();
1284				thumbsLots();
1285
1286				eraseCookie('simple');
1287				eraseCookie('price');
1288				createCookie('thumbs', 1, 1);
1289				return false;
1290				
1291			});
1292
1293			$btnSimple.on('click', function(e) {
1294				e.preventDefault();
1295				simpleLots();
1296
1297				eraseCookie('price');
1298				eraseCookie('thumbs');
1299				createCookie('simple', 1, 1);
1300				return false;
1301			});
1302
1303			$btnPrice.on('click', function(e) {
1304				e.preventDefault();
1305				priceLots();
1306
1307				eraseCookie('simple');
1308				eraseCookie('thumbs');
1309				createCookie('price', 1, 1);
1310				return false;
1311			});
1312	
1313
1314			function viewLots() {
1315				
1316				if (readCookie('thumbs')) {
1317					thumbsLots();
1318				} else if (readCookie('simple')) {
1319					simpleLots();
1320				} else if (readCookie('price')) {
1321					priceLots();
1322				}
1323				
1324				
1325				if (shop2.mode == 'main' && $('.main-blocks-wrapper').length>0) {
1326					$('.product-list').removeClass('product-list-price').removeClass('product-list-simple').addClass('product-list-thumbs');
1327				}
1328			}
1329			
1330			if (shop2.mode == 'main' && $('.main-blocks-wrapper').length>0) {
1331				$('.product-list').removeClass('product-list-price').removeClass('product-list-simple').addClass('product-list-thumbs');
1332			}
1333			
1334			var wTimeOut;
1335			$(window).on('resize', function(){
1336				if (wTimeOut !== undefined) {
1337					clearTimeout(wTimeOut);
1338				}
1339				
1340				wTimeOut = setTimeout(function(){
1341					viewLots();	
1342				}, 350);
1343			});
1344
1345		},
1346
1347
1348		sortingBlock: function(){
1349
1350			if ($('.cart-page .cart-total').length>0) {
1351			    var a = document.querySelector('.cart-page .cart-total'),
1352			        b = null,
1353			        P = 0; // если ноль заменить на число, то блок будет прилипать до того, как верхний край окна браузера дойдёт до верхнего края элемента. Может быть отрицательным числом
1354			    window.addEventListener('scroll', Ascroll, false);
1355			    document.body.addEventListener('scroll', Ascroll, false);
1356
1357			    function Ascroll() {
1358			        if (b == null) {
1359			            var Sa = getComputedStyle(a, ''),
1360			                s = '';
1361			            for (var i = 0; i < Sa.length; i++) {
1362			                if (Sa[i].indexOf('overflow') == 0 || Sa[i].indexOf('padding') == 0 || Sa[i].indexOf('border') == 0 || Sa[i].indexOf('outline') == 0 || Sa[i].indexOf('box-shadow') == 0 || Sa[i].indexOf('background') == 0) {
1363			                    s += Sa[i] + ': ' + Sa.getPropertyValue(Sa[i]) + '; '
1364			                }
1365			            }
1366			            b = document.createElement('div');
1367			            b.style.cssText = s + ' box-sizing: border-box; width: ' + a.offsetWidth + 'px;';
1368			            a.insertBefore(b, a.firstChild);
1369			            var l = a.childNodes.length;
1370			            for (var i = 1; i < l; i++) {
1371			                b.appendChild(a.childNodes[1]);
1372			            }
1373			            a.style.height = b.getBoundingClientRect().height + 'px';
1374			            a.style.padding = '0';
1375			            a.style.border = '0';
1376			        }
1377			        var Ra = a.getBoundingClientRect(),
1378			            R = Math.round(Ra.top + b.getBoundingClientRect().height - document.querySelector('.cart-back-btn').getBoundingClientRect().top + 54); // селектор блока, при достижении верхнего края которого нужно открепить прилипающий элемент;  Math.round() только для IE; если ноль заменить на число, то блок будет прилипать до того, как нижний край элемента дойдёт до футера
1379			        if ((Ra.top - P) <= 0) {
1380			            if ((Ra.top - P) <= R) {
1381			                b.className = 'stop';
1382			                b.style.top = -R + 'px';
1383			            } else {
1384			                b.className = 'sticky';
1385			                b.style.top = P + 'px';
1386			            }
1387			        } else {
1388			            b.className = '';
1389			            b.style.top = '';
1390			        }
1391			        window.addEventListener('resize', function() {
1392			            a.children[0].style.width = getComputedStyle(a, '').width
1393			        }, false);
1394			    }
1395			};
1396
1397		},
1398
1399
1400		filterBlock: function(){
1401
1402			var inputRangeMax = parseInt($('.shop2-block.search-form input.big').data('max'));
1403
1404
1405
1406			resizeController(1260, function() {
1407				$('.re-filter-block').append($('.filter-block'));
1408			}, function() {
1409				$('.mode-folder__left').append($('.filter-block'));
1410			});
1411
1412			$('.filter-popup-btn').on('click', function(){
1413				$('.filter-block, .site__container').addClass('active');
1414			});
1415
1416			$('.filter-block__title').on('click', function(){
1417				$('.filter-block, .site__container').removeClass('active');
1418			});
1419
1420			$('.sorting-block__body').on('click', function(){
1421				$('.sorting-block__inner, .sorting-block__popup').stop();
1422				$('.sorting-block__popup').slideToggle(150);
1423				$('.sorting-block__inner').toggleClass('active');
1424			});
1425
1426			// $('.view-shop2__btn').on('click', function(){
1427			// 	$('.view-shop2__wrap').stop();
1428			// 	$('.view-shop2__wrap').toggleClass('active');
1429			// });
1430
1431		    $('.filter-block select').styler();
1432		    
1433		    $.ajaxSetup({complete: function(){
1434		    	
1435				$('.filter-block select').styler();
1436				
1437		    }});
1438
1439		    $('.filter-field-title').on('click', function(){
1440                $(this).stop().next().stop();
1441                $(this).toggleClass('active');
1442                $(this).next().slideToggle(150);
1443            });
1444
1445		},
1446
1447		
1448		productCompare: function(){
1449			// $('.product-compare input[type="checkbox"]').mgStyler();
1450		},
1451		
1452		
1453		searchBlock: function(){
1454
1455
1456			var inputRangeMax = parseInt($('.shop2-block.search-form input.big').data('max'));
1457
1458		    $('.inputRangeSlider').each(function(index, el) {
1459
1460		        var $this = $(this),
1461		            $lower = $this.closest('.rangeSliderWrapper').find('.low'),
1462		            $upper = $this.closest('.rangeSliderWrapper').find('.high'),
1463		            maxValue = parseInt($upper.data('max'));
1464		            arr = [0,maxValue];
1465
1466		        var slider = $this.noUiSlider({
1467
1468		            start: [$lower.attr('value'), $upper.attr('value')],
1469		            connect: true,
1470		            behaviour: 'drag-tap',
1471		            format: wNumb({
1472		                decimals: 0
1473		            }),
1474		            range: {
1475		                'min': [ arr[0] ],
1476		                'max': [ arr[1] ]
1477		            }
1478		        });
1479
1480		        slider.Link('lower').to($lower);
1481		        slider.Link('upper').to($upper);
1482
1483		    });
1484		    
1485            
1486
1487		    $('.shop2-block.search-form select').styler({
1488		    	selectPlaceholder: 'Все',
1489				locale: 'en',
1490				locales: {
1491					'en': {
1492						selectPlaceholder: 'All'
1493					}
1494				},
1495			});
1496		    $('.shop2-block.search-form input[type="checkbox"]').mgStyler();
1497		    
1498		    $.ajaxSetup({complete: function(){
1499				$('.shop2-block.search-form select').styler();
1500                $('.shop2-block.search-form input[type="checkbox"]').mgStyler();
1501		    }});
1502
1503
1504			var $block = $('.search__wrapper');
1505			var $details = $('.search-desc');
1506			var $right = $('.search__mobile-click');
1507			var $rightApp = $('.search__mobile');
1508			var $rightBack = $('.close-button__search');
1509
1510			resizeController([0, 1023], function() {
1511				$rightApp.append($block);
1512				$details.show();
1513			});
1514
1515			resizeController([1024, Infinity], function() {
1516				$details.append($block);
1517			});
1518
1519			$right.on('click', function(){
1520
1521				$rightApp.addClass('opened');	
1522				$('body').addClass('overflowHidden');
1523
1524			});
1525
1526			$rightBack.on('click', function(){
1527
1528				$('body').removeClass('overflowHidden');
1529				$rightApp.removeClass('opened');
1530
1531			});
1532
1533            $(document).on('click', '.search-form .row', function(e){
1534				var $rowBody = $(this).find('.row__body-cl');
1535				var $rowTitle = $(this).find('.row-title');
1536
1537				if (e.target.closest('.row__body-cl')) {
1538					return false;
1539				}
1540
1541				$rowTitle.toggleClass('active');
1542				$rowBody.toggleClass('active');
1543				$(this).toggleClass('active');
1544			});
1545		},
1546		
1547		searchSelectColor : function(){
1548			$(document).on('click', '.shop-search-color-select', function(){
1549		        $(this).toggleClass('active');
1550		      });
1551		  
1552		      $(document).on('click', '.shop-search-color-select li', function(){
1553		        var $parent = $(this).parents('.shop-search-color-select');
1554		        var $items = $parent.find('li');
1555		        var $input = $parent.find('input');
1556		        var value = $(this).data('value');
1557		  
1558		        $items.removeClass('shop2-color-ext-selected');
1559		        $(this).addClass('shop2-color-ext-selected');
1560		        $input.val(value);
1561		      });
1562		  
1563		      $(document).on('click', function(e){
1564		          if (!$(e.target).closest('.shop-search-color-select').length) {
1565		            $('.shop-search-color-select').removeClass('active');
1566		          }
1567		      });
1568		},
1569
1570
1571		headRoom: function() {
1572			
1573			if ($(".site-header__bottom").length) {
1574				// grab an element
1575				var myElement = document.querySelector(".site-header__bottom");
1576				// construct an instance of Headroom, passing the element
1577				var headroom  = new Headroom(myElement, {
1578					offset : 80,
1579					tolerance : {
1580				        up : 10,
1581				        down : 0
1582				    },
1583				});
1584				// initialise
1585				headroom.init();
1586			};
1587		},
1588
1589
1590		cartPage: function(){
1591			
1592			// Записывает количество в название товара для формы "купить в один клик" start
1593			
1594			var prouct_name = $('.tpl-anketa__product-name').val();
1595			var amount = $('.shop2-product__btns .shop2-product-amount input[type="text"]').val();
1596			var result = prouct_name + ', количество - ' + amount;
1597			
1598			if (shop2.my.mode_catalog == true) {
1599				$('.tpl-anketa__product-name').val(prouct_name);
1600			} else {
1601				$('.tpl-anketa__product-name').val(result);
1602			}
1603			
1604			$('.bio-click__btn').on('click', function(){
1605				
1606				$('.tpl-anketa__product-name').val('');
1607				
1608				var amount = $('.shop2-product__btns .shop2-product-amount input[type="text"]').val();
1609				var result = prouct_name + ', количество - ' + amount;
1610				
1611				if (shop2.my.mode_catalog == true) {
1612					$('.tpl-anketa__product-name').val(prouct_name);
1613				} else {
1614					$('.tpl-anketa__product-name').val(result);
1615				}
1616					
1617			});
1618			// Записывает количество в название товара для формы "купить в один клик" end
1619			
1620			$('.card-top-block__product, .shop2-product-item, .shop2-product, .cart-amount').each(function() {
1621                var $this         = $(this);
1622                var $amountWrap = $this.find('.shop2-product-amount');
1623                var $input         = $amountWrap.find('input[type="text"]');
1624                var $buttons     = $amountWrap.find('button');
1625                var $minus         = $amountWrap.find('button.amount-minus');
1626                var $plus         = $amountWrap.find('button.amount-plus');
1627                var inputVal     = +$input.val();
1628                var $amountMin         = $amountWrap.find('input[type="text"]').data('min');
1629                
1630                if (inputVal==$amountMin) {
1631                    $minus.attr('disabled', 'disabled');
1632                }
1633                
1634                $buttons.on('click', function(){
1635                    var parent = $(this).parent();
1636                    var input = parent.find('input');
1637
1638                    setTimeout(function(){
1639                        var inputVal = +input.val();
1640                        
1641                        if (inputVal==$amountMin) {
1642                            $minus.attr('disabled', 'disabled');
1643                        } else {
1644                            $minus.removeAttr('disabled');
1645                        }
1646                    }, 100);
1647                });
1648                
1649                $input.on('change', function(e) {
1650                    var curVal = +$(this).val();
1651                    
1652                    if (curVal < $amountMin) {
1653                        $(this).val($amountMin);
1654                    } else if (curVal == $amountMin) {
1655                        $minus.attr('disabled', 'disabled');
1656                    } else if (curVal > $amountMin) {
1657                        $minus.removeAttr('disabled');
1658                    }
1659                });
1660            });
1661
1662
1663			$('.cart-product__params-title').on('click', function(){
1664		    	$(this).toggleClass('opened');
1665
1666		    	if ($(this).hasClass('opened')) {
1667					if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') {
1668						$(this).text('Hide options');
1669					} else {
1670						$(this).text('Скрыть параметры');
1671					}
1672				} else {
1673					if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') {
1674						$(this).text('Show options');
1675					} else {
1676						$(this).text('Показать параметры')
1677					}
1678				}
1679
1680		    	$(this).parents('.cart-product').find('.cart-product__params-wrap').slideToggle();
1681		    });
1682
1683			
1684			$('.shop2-cart-table__item').each(function() {
1685
1686				var $block = $(this).find('.shop2-cart-table__item_in');
1687				var $details = $(this).find('.cart-product-details');
1688				var $right = $(this).find('.shop2-cart-table__item_right');
1689
1690				resizeController([0, 748], function() {
1691					$right.append($block);
1692				});
1693
1694				resizeController([749, 1023], function() {
1695					$details.append($block);
1696				});
1697
1698				resizeController([1024, Infinity], function() {
1699					$right.append($block);
1700				});
1701			});		
1702
1703
1704			var cartImgFix = new fixImg('.cart-product-img img');
1705
1706		},
1707
1708
1709		folderPage: function() {
1710			//var cartImgFix = new fixImg('.shop2-product-item .product-image img');
1711
1712			$(document).on('click', '.options-btn', function(){
1713		    	$(this).toggleClass('opened');
1714
1715		    	if ($(this).hasClass('opened')) {
1716					if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') {
1717						$(this).text('Hide options');
1718					} else {
1719						$(this).text('Скрыть параметры');
1720					}
1721				} else {
1722					if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') {
1723						$(this).text('Show options');
1724					} else {
1725						$(this).text('Показать параметры')
1726					}
1727				}
1728
1729		    	$(this).parents('.product-item').find('.shop2-product-options').slideToggle();
1730		    });
1731
1732		},	
1733
1734
1735		shop2Product: function() {
1736			
1737			var cartImgFix = new fixImg('.product_slider_item img');
1738
1739
1740			if ($('.product_slider .product_image').length>1) {
1741				$('.product_slider').slick({
1742					infinite: true,
1743					slidesToShow: 1,
1744					slidesToScroll: 1,
1745					arrows: true,
1746					fade: true,
1747					asNavFor: '.product_slider_thumbs',
1748					responsive: [
1749						{
1750							// breakpoint: 749,
1751							// settings: {
1752							// 	asNavFor:  null,
1753							// 	fade: false,
1754							// 	slidesToShow: 2,
1755							// 	slidesToScroll: 1
1756							// },
1757							
1758						
1759							breakpoint: 749,
1760							settings: {
1761								variableWidth: true,
1762								asNavFor:  null,
1763								fade: false,
1764								slidesToShow: 2,
1765								slidesToScroll: 1
1766							}
1767						
1768						}
1769					]
1770				});
1771
1772				$('.product_slider_thumbs').slick({
1773					infinite: true,
1774					slidesToShow: 4,
1775					slidesToScroll: 1,
1776					asNavFor: '.product_slider',
1777					dots: false,
1778					autoplay:false,
1779					autoplaySpeed:1500,
1780					focusOnSelect: true,
1781					responsive: [
1782						{
1783							breakpoint: 1024,
1784							settings: {
1785								slidesToShow: 3,
1786								slidesToScroll: 1,
1787								vertical: false,
1788								infinite: false,
1789							}
1790						},
1791						{
1792							breakpoint: 1023,
1793							settings: {
1794								rows: 1
1795							}
1796						}
1797					]
1798				});
1799			} else {
1800				$('.product_slider_thumbs').hide();
1801			}
1802
1803		    
1804		    $('.product_slider , .shop2-cart-table').lightGallery({
1805				thumbnail: false,
1806			    download: true,
1807			    loop: false,
1808			    counter: false,
1809			    getCaptionFromTitleOrAlt: true,
1810				selector: '.product_image a , .cart-product-img a'
1811		    });
1812			
1813			$('.shop2-product-options select').styler();
1814			
1815			$.ajaxSetup({complete: function(){
1816				$('.shop2-product-options select').styler();
1817		    }});
1818
1819		},
1820
1821
1822		shopTabs: function() {
1823			var $tabs = $('#product-tabs');
1824
1825            $tabs.responsiveTabs({
1826                rotate: false,
1827                startCollapsed: 'accordion',
1828                collapsible: 'accordion',
1829                animation: 'slide',
1830                duration: 500,
1831                animationqueue: false,
1832                setHash: true,
1833                scrollToAccordion: false,
1834                activate: function(event, tab){
1835	            	$(this).siblings('.tabt').show();
1836	            },
1837            });
1838            
1839            // $tabs.responsiveTabs.function('click', tab){(
1840            
1841            // )},
1842            // shopTabs.activate: function(event, tab){(
1843            // 		console.log(11);	
1844            // )},
1845            // $('#responsiveTabsDemo').responsiveTabs('activate', 1);
1846            
1847      //      $('.shop-product-data__nav .r-tabs-anchor').on('click', function() {
1848		    //     console.log(11);
1849		    //     $('.shop-product-data__desc').find('.desc-area .tabt').show();
1850		    // });
1851            
1852            
1853		},
1854		
1855
1856
1857		partnership: function(){
1858			$('.main-block').each(function() {
1859			    var $this = $(this);
1860			    var $slider = $this.find('.main-block__items_slider');
1861			    var $scrollBar = $this.find('.scrollbar');
1862			    var $prev = $this.find('.prev');
1863			    var $next = $this.find('.next');
1864			    var $item = $this.find('.main-block__item');
1865			    
1866			    if (window.matchMedia("(min-width: 1761px)").matches &&  $item.length<8) {
1867				 	$prev.hide();
1868					$next.hide();
1869				 	$scrollBar.hide();
1870				 }
1871			    else if (window.matchMedia("(min-width: 1541px)").matches && window.matchMedia("(max-width: 1760px)").matches && $item.length<7) {
1872				 	$prev.hide();
1873					$next.hide();
1874				 	$scrollBar.hide();
1875				 }
1876				 else if (window.matchMedia("(min-width: 1261px)").matches && window.matchMedia("(max-width: 1540px)").matches && $item.length<6) {
1877				 	$prev.hide();
1878					$next.hide();
1879				 	$scrollBar.hide();
1880				 }
1881				 else if (window.matchMedia("(min-width: 1025px)").matches && window.matchMedia("(max-width: 1260px)").matches && $item.length<5) {
1882				 	$prev.hide();
1883					$next.hide();
1884				 	$scrollBar.hide();
1885				 } 
1886				 else if (window.matchMedia("(min-width: 768px)").matches && window.matchMedia("(max-width: 1024px)").matches && $item.length<4) {
1887				 	$prev.hide();
1888					$next.hide();
1889				 	$scrollBar.hide();
1890				 	
1891				 }
1892			    if ($slider.length) {
1893			        var sly3 = new Sly( $slider, {
1894			            horizontal: 1,
1895			            itemNav: 'basic',
1896			            smart: 1,
1897			            activateOn: null,
1898			            mouseDragging: 1,
1899			            touchDragging: 1,
1900			            releaseSwing: 1,
1901			            startAt: 0,
1902			            scrollBar: $scrollBar,
1903			            scrollBy: 0,
1904			            speed: 300,
1905			            elasticBounds: 1,
1906			            dragHandle: 1,
1907			            dynamicHandle: 1,
1908			            clickBar: 1,
1909			            prev: $prev,
1910			            next: $next,
1911			        });
1912
1913			        slySliderAfterInit({
1914			            slideSelector: $item,
1915			            widthSelector: $slider,
1916			            sliderVariable: sly3,
1917			            next: $next,
1918			            prev: $prev,
1919			            fullwidth: false
1920			        });
1921			    }
1922			});
1923
1924			$('.kinds').each(function() {
1925				var $this = $(this);
1926				var $slider = $this.find('.kinds__items_slider');
1927				var $scrollWrap = $this.find('.scrollbar-wrap');
1928				var $scrollBar = $this.find('.scrollbar');
1929				var $prev = $this.find('.prev');
1930				var $next = $this.find('.next');
1931				var $item = $this.find('.kinds__item');
1932				var $forHideItems = $this.find('.shop2-kind-item');
1933				
1934				// if (window.matchMedia("(min-width: 1921px)").matches && $forHideItems.length<6) {
1935				// 	$prev.hide();
1936				// 	$next.hide();
1937				// 	$scrollWrap.hide();
1938				// }
1939				
1940				//if ($forHideItems.length<7) {
1941				//	$prev.hide();
1942				//	$next.hide();
1943				//	$scrollWrap.hide();
1944				//}
1945				
1946				
1947				if (window.matchMedia("(min-width: 1761px)").matches &&  $item.length<8) {
1948				 	$prev.hide();
1949					$next.hide();
1950				 	$scrollWrap.hide();
1951				 }
1952			    else if (window.matchMedia("(min-width: 1541px)").matches && window.matchMedia("(max-width: 1760px)").matches && $item.length<7) {
1953				 	$prev.hide();
1954					$next.hide();
1955				 	$scrollWrap.hide();
1956				 }
1957				 else if (window.matchMedia("(min-width: 1261px)").matches && window.matchMedia("(max-width: 1540px)").matches && $item.length<6) {
1958				 	$prev.hide();
1959					$next.hide();
1960				 	$scrollWrap.hide();
1961				 }
1962				 else if (window.matchMedia("(min-width: 1025px)").matches && window.matchMedia("(max-width: 1260px)").matches && $item.length<5) {
1963				 	$prev.hide();
1964					$next.hide();
1965				 	$scrollWrap.hide();
1966				 } 
1967				 else if (window.matchMedia("(min-width: 768px)").matches && window.matchMedia("(max-width: 1024px)").matches && $item.length<4) {
1968				 	$prev.hide();
1969					$next.hide();
1970				 	$scrollWrap.hide();
1971				 	
1972				 }
1973
1974				if ($slider.length) {
1975					var sly2 = new Sly( $slider, {
1976						horizontal: 1,
1977						itemNav: 'basic',
1978						smart: 1,
1979						activateOn: null,
1980						mouseDragging: 1,
1981						touchDragging: 1,
1982						releaseSwing: 1,
1983						startAt: 0,
1984						scrollBar: $scrollBar,
1985						scrollBy: 0,
1986						speed: 300,
1987						elasticBounds: 1,
1988						dragHandle: 1,
1989						dynamicHandle: 1,
1990						clickBar: 1,
1991						prev: $prev,
1992			    		next: $next,
1993					});
1994
1995					slySliderAfterInit({
1996						slideSelector: $item,
1997						widthSelector: $slider,
1998						sliderVariable: sly2,
1999						next: $next,
2000						prev: $prev,
2001						fullwidth: false
2002					});
2003				}
2004			});
2005
2006			$('.ctgrs').each(function() {
2007				var $this = $(this);
2008				var $slider = $this.find('.ctgrs__list');
2009				var $scrollWrap = $this.find('.scrollbar-wrap');
2010				var $scrollBar = $this.find('.scrollbar');
2011				var $prev = $this.find('.prev');
2012				var $next = $this.find('.next');
2013				var $item = $this.find('.ctgrs__item');
2014				
2015				if (window.matchMedia("(min-width: 1921px)").matches && $item.length<6) {
2016					$prev.hide();
2017					$next.hide();
2018					$scrollWrap.hide();
2019				}
2020				if (window.matchMedia("(min-width: 1761px)").matches &&  $item.length<8) {
2021				 	$prev.hide();
2022					$next.hide();
2023				 	$scrollWrap.hide();
2024				 }
2025			    else if (window.matchMedia("(min-width: 1541px)").matches && window.matchMedia("(max-width: 1760px)").matches && $item.length<7) {
2026				 	$prev.hide();
2027					$next.hide();
2028				 	$scrollWrap.hide();
2029				 }
2030				 else if (window.matchMedia("(min-width: 1261px)").matches && window.matchMedia("(max-width: 1540px)").matches && $item.length<6) {
2031				 	$prev.hide();
2032					$next.hide();
2033				 	$scrollWrap.hide();
2034				 }
2035				 else if (window.matchMedia("(min-width: 1025px)").matches && window.matchMedia("(max-width: 1260px)").matches && $item.length<5) {
2036				 	$prev.hide();
2037					$next.hide();
2038				 	$scrollWrap.hide();
2039				 } 
2040				 else if (window.matchMedia("(min-width: 768px)").matches && window.matchMedia("(max-width: 1024px)").matches && $item.length<4) {
2041				 	$prev.hide();
2042					$next.hide();
2043				 	$scrollWrap.hide();
2044				 }
2045
2046				if ($slider.length) {
2047					var sly2 = new Sly( $slider, {
2048						horizontal: 1,
2049						itemNav: 'basic',
2050						smart: 1,
2051						activateOn: null,
2052						mouseDragging: 1,
2053						touchDragging: 1,
2054						releaseSwing: 1,
2055						startAt: 0,
2056						scrollBar: $scrollBar,
2057						scrollBy: 0,
2058						speed: 300,
2059						elasticBounds: 1,
2060						dragHandle: 1,
2061						dynamicHandle: 1,
2062						clickBar: 1,
2063						prev: $prev,
2064			    		next: $next,
2065					});
2066
2067					slySliderAfterInit({
2068						slideSelector: $item,
2069						widthSelector: $slider,
2070						sliderVariable: sly2,
2071						next: $next,
2072						prev: $prev,
2073						fullwidth: false
2074					});
2075				}
2076			});
2077
2078			function slySliderAfterInit(settings){
2079			    var slideSelector = settings.slideSelector;
2080			    var widthSelector = settings.widthSelector;
2081			    var sliderVariable = settings.sliderVariable;
2082			    var sliderNext = settings.next;
2083			    var sliderPrev = settings.prev;
2084			    var mobileFullWidth = settings.fullwidth;
2085
2086			    sliderVariable.init();
2087
2088			    $(sliderNext).on('click', function() {
2089			        sliderVariable.toStart(sliderVariable.rel.firstItem + 1);
2090			    });
2091			    
2092			    $(sliderPrev).on('click', function() {
2093			        sliderVariable.toStart(sliderVariable.rel.firstItem - 1);
2094			    });
2095
2096			    if (mobileFullWidth) {
2097			        if ($(window).width()<1024) {
2098			            var slideWidth = $(widthSelector).outerWidth();
2099			            $(slideSelector).css('width', slideWidth);
2100			            sliderVariable.reload();
2101			        }
2102			    
2103			        var slyTimeout;
2104			        window.addEventListener('resize', function(){
2105			            var slideWidth = $(widthSelector).outerWidth();
2106
2107			            if (slyTimeout !== undefined) {
2108			                clearTimeout(slyTimeout);
2109			            }
2110			            slyTimeout = setTimeout(function(){
2111			                if ($(window).width()<1024) {
2112			                    $(slideSelector).css('width', slideWidth);
2113			                    sliderVariable.reload();
2114			                } else {
2115			                    sliderVariable.reload();
2116			                }
2117			            }, 500);
2118			        });
2119			    };
2120			};
2121
2122		},
2123		
2124
2125		otherScripts : function() {
2126			if(shop2.my.gr_product_comment_btn){
2127				$( document ).ready(function() {
2128				    console.log($('.comments_block_wrapper .tpl_reg_form.tpl_rev_form .tpl-button'));
2129				    $('.comments_block_wrapper .tpl_reg_form.tpl_rev_form .tpl-button').addClass('shop2-btn-back');
2130				});
2131			}
2132			
2133			if (shop2.my.gr_img_lazyload) {
2134			    var myLazyLoad = new LazyLoad();
2135			        myLazyLoad.update();
2136			}
2137		
2138			if ($('.card-top-block__product-details').children().length < 2) {
2139				$('.card-top-block').addClass('empty_options');
2140			};
2141			
2142			$('.jqselect').each(function(){
2143	        	$(this).on('click', function(){
2144	        		if($(this).hasClass('active')){
2145	        			$(this).removeClass('active');
2146	        		}else {
2147	        			$('.jqselect').removeClass('active');
2148	        			$(this).addClass('active');
2149	        		}	
2150	        	});
2151	        });
2152			
2153			$('table').wrap('<div class="table-wrapper"></div>');
2154			// if (window.matchMedia("(min-width: 400px)").matches) {
2155			// 	 the viewport is at least 400 pixels wide 
2156			// } else {
2157			// 	 the viewport is less than 400 pixels wide 
2158			// }
2159			window.addEventListener('resize', function(){
2160				// if ($(window).width()<1024) {
2161	   //             $('.site-header__bottom__wrap').append($('.login__wrap').addClass('appended'));
2162	   //         } else {
2163	   //         	$('.login').append($('.login__wrap').removeClass('appended'));
2164	   //         };
2165
2166	            if ($(window).width()<1260) {
2167	                $('.product-amount').appendTo('.product_amnt').addClass('appended_amnt');
2168	            } else {
2169	            	$('.product-amount').prependTo('.shop2-product__btns').removeClass('appended');
2170	            };
2171            });
2172			
2173
2174		    // Esc button begin
2175		    $(document).on('keyup', function(keyUp){
2176			    if (keyUp.keyCode 
2177			    	== 27) {
2178					$('.search__mobile ').removeClass('opened');
2179			    	$('body').removeClass('overflowHidden');
2180
2181			        return false;
2182			    };
2183			});
2184			// Esc button end
2185
2186			// Document click begin
2187			$(document).on('click', function(e){
2188			
2189				if ( !$(e.target).closest('.jqselect').length ){
2190		        	$('.jqselect').removeClass('active');
2191		        };
2192		        if ( !$(e.target).closest('.test-wrap').length ){
2193		        	$('.test').removeClass('active');
2194		        };
2195		        if ( $(e.target).closest('.catalogue-menu, .top-nav').length ){}else {
2196		        	$('.catalogue-menu').removeClass('active');
2197		        };
2198		        if ( $(e.target).closest('.catalogue-menu, .top-nav').length ){}else {
2199		        	$('.catalogue-menu').removeClass('active');
2200		        };
2201		        
2202		        if (!$(e.target).closest('.site-header__bottom__wrap, .search__wrapper, .remodal[data-remodal-id="rem-expanded__search"]').length) {
2203			    	$('.search__mobile').removeClass('opened');
2204			    };
2205			    
2206			    if (!$(e.target).closest('.burger-block, .catalogue-menu').length) {
2207			    	$('.burger-block').removeClass('opened');
2208			    	$('html').removeClass('overflowHidden');
2209			    };
2210			    
2211			    if (!$(e.target).closest('.sorting-block').length) {
2212			    	$('.sorting-block__popup').slideUp(150);
2213					$('.sorting-block__inner').removeClass('active');
2214			    };
2215
2216		        if (!$(e.target).closest('.catalogue-menu__title, .catalogue-menu__inner').length) {
2217			    	$('.catalogue-menu__inner').removeClass('active');
2218			    }
2219		    });
2220		    // Document click end
2221		    
2222		    
2223		    resizeController([0, 1260], function() {
2224				$('.product-amount').appendTo('.product_amnt').addClass('appended_amnt');
2225			});
2226
2227			resizeController([1261, Infinity], function() {
2228				$('.product-amount').prependTo('.shop2-product__btns').removeClass('appended');
2229			});
2230		}
2231	};
2232
2233	shop2_gr.methods = {
2234		
2235	}
2236
2237	shop2_gr.init();
2238
2239	myObject.shop2_gr = shop2_gr;
2240
2241})(jQuery, window);
2242
2243
2244$(function(){
2245	
2246	setTimeout(function(){
2247		var timerBlockWr = $('.timer-block.timer_bottom'),
2248			timerBlockHeight = timerBlockWr.outerHeight(),
2249			footerWr = $('.site-footer');
2250			
2251			if(timerBlockWr.length){
2252				footerWr.css('padding-bottom', timerBlockHeight);
2253			}
2254			
2255	}, 300);
2256	
2257	$('.link-top').click(function () {
2258		$('body,html').animate({scrollTop: 0}, 800);
2259		return false;
2260	});
2261	$(window).scroll(function(){
2262		if ( $(window).scrollTop() > 200 ) {
2263			$('.link-top').fadeIn();
2264		}
2265		else {
2266			$('.link-top').fadeOut();
2267		}
2268	});
2269	
2270	
2271	var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
2272	
2273	if (!isMobile && jQuery().zoom) {
2274		$('.gr-image-zoom').zoom({
2275			magnify: 1,
2276			duration: 10,
2277			onZoomIn: function(){
2278				$(this).parent().addClass('hide_small_pic');
2279			},
2280			onZoomOut: function(){
2281				$(this).parent().removeClass('hide_small_pic');
2282			},
2283			callback: function(){
2284				var $zoomImg = $(this);
2285				var zoomImgHeight = Math.floor($zoomImg.height());
2286				var zoomImgWidth = Math.floor($zoomImg.width());
2287				var floatHeight = Math.floor(20 * zoomImgHeight / 100);
2288				var floatWidth = Math.floor(20 * zoomImgWidth / 100);
2289				var prevWidth = Math.floor($(this).prev().outerWidth());
2290				var prevHeight = Math.floor($(this).prev().outerHeight());
2291				
2292				var zoomFloatHeight = zoomImgHeight + floatHeight;
2293				var zoomFloatWidth = zoomImgWidth + floatWidth;
2294				var finalHeight = prevHeight+floatHeight;
2295				var finalWidth = prevWidth+floatWidth;
2296				
2297				if (zoomFloatHeight<=prevHeight-floatHeight || zoomFloatWidth<=prevWidth-floatWidth) {
2298					$(this).parent().addClass('hide_big_pic');
2299				};
2300				
2301				if (zoomImgHeight<=prevHeight || zoomImgWidth <=prevWidth) {
2302					$zoomImg.css({
2303						'width': finalWidth,
2304						'height': finalHeight
2305					});
2306				}
2307			}
2308		});
2309	};
2310	
2311});

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.