PageSourceSearch

https://samtambooks.com/bitrix/templates/samokat/js/scripts.js

js samtambooks.com collected 2026-10-02 18:47:19 UTC 24,972 bytes, 789 lines download raw bytes

1$(document).ready(function () {
2    $('a[href^=http]').click(function () {
3        var a = new RegExp('/' + window.location.host + '/');
4        if (!a.test(this.href)) {
5            window.open(this.href);
6            return false;
7        }
8    });
9
10
11    $( ".main-goods-sl" ).each(function( index ) {
12
13        if(index%2 == 0)
14            $( this ).addClass('wrap-block-slider--selected');
15    });
16
17    $(window).on('scroll', function () {
18        var scrolled = $(window).scrollTop();
19        if ($(window).width() <= 991) {
20            if (scrolled > 150) {
21                $('.header-panel-sticky').addClass('is-fixed');
22            } else {
23                $('.header-panel-sticky').removeClass('is-fixed');
24            }
25        }
26    })
27
28    setTimeout(function () {
29        $('.product__slider--large').flickity({
30            prevNextButtons: false,
31            pageDots: false,
32            contain: true,
33            draggable: false,
34        });
35        $('.product__slider--thumbnail').flickity({
36            asNavFor: '.product__slider--large',
37            prevNextButtons: false,
38            contain: true,
39            pageDots: false
40        });
41    }, 500);
42
43
44    $('.js-iframeModalLink').magnificPopup({
45        type: 'iframe',
46    });
47
48    /*
49     * Fullslider
50     */
51
52    var fullslider = new Swiper('.js-fullSlider .swiper-container', {
53        autoplay: {
54    delay: 10000,
55    disableOnInteraction: false,
56},
57        navigation: {
58            nextEl: '.js-fullSlider .swiper-button-next',
59            prevEl: '.js-fullSlider .swiper-button-prev',
60        },
61        pagination: {
62            el: '.js-fullSlider .swiper-pagination',
63            type: 'bullets',
64        },
65    });
66
67    /*
68     * MainGoodsSlider
69     */
70
71    var mainGoodsSlider = new Swiper('.js-mainGoodsSlider .swiper-container', {
72        /*autoplay: {
73            delay: 0,
74            disableOnInteraction: false,
75        },*/
76        slidesPerView: 5,
77        spaceBetween: 40,
78        slidesPerGroup: 5,
79        navigation: {
80            nextEl: '.js-mainGoodsSlider .swiper-button-next',
81            prevEl: '.js-mainGoodsSlider .swiper-button-prev',
82        },
83        pagination: {
84            el: '.js-mainGoodsSlider .swiper-pagination',
85            type: 'bullets',
86        },
87        breakpoints: {
88            320: {
89                slidesPerView: 2,
90                spaceBetween: 10,
91                slidesPerGroup: 2,
92            },
93            768: {
94                slidesPerView: 5,
95                spaceBetween: 40,
96                slidesPerGroup: 5,
97            },
98        },
99    });
100
101    var mainGoodsCatalogButton = $('.js-mainGoodsCatalogButton');
102    var mainCatalogSub = $('.main-catalog-sub');
103    var timerId;
104
105    mainGoodsCatalogButton.on('mouseenter', function () {
106        clearTimeout(timerId);
107        mainCatalogSub.addClass('is-open');
108    })
109        .on('mouseleave', function () {
110            timerId = setTimeout(function () {
111                mainCatalogSub.removeClass('is-open');
112            }, 500);
113        });
114
115    mainCatalogSub.on('mouseenter', function () {
116        clearTimeout(timerId);
117    })
118        .on('mouseleave', function () {
119            mainCatalogSub.removeClass('is-open');
120        });
121
122    $('.js-mobileMenuNavToggle').on('click', function () {
123        $(this).toggleClass('is_active');
124        $(this).next().slideToggle(200);
125    });
126
127
128    $(window).scroll(function () {
129        if ($(this).scrollTop() > 160) {
130            ///     $('.header').addClass('header-fixed');
131        } else {
132            ///      $('.header').removeClass('header-fixed');
133        }
134    });
135
136    $(document).on('click', '.mobtop', function () {
137        $("#filter-close").trigger("click");
138    });
139
140    $(document).on('click', '.toidfilter', function () {
141        $("#set_filter").trigger("click");
142    });
143    $(document).on("click", "#allAddCard", function () {
144        var cod = $(this).data("cod");
145        $.ajax({
146            type: 'POST',
147            url: '/ajax/allAddCard.php?cod=' + cod,
148            success: function (data) {
149                //alert(data);
150                //window.location.href = "/personal/cart/";
151                $('.thanks-description').html('Товар успешно добавлен в корзин
151у.');
152                $.magnificPopup.open({
153                    items: {
154                        src: '#thanks-modal'
155                    },
156                    preloader: false,
157                    modal: true
158                });
159            },
160            error: function (xhr, str) {
161                alert('Возникла ошибка: ' + xhr.responseCode);
162            }
163        });
164    });
165
166    $(document).on("click", "#eventAllBooks", function () {
167        var id = $(this).data("id");
168        //alert(id);
169        $.ajax({
170            type: 'POST',
171            url: '/ajax/eventAllBooks.php',
172            data: {id: id},
173            success: function (data) {
174                $('.thanks-description').html('Товары успешно добавлены в корзину.');
175                $.magnificPopup.open({
176                    items: {
177                        src: '#thanks-modal'
178                    },
179                    preloader: false,
180                    modal: true
181                });
182            },
183            error: function (xhr, str) {
184                alert('Возникла ошибка: ' + xhr.responseCode);
185            }
186        });
187    });
188
189    $(document).on('click', '.jsltogo', function () {
190        $(".jsltogo").removeClass('selected');
191        $(".jsltogo").parents("li").find(".selleftbout").hide();
192        $(this).addClass('selected');
193        $(this).parents("li").find(".selleftbout").show();
194
195        var target = $(this).attr("href");
196        $('html, body').animate({scrollTop: $(target).offset().top - 120}, 2000);
197
198    });
199
200
201    $(document).on('click', '.main-goods_buy', function () {
202        var tovarid = ($(this).attr('data-tovarid')) ? $(this).attr('data-tovarid') : $(this).parent().parent().attr('data-tovarid');
203        var preorder = $(this).data('preorder');
204        var datePreorder = $(this).data('date-preorder');
205
206        $.ajax({
207            type: 'POST',
208            url: '/ajax/add2basket.php',
209            data: {tovarid: tovarid},
210            success: function (data) {
211                $('.thanks-description').html('Товар успешно добавлен в корзину.');
212                /*addBasketMetrika(data);*/
213                if (preorder == 'Y') {
214                    $('.thanks-description').html('Этот товар приедет на наш склад ' + datePreorder + '. Как только он поступит, мы сразу отправим его вам.');
215                } else {
216                    $('.thanks-description').html('Товар успешно добавлен в корзину.');
217                }
218
219                $.magnificPopup.open({
220                    items: {
221                        src: '#thanks-modal'
222                    },
223                    preloader: false,
224                    modal: true
225                });
226            }
227        });
228
229        setTimeout(function () {
230            $.ajax({
231                type: "GET",
232                url: "/ajax/headerCartRight.php",
233                success: function (data) {
234                    $("#cart-bid").empty();
235                    $("#cart-bid").html(data);
236                }
237            });
238        }, 500);
239
240        setTimeout(function () {
241            $.ajax({
242                type: "GET",
243                url: "/ajax/headerCartFixed.php",
244                success: function (data) {
245                    $("#cart-bid_fixed").empty();
246                    $("#cart-bid_fixed").html(data);
247                }
248            });
249        }, 500);
250
251    });
252
253    $(document).on('click', '.gallery-work_buy', function () {
254        var tovarid = $(this).attr('data-tovarid');
255
256        $.ajax({
257            type: 'POST',
258            url: '/ajax/add2basket.php',
259            data: {tovarid: tovarid},
260            success: function (data) {
261                console.log(data);
262                /*addBasketMetrika(data);*/
263                $('.thanks-description').html('Товар успешно добавлен в корзину.');
264
265                $.magnificPopup.open({
266                    items: {
267                        src: '#thanks-modal'
268                    },
269                    preloader: false,
270                    modal: true
271                });
272            }
273        });
274
275        setTimeout(function () {
276            $.ajax({
277                type: "GET",
278                url: "/ajax/headerCartRight.php",
279                success: function (data) {
280                    $("#cart-bid").empty();
281                    $("#cart-bid").html(data);
282                }
283            });
284        }, 500);
285
286        setTimeout(function () {
287            $.ajax({
288                type: "GET",
289                url: "/ajax/headerCartFixed.php",
290                success: function (data) {
291                    $("#cart-bid_fixed").empty();
292                    $("#cart-bid_fixed").html(data);
293                }
294            });
295        }, 500);
296
297    });
298
299
300    $(document).on('click', '.discounts-goods-cart', function () {
301        var tovarid = $(this).parent().parent().attr('data-tovarid');
302
303        $.ajax({
304            type: 'POST',
305            url: '/ajax/add2basket.php',
306            data: {tovarid: tovarid},
307            success: function (data) {
308                console.log(data);
309                addBasketMetrika(data);
310                $('.thanks-description').html('Товар успешно добавлен в корзину.');
311
312                $.magnificPopup.open({
313                    items: {
314                        src: '#thanks-modal'
315                    },
316                    preloader: false,
317                    modal: true
318                });
319            }
320        });
321
322        setTimeout(function () {
323            $.ajax({
324                type: "GET",
325                url: "/ajax/headerCartRight.php",
326                success: function (data) {
327                    $("#cart-bid").empty();
328                    $("#cart-bid").html(data);
329                }
330            });
331        }, 500);
332
333        setTimeout(function () {
334            $.ajax({
335                type: "GET",
336                url: "/ajax/headerCartFixed.php",
337                success: function (data) {
338                    $("#cart-bid_fixed").empty();
339                    $("#cart-bid_fixed").html(data);
340                }
341            });
342        }, 500);
343
344    });
345
346    $(document).on('click', '.product-detail_basket, .add-product-cart', function () {
347        var tovarid = ($(this).attr('data-idtovar')) ? $(this).attr('data-idtovar') : $(this).parent().parent().attr('data-idtovar');
348        var preorder = $(this).data('preorder');
349        var nobook = $(this).data('nobook');
350        var datePreorder = $(this).data('date-preorder');
351        var count = $(this).parent().siblings('.basket__qt.detail').find('input.basket__input').val();
352
353        $.ajax({
354            type: 'POST',
355            url: '/ajax/add2basket.php',
356            dataType: 'json',
357            data: {tovarid: tovarid, count: count},
358            success: function (data) {
359                console.log(data);
360                if (preorder == 'Y') {
361                    $('.thanks-description').html('Этот товар приедет на наш склад в течение 30 дней. Как только он поступит, мы сразу отправим его вам');
362                } else {
363                    $('.thanks-description').html('Товар успешно добавлен в корзину.');
364                    /*addBasketMetrika(data);*/
365                }
366
367                $.magnificPopup.open({
368                    items: {
369                        src: '#thanks-modal'
370                    },
371                    preloader: false,
372                    modal: true
373                });
374            }
375        });
376
377        setTimeout(function () {
378            $.ajax({
379                type: "GET",
380                url: "/ajax/headerCartRight.php",
381                success: function (data) {
382                    $("#cart-bid").empty();
383                    $("#cart-bid").html(data);
384                }
385            });
386        }, 500);
387
388        setTimeout(function () {
389            $.ajax({
390                type: "GET",
391                url: "/ajax/headerCartFixed.php",
392                success: function (data) {
393                    $("#cart-bid_fixed").empty();
394                    $("#cart-bid_fixed").html(data);
395                }
396            });
397        }, 500);
398    });
399
400    $(document).on('click', '.foreign-work_buy', function () {
401        var tovarid = $(this).attr('data-tovarid');
402
403        $.ajax({
404            type: 'POST',
405            url: '/ajax/add2basket.php',
406            data: {tovarid: tovarid},
407            success: function (data) {
408                console.log(data);
409
410                $('.thanks-description').html('Товар успешно добавлен в корзин
410у.');
411                addBasketMetrika(data);
412
413                $.magnificPopup.open({
414                    items: {
415                        src: '#thanks-modal'
416                    },
417                    preloader: false,
418                    modal: true
419                });
420            }
421        });
422
423        setTimeout(function () {
424            $.ajax({
425                type: "GET",
426                url: "/ajax/headerCartRight.php",
427                success: function (data) {
428                    $("#cart-bid").empty();
429                    $("#cart-bid").html(data);
430                }
431            });
432        }, 500);
433
434        setTimeout(function () {
435            $.ajax({
436                type: "GET",
437                url: "/ajax/headerCartFixed.php",
438                success: function (data) {
439                    $("#cart-bid_fixed").empty();
440                    $("#cart-bid_fixed").html(data);
441                }
442            });
443        }, 500);
444    });
445
446    /*$('.gallery-button a').magnificPopup({
447     type: 'inline',
448     preloader: false,
449     modal: true
450     });*/
451
452    $(document).on('click', '.popup-modal-dismiss', function (e) {
453        e.preventDefault();
454        $.magnificPopup.close();
455    });
456
457    $(document).on('click', '.plus', function () {
458        var valtovar = $(this).siblings('input.basket__input').val();
459        if (valtovar >= 1) {
460            $(this).siblings('input.basket__input').val(parseInt(valtovar) + 1);
461        }
462    });
463    $(document).on('click', '.minus', function () {
464        var valtovar = $(this).siblings('input.basket__input').val();
465        if (valtovar >= 1) {
466            $(this).siblings('input.basket__input').val(parseInt(valtovar) - 1);
467        }
468    });
469
470
471    $('.click_search').on('click', function () {
472        $("input.input-search").fadeIn(1000);
473    });
474
475    $('.head_menu-gamburger').on('click', function () {
476        if ($('.header_menu-mobile').hasClass('active')) {
477            $('.header_menu-mobile').removeClass('active');
478        } else {
479            $('.header_menu-mobile').addClass('active');
480        }
481    });
482
483    $('.head_menu-close').on('click', function () {
484        $('.header_menu-mobile').removeClass('active');
485    });
486
487    $(".product-listbook").on('click', function () {
488        $('html, body').animate({
489            scrollTop: $('.detail-gallery_book').offset().top - 80
490        }, 600);
491    });
492
493    $(".detail-content_button.about").on('click', function () {
494        $('html, body').animate({
495            scrollTop: $('.detail-content_text').offset().top - 80
496        }, 600);
497    });
498
499    $(".detail-content_button.awards").on('click', function () {
500        $('html, body').animate({
501            scrollTop: $('.detail-content_awards').offset().top - 80
502        }, 600);
503    });
504
505    $(".detail-content_button.char").on('click', function () {
506        $('html, body').animate({
507            scrollTop: $('.detail-content_characteristics').offset().top - 80
508        }, 600);
509    });
510
511    $(".detail-content_button.listing").on('click', function () {
512        $('html, body').animate({
513            scrollTop: $('.detail-gallery_book').offset().top - 80
514        }, 600);
515    });
516
517    $(".detail-content_button.aut").on('click', function () {
518        $('html, body').animate({
519            scrollTop: $('.detail-content_author').offset().top - 80
520        }, 600);
521    });
522
523    $(".detail-content_button.vid").on('click', function () {
524        $('html, body').animate({
525            scrollTop: $('.video-iframe-block').offset().top - 80
526        }, 600);
527    });
528    $(document).on('click', '.item-awards-izdatelstvo-page', function () {
529        $(".item-awards-izdatelstvo-page").removeClass('active');
530        $(this).addClass('active');
531    });
532
533    $(".dd-menu li").click(function () {
534        var text = $(this).text();
535        var dropdown = $(this).parents(".dropdown");
536        var button = dropdown.find(".dd-button");
537        var num = $(this).data("num");
538
539        button.text(text);
540
541        if (dropdown.attr("id") === "city-choice") {
542            $(".main-shop_list__section").removeClass("active");
543            $('.main-shop_list__section[data-num="' + num + '"]').addClass("active");
544        }
545    });
546
547    $("#filter-close").click(function () {
548        $(this).addClass("hidden");
549        $("#smart-filter-block").animate({
550            width: "toggle"
551        }, {
552            duration: 350,
553            specialEasing: {
554                width: "linear"
555            }
556        });
557        $(".left-fixed-menu").removeClass("showed");
558    });
559
560    $('form[name="callback_form"]').each(function () {
561        $(this).validate({
562            messages: {
563                name: {
564                    required: 'Поле обязательно для заполнения'
565                },
566                phone: {
567                    required: 'Поле обязательно для заполнения'
568                }
569            },
570            submitHandler: function () {
571                sendAjaxForm("callback_form");
572            }
573        });
574    });
575
576    //$(".js-mask-phone").mask("+7 (999) 999-9999");
577
578    function sendAjaxForm(form) {
579        var e = $('form[name="' + form + '"]');
580        return $.ajax({
581            type: e.attr("method"),
582            url: e.attr("action"),
583            data: new FormData(e[0]),
584            contentType: false,
585            processData: false,
586            enctype: 'multipart/form-data'
587        }).done(function (response) {
588            if (response != "fail") {
589                e.trigger("reset"), setTimeout(function () {
590                    $.magnificPopup.open({
591                        items: {
592                            src: "#form-thanks-modal"
593                        },
594                        type: "inline",
595                        fixedContentPos: !1,
596                        fixedBgPos: !0,
597                        overflowY: "auto",
598                        closeBtnInside: !0,
599                        preloader: !1,
600                        midClick: !0,
601                        removalDelay: 300,
602                        mainClass: "my-mfp-zoom-in"
603                    })
604                }, 300);
605            } else {
606                setTimeout(function () {
607                    $.magnificPopup.open({
608                        items: {
609                            src: "#fail"
610                        },
611                        type: "inline",
612                        fixedContentPos: !1,
613                        fixedBgPos: !0,
614                        overflowY: "auto",
615                        closeBtnInside: !0,
616                        preloader: !1,
617                        midClick: !0,
618                        removalDelay: 300,
619                        mainClass: "my-mfp-zoom-in"
620                    });
621                }, 300);
622            }
623        }).fail(function () {
624            setTimeout(function () {
625                $.magnificPopup.open({
626                    items: {
627                        src: "#fail"
628                    },
629                    type: "inline",
630                    fixedContentPos: !1,
631                    fixedBgPos: !0,
632                    overflowY: "auto",
633                    closeBtnInside: !0,
634                    preloader: !1,
635                    midClick: !0,
636                    removalDelay: 300,
637                    mainClass: "my-mfp-zoom-in"
638                });
639            }, 300);
640        });
641    }
642
643    $(document).on('click', '.order-fast', function () {
644        $.magnificPopup.open({
645            items: {
646                src: '#fast-order'
647            },
648            preloader: false,
649            modal: true
650        });
651    });
652
653    $(document).on('submit', 'form[name="fast-order-form"]', function (e) {
654        e.preventDefault();
655        let form = $('form[name="fast-order-form"]');
656        let title = $('#fast-order .popup-title');
657        let error = $('form[name="fast-order-form"] .errorMess');
658
659        BX.ajax.runComponentAction('project:fast.order',
660            'send', {
661                method: 'POST',
662                mode: 'class',
663                data: {post: $(form).serialize()}
664            }).then(function (response) {
665            if (response.status == 'success') {
666                error.hide();
667                title.html('Спасибо за заказ! В ближайшее время мы свяжемся с Вами.');
668                form.hide();
669            }
670        }).catch(function (response) {
671            if (response.errors[0].message.length) {
672                error.html(response.errors[0].message);
673                error.show();
674            }
675        });
676
677        return false;
678    });
679
680    var mX = 0;
681    $("#carousel-aicXL .carousel-inner .item").on('touchstart', function (event) {
682        $("#carousel-aicXL .carousel-inner .item").removeClass('active stopSlider');
683        $(this).addClass('active stopSlider');
684    });
685    $("#carousel-aicXL .carousel-inner .item").on('touchmove', function (event) {
686        $("#carousel-aicXL .carousel-inner .item").removeClass('active stopSlider');
687        if (event.originalEvent.touches[0].pageX < mX) {
688
689            $(this).next().addClass('active stopSlider');
690            if ($(this).is(':last-child')) {
691                $("#carousel-aicXL .carousel-inner .item:first-child").addClass('active stopSlider');
692            }
693        } else if (event.originalEvent.touches[0].pageX > mX) {
694            $(this).prev().addClass('active stopSlider');
695            if ($(this).is(':first-child')) {
696                $("#carousel-aicXL .carousel-inner .item:last-child").addClass('active stopSlider');
697            }
698        }
699        mX = event.originalEvent.touches[0].pageX;
700    });
701
702    $(document).on('click', '.popup-modal-dismiss-no-style', function (e) {
703        e.preventDefault();
704        $.magnificPopup.close();
705    });
706
707});
708
709function initGrid() {
710    setTimeout(function () {
711        $('.grid').masonry({
712            // options
713            itemSelector: '.main-goods_item',
714            columnWidth: '.grid-sizer',
715            percentPosition: true,
716            isAnimated: true,
717            animationOptions: {
718                queue: false,
719                duration: 500
720            }
721        });
722    }, 500);
723}
724
725$(function () {
726    $('.toggle').each(function () {
727        var _this = $(this);
728        var toggle;
729        return toggle = new Toggle(_this);
730    });
731});
732
733(function () {
734    this.Toggle = (function () {
735        Toggle.prototype.el = null;
736
737        Toggle.prototype.tabs = null;
738
739        Toggle.prototype.panels = null;
740
741        function Toggle(toggleClass) {
742            this.el = $(toggleClass);
743            this.tabs = this.el.find(".tab");
744            this.panels = this.el.find(".panel");
745            this.bind();
746        }
747
748        Toggle.prototype.show = function (index) {
749            var activePanel, activeTab;
750            this.tabs.removeClass('active');
751            activeTab = this.tabs.get(index);
752            $(activeTab).addClass('active');
753            this.panels.hide();
754            activePanel = this.panels.get(index);
755            return $(activePanel).show();
756        };
757
758        Toggle.prototype.bind = function () {
759            var _this = this;
760            return this.tabs.unbind('click').bind('click', function (e) {
761                return _this.show($(e.currentTarget).index());
762            });
763        };
764
765        return Toggle;
766
767    })();
768
769}).call(this);
770
771function addBasketMetrika(json) {
772    dataLayer.push({
773        'ecommerce': {
774            'add': {
775                'products': [
776                    {
777                        'name': json.NAME,
778                        'id': json.TOVARID,
779                        'price': json.PRICE,
780                        'category': json.CATEGORY,
781                        'quantity': json.count,
782                    }
783                ]
784            }
785        }
786    });
787
788};
789

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.