PageSourceSearch

https://deno-silver.ru/custom/my/js/theme.js

js deno-silver.ru collected 2026-10-07 19:55:43 UTC 21,659 bytes, 666 lines download raw bytes

1(function ($) {
2    $(window).on("load", function () {
3       // $('.load').fadeOut("fast");
4        /*
5        $('.slider-for, .shop_id__slider-for, ' +
6            '.shop_id__slider-nav, .fast_view__slider-for, .fast_view__slider-nav, ' +
7            '.shop_buy_and_shop_one_click .to-cart, .js_shop_buy.shop_buy.to-cart').fadeTo("slow", 1);
8            */
9    });
10})(jQuery);
11/* Подключение анимации в фильтре*/
12$(document).on('click', '.filter__button', function(){
13	$('.prel').show();
14});
15/** @function
16 * @name clickTab - переключение табов
17 * @param {object} - клик по текущему табу
18 * @param {string} - класс контейнера табов
19 * @param {string} - класс контента таба
20 */
21
22function clickTab(th, parentTabs, tabContent) {
23    th
24        .addClass('active').siblings().removeClass('active')
25        .closest(parentTabs).find(tabContent).removeClass('active').eq(th.index()).addClass('active');
26}
27
28
29/* @function
30 * @name handlerFilterShow
31 * открывает фильтр при клике на моб. устр-ах
32 * */
33function handlerFilterShow() {
34    var filter = $(this).next() ;
35    if(filter.hasClass('is-active')) {
36        filter.slideUp('500').removeClass('is-active');
37    }
38    else {
39        filter.slideDown('500').addClass('is-active');
40    }
41    //$(this).next().slideToggle('500').toggleClass('is-active');
42}
43
44/* @function
45 * @name handlerFilterShow
46 * открывает второй уровень меню при клике на ссылку на моб. устр-ах
47 * */
48function handlerMenuShow(evt) {
49    if(!$(this).hasClass('is-active')) {
50        evt.preventDefault();
51    }
52    $(this).toggleClass('is-active');
53}
54
55
56/* @function
57 * @name handlerCartShow
58 * открывает краткую корзину при клике на моб. устр-ах
59 * */
60function handlerCartShow(evt) {
61    if(!$(this).hasClass('is-active')) {
62        evt.preventDefault();
63        $('.cart_block_form').show();
64    }
65    $(this).toggleClass('is-active');
66}
67
68var fl = 0;
69
70/* @function
71*  @name mobileAction
72*  изменение поведения сайта при различных разрешениях устройств
73* */
74function mobileAction(widt) {
75   if (widt <= 768) {
76        if ($('.filter_block').length > 0) {
77            document.querySelector('.filter .head_bl').addEventListener('click', handlerFilterShow, false);
78        }
79       document.querySelector('.header__nav .parent > a').addEventListener('click', handlerMenuShow, false);
80       document.querySelector('.cart_bl').addEventListener('click', handlerCartShow, false);
81       fl = 1;
82    }
83    else if (fl) {
84        if ($('.filter_block').length > 0) {
85            if (!$('.filter_block').is(':visible')) {
86                document.querySelector('.filter_block').style.display = 'block';
87            }
88            document.querySelector('.filter .head_bl').removeEventListener('click', handlerFilterShow, false);
89        }
90        document.querySelector('.header__nav .parent > a').removeEventListener('click', handlerMenuShow, false);
91        document.querySelector('.cart_bl').removeEventListener('click', handlerCartShow, false);
92        fl = 0;
93    }
94}
95
96/** @function
97 * @name changeFooterHeight - функция для адаптации высоты подвала
98 */
99function changeFooterHeight () {
100    var footer_height = $('footer').innerHeight();
101    $('body').css("padding-bottom", footer_height);
102}
103
104$(document).ready(function () {
105
106
107    $('.range-slider').fadeTo("slow", 1);
108
109    changeFooterHeight ();
110
111    $(window).scroll(function () {
112        var h = $(window).scrollTop();
113        if (h < 1) {
114            $("body").removeClass("fixed")
115        }
116        else {
117            $("body").addClass("fixed")
118        }
119        ;
120    });
121
122    $('.one-time').slick({
123        dots: true,
124        infinite: true,
125        speed: 1200,
126        slidesToShow: 1,
127        autoplay: true,
128        fade: true,
129        cssEase: 'linear',
130        autoplaySpeed: 3000,
131    });
132
133    // $('.slider-for').slick({
134    //     slidesToShow: 1,
135    //     slidesToScroll: 1,
136    //     arrows: true,
137    //     dots: false,
138    //     fade: true,
139    //     //asNavFor: '.slider-nav'
140    // });
141
142
143    (function () {
144
145        "use strict";
146
147        var toggles = document.querySelectorAll(".c-hamburger");
148
149        for (var i = toggles.length - 1; i >= 0; i--) {
150            var toggle = toggles[i];
151            toggleHandler(toggle);
152        }
153        ;
154
155        function toggleHandler(toggle) {
156            toggle.addEventListener("click", function (e) {
157                e.preventDefault();
158                (this.classList.contains("is-active") === true) ? this.classList.remove("is-active") : this.classList.add("is-active");
159                $('body').toggleClass('left_bl');
160                $('#overlay').fadeToggle('fast');
161            });
162        }
163    })();
164
165    $('.fast_view__slider-for').slick({
166        slidesToShow: 1,
167        slidesToScroll: 1,
168        arrows: false,
169        dots: false,
170        fade: true,
171        asNavFor: '.fast_view__slider-nav'
172    });
173
174    $('.fast_view__slider-nav').slick({
175        slidesToShow: 6,
176        slidesToScroll: 1,
177        asNavFor: '.fast_view__slider-for',
178        dots: false,
179        arrows: false,
180        focusOnSelect: true,
181        vertical: true,
182        responsive: [
183            {
184                breakpoint: 660,
185                settings: {
186                    slidesToShow: 3,
187                    slidesToScroll: 3,
188                    vertical: false
189                }
190            }
191        ]
192    });
193
194    $('.shop_id__slider-for').slick({
195        slidesToShow: 1,
196        slidesToScroll: 1,
197        arrows: false,
198        dots: false,
199        fade: true,
200        asNavFor: '.shop_id__slider-nav'
201    });
202
203    $('.shop_id__slider-nav').slick({
204        slidesToShow: 6,
205        slidesToScroll: 1,
206        asNavFor: '.shop_id__slider-for',
207        dots: false,
208        arrows: false,
209        focusOnSelect: true,
210        vertical: true,
211        responsive: [
212            {
213                breakpoint: 660,
214                settings: {
215                    slidesToShow: 3,
216                    slidesToScroll: 3,
217                    vertical: false
218                }
219            }
220        ]
221    });
222
223
224    $(document).on('click', '.fast_view_btn2', function () {
225        $("div#overlay").fadeIn('slow');
226        var th = $(this);
227        var form = th.parents('.js_shop').find(".fast_view");
228        //var heigh = form.innerHeight()+40;
229        // form.css({"height": heigh});
230        form.fadeIn('slow').promise().done(function () {
231            $('.fast_view__slider-for, .fast_view__slider-nav').resize().slick('setPosition');
232            form.css("height", "auto");
233            var heigh = form.innerHeight() + 2;
234            form.css({"height": heigh});
235        });
236
237        return false;
238    });
239
240    $(document).on('click', '.fast_view_btn', function () {
241        $("div#overlay").fadeIn('slow');
242        var th = $(this);
243        var form = $(".fast_view").eq(0);
244        //var heigh = form.innerHeight()+40;
245        // form.css({"height": heigh});
246        //
247        form.load(th.attr('data-href')+' .modal_content', {}, function(data){
248
249            $('.fast_view__slider-for').slick({
250                slidesToShow: 1,
251                slidesToScroll: 1,
252                arrows: false,
253                dots: false,
254                fade: true,
255                asNavFor: '.fast_view__slider-nav'
256            });
257
258            $('.fast_view__slider-nav').slick({
259                slidesToShow: 6,
260                slidesToScroll: 1,
261                asNavFor: '.fast_view__slider-for',
262                dots: false,
263                arrows: false,
264                focusOnSelect: true,
265                vertical: true,
266                responsive: [
267                    {
268                        breakpoint: 660,
269                        settings: {
270                            slidesToShow: 3,
271                            slidesToScroll: 3,
272                            vertical: false
273                        }
274                    }
275                ]
276            });
277
278            $(".js_shop_form, .shop_form").each(function() {
279              empty_param_price($(this));
280              select_param_price($(this));
281            });
282
283            $('.checkbox_block input:checked').prop("checked", false);
284
285            Ya.share2(form.find('.ya-share2').get(0), {
286                content: {
287                    url: th.attr('data-href').replace("?fast_view=1","")
288                }
289            });
290
291            form.fadeIn('slow').promise().done(function () {
292
293
294                $('.fast_view__slider-for, .fast_view__slider-nav').resize().slick('setPosition');
295                form.css("height", "auto");
296                var heigh = form.innerHeight() + 2;
297                form.css({"height": heigh});
298            });
299        });
300
301
302
303        return false;
304    });
305
306
307    $(document).on('click', '.fast_view__close,div#overlay', function () {
308        $("div#overlay").fadeOut('slow');
309        $(".fast_view").fadeOut('slow');
310        return false;
311    });
312
313    $(document).on('click', '.btn_shop_one_click', function () {
314
315        var form = $(this).parents('form');
316        if ($(form).find('input#check10').length && !$(form).find('input#check10').prop("checked")) {
317
318            $(form).find('.checkbox_block label').addClass('error_input');
319            $(form).find('.checkbox_block label:first-child').focus();
320            return false;
321
322        } else {
323
324          $("div#overlay2").fadeIn('slow').css({
325              "top": 0
326          });
327          var th = $(this);
328          var form = th.parents('.js_shop').find("#modal_form2");
329          form.fadeIn('slow').find('input:not([type="hidden"]):first').focus();
330          form.css("height", "auto");
331          var heigh = form.innerHeight() + 1;
332          form.css({
333              "height": heigh
334          });
335
336          return false;
337
338        }
339    });
340
341
342    $(document).on('click', '.modal_form2__close, div#overlay2', function () {
343        $("div#modal_form2").fadeOut('slow');
344        $("div#overlay2").fadeOut('slow');
345        return false;
346    });
347
348    $(document).on('click', '.subsc_good', function () {
349        var form = $(this).parents('form');
350        if ($(form).find('input#check10').length && !$(form).find('input#check10').prop("checked")) {
351            $(form).find('.checkbox_block label').addClass('error_input');
352            $(form).find('.checkbox_block label:first-child').focus();
353            return false
354        }
355
356        $("div#overlay4").fadeIn('slow').css({
357            "top": 0
358        });
359        var th = $(this);
360        var form = th.parents('.js_shop').find(".no_buy_good_block");
361        form.fadeIn('slow').find('input:not([type="hidden"]):first').focus();
362        form.css("height", "auto");
363        var heigh = form.innerHeight() + 1;
364        form.css({
365            "height": heigh
366        });
367        return false;
368    });
369
370    /*     diafan_ajax.success['shop_wait'] = function(form, response) {
371            $(".no_buy_good_block").fadeOut('slow');
372            $("div#overlay4").fadeOut('slow');
373        } */
374
375    $(document).on('click', '.no_buy__close, div#overlay4', function () {
376        $(".no_buy_good_block").fadeOut('slow');
377        $("div#overlay4").fadeOut('slow');
378        return false;
379    });
380
381    $(document).on('click', 'a.koma', function () {
382        $("div#overlay").fadeIn('slow');
383        $("#modal_form3").css("height", "auto");
384        var heigh = $("#modal_form3").innerHeight() + 4;
385        $("#modal_form3").fadeIn('slow').css({
386            "height": heigh
387        });
388        return false;
389    });
390
391    $(document).on('click', '.modal_form3__close,div#overlay', function () {
392        $("div#overlay").fadeOut('slow');
393        $("#modal_form3").fadeOut('slow');
394        return false;
395    });
396
397
398    $(document).on('click', '.ratin input', function () {
399        $(this).prevAll('label').css('color', '#efce4a');
400        $(this).nextAll('label').css('color', '#d9d9d9');
401        $(this).next('label').css('color', '#efce4a');
402    });
403
404
405    $(document).on('click', ".shop-like", function (e) {
406        var self = this;
407        if ($(this).hasClass("active"))
408            $(this).removeClass("active").removeClass("animate")
409        else {
410            $(this).addClass("animate");
411            setTimeout(function () {
412                $(self).addClass("active")
413            }, 50);
414        }
415        ;
416    });
417
418    //выбор размера
419    $('.checkbox_block input:checked').prop("checked", false);
420
421    $(document).on('change', '.checkbox_block input', function () {
422        var value = $(this).attr('value');
423        var name = $(this).attr('name');
424        var form = $(this).parents('form');
425        if (!form.find('input#check10').prop("checked")) {
426            form.find('input#check10').prop("checked", true);
427            form.find('.checkbox_block label').removeClass('error_input');
428            form.find('span.js_shop_no_buy.shop_no_buy').show();
429        }
430        if (form.find('.checkbox_block').hasClass('checkbox_block__select')) {
431            $('.js_shop_depend_param[name="' + name + '"]').find('option').prop("selected", false);
432            $('.js_shop_depend_param[name="' + name + '"]').find('option[value="' + value + '"]').prop("selected", true).change();
433        }
434    });
435    $('.shop_form').each(function () {
436        var form = $(this);
437        if (!form.find('select[name="param10"]').length)
438            form.find('span.js_shop_no_buy.shop_no_buy').show();
439    });
440
441    //отмена покупки, если размер товара не выбран
442    diafan_ajax.before['shop_buy'] = function (form) {
443        if ($(form).find('input#check10').length && !$(form).find('input#check10').prop("checked")) {
444            $(form).find('.checkbox_block label').addClass('error_input');
445            $(form).find('.checkbox_block label:first-child').focus();
446            return false;
447        }
448    }
449
450    $(document).on('click', '.vojta', function () {
451        $("div#overlay").fadeIn('slow');
452
453        $("#modal_form").fadeIn('slow').find('input:not([type="hidden"]):first').focus();
454        $("#modal_form").css("height", "auto");
455        var heigh = $("#modal_form").innerHeight() + 19;
456        $("#modal_form").css({
457            "height": heigh
458        });
459        return false;
460    });
461
462
463    $(document).on('click', '.modal_form__close,div#overlay', function () {
464        $("div#overlay").fadeOut('slow');
465        $("#modal_form").fadeOut('slow');
466        return false;
467    });
468
469    diafan_ajax.success['shop_buy'] = function (form, response) {
470        $("div#overlay3").fadeIn('slow');
471        // form.parents('.js_shop').find(".moda_3").fadeIn('slow');
472        form.parents('.js_shop').find(".moda_3").fadeIn('slow').promise().done(function () {
473            form.parents('.js_shop').find(".moda_3").css("height", "auto");
474            var heigh = form.parents('.js_shop').find(".moda_3").innerHeight() + 1;
475            form.parents('.js_shop').find(".moda_3").css({
476                "height": heigh
477            });
478        });
479        // return false;
480    }
481
482
483    diafan_ajax.success['comments_add'] = function (form, response) {
484        $("#modal_form3").fadeOut('slow');
485        $("div#overlay").fadeOut('slow');
486    }
487
488
489    $(document).on('click', '.moda_3__close, #overlay3, .btn_cl', function () {
490        $(".moda_3").fadeOut('slow');
491        $("div#overlay3").fadeOut('slow');
492        return false;
493    });
494
495    var widt = $(window).width();
496    bla(widt);
497
498    diafan_ajax.success['cart_recalc'] = function (form, response) {
499        widt = $(window).width();
500        bla(widt);
501    }
502
503    mobileAction(widt);
504
505    $(window).resize(function () {
506        widt = $(window).width();
507        mobileAction(widt);
508        bla(widt);
509        changeFooterHeight ();
510    });
511
512    // Запись куки для вывода всех товаров в каталоге + перезагрузка страницы (куки используется в shop.model.php)
513    $(document).on('click', '.link_all_items__is', function (event) {
514        event.preventDefault();
515        var cookie = readCookie('show_all');
516        if (cookie) {
517            deleteCookie('show_all');
518            var url = window.location.href;
519            url = url.replace( /\/page[1-9]{1,3}/g, '' );
520            location.assign(url);
521        }
522    });
523
524    $(document).on('click', '.link_all_items__all', function (event) {
525        event.preventDefault();
526        var cookie = readCookie('show_all');
527        if (!cookie) {
528            deleteCookie('show_all');
529            createCookie('show_all', true, 365);
530            var url = window.location.href;
531            url = url.replace( /\/page[1-9]{1,3}/g, '' );
532            location.assign(url);
533        }
534    });
535
536
537});
538
539function createCookie(name, value, days) {
540    if (days) {
541        var date = new Date();
542        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
543        var expires = "; expires=" + date.toGMTString();
544    }
545    else var expires = "";
546    document.cookie = name + "=" + value + expires + "; path=/";
547}
548
549function readCookie(name, value, options) {
550    var nameEQ = name + "=";
551    var ca = document.cookie.split(';');
552    for (var i = 0; i < ca.length; i++) {
553        var c = ca[i];
554        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
555        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
556    }
557    return null;
558}
559
560function deleteCookie(name) {
561    createCookie(name, "", -1);
562}
563
564function coupon() {
565
566}
567
568//$(window).trigger('resize');
569
570function bla(widt) {
571    setTimeout(function() {
572      var cord = $('.cart_table .cart_last_trr').offset();
573      $('.coupon_block').offset(cord);
574    }, 1000);
575
576//корзина
577    if (widt <= 800) {
578        $('.cart th.cart_name, table.wishlist tr th.wish_name').text('Наименование');
579        $('.cart th.cart_count, table.wishlist tr th.wish_count, table.cart.resulya thead tr th.cart_count').text('Кол-во');
580        $('table.cart.resulya th.cart_summ').text('Сумма');
581        $('.cart').find('.cart_delivery').attr('colSpan', 2);
582        $('table.user_order').find('th.sum').text('Сумма');
583        $('td.cart_additional').attr('colSpan', 2);
584    }
585    else {
586
587        $('.cart th.cart_name, table.wishlist tr th.wish_name').text('Наименование товара');
588        $('.cart th.cart_count, table.wishlist tr th.wish_count, table.cart.resulya thead tr th.cart_count').text('Количество');
589        $('table.cart.resulya th.cart_summ').text('Сумма заказа');
590
591        if (!$(".cart_old_price").is(":visible")) {
592            $('td.cart_additional').attr('colSpan', 2);
593            $('.cart').find('.cart_delivery').attr('colSpan', 3);
594        }
595        else {
596            $('td.cart_additional').attr('colSpan', 3);
597            $('.cart').find('.cart_delivery').attr('colSpan', 4);
598        }
599    }
600
601}
602
603// Вывод всплывающего окна с текстом пользователя (оповещение) начало---
604// Прописываем куки при закрытии окна пользователем
605  $(document).on('click', '.modal.usertext .close, #overlay.usertext', function() {
606    console.log('сообщение просмотрено, theme.js с.514');
607    $("div#overlay").removeClass('usertext');
608    createCookie('read_message', true, 1);
609    return false;
610  });
611
612// Скрытие модельно окна
613  $(document).on('click', '.modal .close, #overlay', function() {
614    $("#overlay").removeClass('usertext').fadeOut('slow');
615    $(".modal").fadeOut('slow');
616    return false;
617  });
618
619// Проверка кук и вида при загрузке
620function checkCookieRead() {
621  var cookie_txt = readCookie('read_message');
622  //console.log(cookie_txt);
623  if ( !cookie_txt && cookie_txt==null ) { //если нет кук, т.е. сообщение ранее не показывалось
624    $("div#overlay").addClass('usertext').fadeIn('slow');
625    $(".modal.usertext").fadeIn('slow');
626    $(".modal.usertext").css("height", "auto");
627    var heigh = $(".modal.usertext").innerHeight() + 19;
628    $(".modal.usertext").css("height", heigh);
629  }
630}
631// ---Вывод всплывающего окна с текстом пользователя (оповещение) конец
632
633// Скрытие блоков с ошибками
634$('div.errors').click(function(){
635  $(this).fadeOut(200);
636});
637
638var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));
639
640//console.log(isTouch);
641
642if(isTouch) {
643
644  $('li.parent > a').click( function() {
645
646    $(this).toggleClass('worked');
647    if( !$(this).hasClass('worked') ) {} else { return false; }
648
649  });
650
651}
652
653// CDEK блокировка адреса в корзине при перезагрузке страницы
654  cdek_adress = $('.cart_delivery .sdek_pvz_address').text();
655  console.log( cdek_adress.length );
656  if( cdek_adress.length > 1 ){
657    sdek_city = $('input.sdek_city_input').val()
658    $('div.pole.order_form_param4 input').attr('readonly','readonly').val(sdek_city+', '+cdek_adress).prev('.infofield').text('Адрес доставки (заполнен автоматически):');
659  } else {
660    $('div.pole.order_form_param4 input').removeAttr('readonly').val('').prev('.infofield').text('Адрес доставки:');
661  }
662
663// Вывод списка пользователей CSV
664function userdata() {
665  $(".data_out").fadeToggle(300);
666}

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.