PageSourceSearch

https://fratriashop.ru/local/templates/eshop_bootstrap_green/js/app.js?176167338712440

js fratriashop.ru collected 2026-09-28 22:48:35 UTC 12,440 bytes, 423 lines download raw bytes

1$(document).on('click', 'label.checkbox', function() {
2  $(this).toggleClass('checkbox--active');
3});
4
5function promo_check(button) {
6  if (button.value !== '') {
7    $('.cart-sidebar__promo input[type="submit"]').removeAttr('disabled');
8  } else {
9    $('.cart-sidebar__promo input[type="submit"]').attr('disabled', "disabled");
10  }
11}
12
13
14$(document).on('input', '.simple-style input', function() {
15  if (this.value !== '') {
16    this.classList.add('noempty-field');
17  } else {
18    this.classList.remove('noempty-field');
19  }
20});
21
22$(document).on('click', '.select-value', function() {
23  if ($(this).closest('.select-wrap').hasClass('select-wrap--active')) {
24    $('.select-wrap--active').removeClass('select-wrap--active');
25  } else {
26    $('.select-wrap--active').removeClass('select-wrap--active');
27    $(this).closest('.select-wrap').addClass('select-wrap--active');
28  }
29});
30
31$(document).on('click', '.select-variant', function() {
32  var select_value = $(this).find('span').text();
33  $(this).closest('.select-wrap').find('.select-value').text(select_value);
34  $(this).closest('.select-wrap').find('.select-variant--active').removeClass('select-variant--active');
35  $(this).addClass('select-variant--active');
36  $(this).closest('.select-wrap').removeClass('select-wrap--active');
37});
38
39
40
41
42$('body').mouseup(function(e) {
43  var block = $(".select-wrap--active");
44  if (!block.is(e.target)
45      && block.has(e.target).length === 0) {
46    $('.select-wrap--active').removeClass('select-wrap--active');
47  }
48});
49
50$(document).ready(function() {
51
52  if ($(".menu-item-active").length > 0) {
53    $(".menu-item-active").parents("li").addClass("shop-categories--open");
54    $(".menu-item-active").parents("ul").show();
55
56  }
57
58  // todo редирект на оплату
59  if (window.location.href.indexOf("/personal/orders/") < 0)
60	  
61  if ($('form[name="buyForm"]').length > 0) {
62    var actionPath = $('form[name="buyForm"]').attr("action");
63    var sessionID = $('form[name="buyForm"]').find("input").val();
64    console.log(actionPath + "?sessionId=" + sessionID);
65    location.replace(actionPath + "?sessionId=" + sessionID);
66  }
67  
68
69
70  // $(document).on('click', '.phone-mask', function () {
71  //     if ($(this).val() == "") {
72  //         $(this).val("+7");
73  //     }
74  // });
75  $(document).on('click', '.select-wrap--lan .select-variant', function() {
76    $('.lan-flag img').attr('src', $(this).attr('data-img'));
77  });
78
79
80  $(document).on('click', '.header-item--search', function() {
81    $("header").toggleClass('search-active');
82    $("#sadsad").focus();
83  });
84  $(document).on('click', '.header-item--cart', function() {
85    $(".header-cart").toggleClass('header-cart--active');
86    $(this).toggleClass('header-item--cart--active');
87  });
88  $(document).on('mouseover', '.header-item--cart', function() {
89    $(".header-cart").toggleClass('header-cart--active');
90    $(this).toggleClass('header-item--cart--active');
91  });
92
93  $(document).on('mouseout', '.header-item--cart', function() {
94    $(".header-cart").removeClass('header-cart--active');
95    $('.header-item--cart').removeClass('header-item--cart--active');
96  });
97
98  $(document).on('mouseover', '.header-cart', function() {
99    $(".header-cart").toggleClass('header-cart--active');
100    $('.header-item--cart').addClass('header-item--cart--active');
101  });
102
103  $(document).on('mouseout', '.header-cart', function() {
104    $(".header-cart").removeClass('header-cart--active');
105    $('.header-item--cart').removeClass('header-item--cart--active');
106  });
107
108
109  $(".popup-wrap.popup-wrap, .contacts__close").click(function(e) {
110    e = e || e.window;
111    if (e.target == this) {
112      $(".popup-wrap.popup-wrap").fadeOut(300);
113    }
114  });
115
116  $("a[href='#contacts']").click(function() {
117    $(".popup-wrap.popup-wrap").css({"display": "flex", "opacity": 0});
118    $(".popup-wrap.popup-wrap").animate({"opacity": 1}, 300);
119    return false;
120  });
121
122
123  (function() {
124    if ($(".filters-block-fixed").length < 1) {
125      return;
126    }
127    
128    var y = $(".filters-block-fixed").offset().top - 15;
129    var padding = $(".shop-sidebar").offset().top - 15;
130    var w = $(".filters-block-fixed").width();
131    var yFooter = Math.floor($("footer").offset().top);
132    var height = $(".filters-block-fixed").height();
133    var cancel = (yFooter - (padding + height) - 60);
134    var flagAbsolute = false;
135    var flagOne = false;
136    var yDinamic = 0;
137
138    /*
139    $(window).scroll(function() {
140      var topScroll = $(window).scrollTop();
141      var bottom = (height + topScroll) + 60;
142      if (topScroll >= y) {
143
144        if (bottom > yFooter) {
145          $(".filters-block-fixed").css({"width": w + "px", "position": "absolute", "top": cancel + "px"});
146        } else {
147          $(".filters-block-fixed").css({
148            "width": w + "px",
149            "position": "absolute",
150            "top": (topScroll - padding) + "px"
151          });
152        }
153
154      } else {
155        // Static
156        $(".filters-block-fixed").css({"position": "static"});
157      }
158
159    });*/
160
161    $(window).scroll(function() {
162
163      //when loading more items, page changes size
164      var padding = $(".shop-sidebar").offset().top - 15;
165      var yFooter = Math.floor($("footer").offset().top);
166      var height = $(".filters-block-fixed").height();
167      var cancel = (yFooter - (padding + height) - 60);
168      
169      var topScroll = $(window).scrollTop();
170      var bottom = (height + topScroll) + 60;
171
172      //strange zoom
173      var zoom = $('body').css("zoom") - 0; 
174      var yActual = y * zoom;
175
176      if (topScroll >= yActual) {
177
178        if (bottom > yFooter) {
179          $(".filters-block-fixed").css({
180            "width": w + "px",
181            "position": "absolute",
182            "top": cancel + "px",
183            "max-height": "auto",
184            "padding-bottom" : "0px"
185          });
186        } else {
187          $(".filters-block-fixed").css({
188            "width": w + "px",
189            "position": "fixed",
190            "top": "15px",
191            "max-height": "100%",
192            "padding-bottom" : "50px"
193          });
194        }
195
196      } else {
197        // Static
198        $(".filters-block-fixed").css({"position": "static", "height": "auto"});
199      }
200
201    });
202
203
204  })($);
205
206  if ($("#order-property-3").length > 0) {
207    var im = new Inputmask("+9 (9{3}) 9{3}-9{2}-9{2}");
208    im.mask($("#order-property-3"));
209    if ($("#order-property-3").val() == "") {
210      $("#order-property-3").val("+7");
211    }
212  }
213  if ($("#sppd-property-3").length > 0) {
214    var im = new Inputmask("+7 (9{3}) 9{3}-9{2}-9{2}");
215    im.mask($("#sppd-property-3"));
216    if ($("#sppd-property-3").val() == "") {
217      $("#sppd-property-3").val("+7");
218    }
219  }
220
221  function trim(str, charlist) {
222    charlist = !charlist ? ' \s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1');
223    var re = new RegExp('^[' + charlist + ']+|[' + charlist + ']+$', 'g');
224    return str.replace(re, '');
225  }
226
227
228  $("#one-line-address").change(function() {
229    var string = $(this).val();
230    var delimiter = ",";
231    var result = string.toString().split(delimiter.toString());
232
233    $(".lk-address textarea[name='ORDER_PROP_7']").val(trim(result[0]));
234    $(".lk-address input[name='ORDER_PROP_22']").val(trim(result[1]));
235    $(".lk-address input[name='ORDER_PROP_5']").val(trim(result[2]));
236
237  });
238
239
240// mishanin 22.11.2019
241  $("#filter-mobile").change(function() {
242    var url = $(this).val();
243    location.replace(url);
244  });
245
246  // Добавление процента скидки
247
248  (function() {
249
250    $(document).ajaxComplete(function(event, xhr, settings) {
251      console.log(settings);
252
253    });
254
255    if (typeof BX.Sale !== "undefined" && typeof  BX.Sale.BasketComponent !== "undefined") {
256      setInterval(function() {
257        if ($("#discount-percent.view").length < 1) {
258          var discount = BX.Sale.BasketComponent.result.DISCOUNT_PRICE_ALL;
259          var allSum = (BX.Sale.BasketComponent.result.allSum + discount);
260
261          var percent = Math.round(discount / ( allSum / 100));
262          $("#discount-percent").before("(" + percent + "%)");
263          $("#discount-percent").addClass("view");
264        }
265      }, 100);
266    }
267  }());
268
269
270  $('.view-order-link').click(function() {
271    console.log("init");
272    var id = $(this).attr("data-order-id");
273    console.log(id);
274    $("#ORDER_VIEW_ID-" + id).slideToggle(300);
275
276    return false
277  });
278
279
280});
281
282function wm_slidetoggle(number) {
283  var title = document.querySelector('.slide-up-title[data-slide="' + number + '"]');
284  var wrap = document.querySelector('.slide-up-wrap[data-slide="' + number + '"]');
285  var wrap2 = document.querySelector('.slide-up-wrap[data-slide="' + number + '"] .slide-up-wrap2');
286  if (wrap.classList.contains('slide-up-wrap--active')) {
287    wrap.style.height = 0;
288    wrap.classList.remove('slide-up-wrap--active')
289  } else {
290    var need_height = wrap2.offsetHeight;
291    wrap.style.height = need_height + "px";
292    wrap.classList.add('slide-up-wrap--active')
293  }
294}
295
296jQuery(document).ready(function($) {
297  var slide_ups = document.querySelectorAll('.slide-up-title');
298  for (var i = 0; i < slide_ups.length; i++) {
299    slide_ups[i].addEventListener('click', function() {
300      var data_slide = this.getAttribute('data-slide');
301      var many_slides = this.closest('.slides-ups') || false;
302      var wrap228 = document.querySelector('.slide-up-wrap[data-slide="' + data_slide + '"]');
303      if (wrap228.classList.contains('slide-up-wrap--active')) {
304        wm_slidetoggle(data_slide);
305      } else {
306        if ((many_slides = this.closest('.slides-ups')) && (data_slide_close = many_slides.querySelector('.slide-up-wrap--active'))) {
307          var data_slide_close = many_slides.querySelector('.slide-up-wrap--active').getAttribute('data-slide');
308          wm_slidetoggle(data_slide_close);
309          wm_slidetoggle(data_slide);
310        } else {
311          wm_slidetoggle(data_slide);
312        }
313      }
314    });
315  }
316
317
318});
319
320
321$(document).on('click', '.header-burger', function() {
322  $('.mob-menu').toggleClass('mob-menu--active');
323  disable_scroll_mobile();
324  disable_scroll();
325  $('body').toggleClass('body--scroll');
326});
327
328$(document).on('click', '.mob-menu__close', function() {
329  $('.mob-menu').toggleClass('mob-menu--active');
330  enable_scroll_mobile();
331  enable_scroll();
332  $('body').toggleClass('body--scroll');
333});
334
335$('body').mouseup(function(e) {
336  var block = $(".mob-menu");
337  if (!block.is(e.target)
338      && block.has(e.target).length === 0) {
339    $('.mob-menu').removeClass('mob-menu--active');
340  }
341});
342
343
344var keys = [32, 33, 34, 35, 36, 37, 38, 39, 40];
345
346function wm_preventDefault(e) {
347  e = e || window.event;
348  if (e.wm_preventDefault)
349    e.wm_preventDefault();
350  e.returnValue = false;
351}
352
353function keydown(e) {
354  for (var i = keys.length; i--;) {
355    if (e.keyCode === keys[i]) {
356      wm_preventDefault(e);
357      return;
358    }
359  }
360}
361
362function wheel(e) {
363  wm_preventDefault(e);
364}
365
366function disable_scroll() {
367  if (window.addEventListener) {
368    window.addEventListener('DOMMouseScroll', wheel, false);
369  }
370  window.onmousewheel = document.onmousewheel = wheel;
371  document.onkeydown = keydown;
372  disable_scroll_mobile();
373}
374
375function enable_scroll() {
376  if (window.removeEventListener) {
377    window.removeEventListener('DOMMouseScroll', wheel, false);
378  }
379  window.onmousewheel = document.onmousewheel = document.onkeydown = null;
380  enable_scroll_mobile();
381}
382
383
384function disable_scroll_mobile() {
385  document.addEventListener('touchmove', wm_preventDefault, false);
386}
387
388function enable_scroll_mobile() {
389  document.removeEventListener('touchmove', wm_preventDefault, false);
390}
391
392
393function my_zoom() {
394  $('body').css('zoom', 1);
395  var w1 = document.documentElement.clientWidth;
396  var w2 = document.querySelector('.center-wrap').clientWidth;
397  if (w1 < 1200) {
398    var w3 = w1 / w2;
399    $('body').css('zoom', w3);
400    $('.main-screen').css('zoom', 1 / w3);
401  }
402}
403
404// $('.login-wrap__right a').on('click', function () {
405//     $('.password-popup').toggleClass('password-popup--active');
406// });
407//
408// $('.password-popup .popup-close').on('click', function () {
409//     $('.password-popup').toggleClass('password-popup--active');
410// });
411
412// $('.password-popup').mouseup(function (e) {
413//     var block = $(".popup--password");
414//     if (!block.is(e.target)
415//         && block.has(e.target).length === 0) {
416//         $('.password-popup').removeClass('password-popup--active');
417//     }
418// });
419
420
421$(document).ready(my_zoom);
422$(window).resize(my_zoom);
423

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.