PageSourceSearch

https://senfeng.ru/bitrix/templates/aspro_max_2026_copy/js/buy_services.js?17838995745835

js senfeng.ru collected 2026-10-08 16:32:09 UTC 5,835 bytes, 121 lines download raw bytes

1
2$(document).on('click', '.services_in_product .switch_block label', function(){
3    var $this = $(this);    
4    var servItem = $this.closest('.services-item');
5    var servBuyButton = servItem.find('.services-item__buy .button_block .to-cart');
6    var switcherState = servItem.find('#'+$this.attr('for')).prop('checked');
7    var parentProduct = $this.closest('.buy_services_wrap').attr('data-parent_product');
8    
9    if(servBuyButton.length) {
10        if(switcherState){ 
11            var basketItem = arBasketAspro.SERVICES[servItem.attr('data-item_id') + '_' + parentProduct];
12            var currentWrapClasses = servItem.closest('.buy_services_wrap').attr('class');
13            
14            if(typeof(basketItem) != "undefined" && basketItem['basket_id']){
15                $.ajax({
16                    url: arAsproOptions['SITE_DIR'] + 'ajax/item.php?delete_basket_id='+basketItem['basket_id'],
17                    type: 'post',
18                    success: function(html) {
19                        updateBasketInfoServices();
20                        getActualBasket();                                                
21                    }
22                });
23            } 
24            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+']').removeClass('services_on');
25            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+'] input[name="buy_switch_services"]').each(function (){
26                var _th = $(this);
27                if(_th.closest('.buy_services_wrap').attr('class') !== currentWrapClasses){
28                    _th.prop('checked', false);
29                }                    
30                
31            });            
32        } else {
33            var parentProductId =  arBasketAspro.BASKET[parentProduct];
34            var currentWrapClasses = servItem.closest('.buy_services_wrap').attr('class');
35            var isBasketPage = servItem.closest('.buy_services_wrap').hasClass('services_in_basket_page');
36
37            if(parentProductId || isBasketPage){
38                servBuyButton[0].click();
39            }
40            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+']').addClass('services_on');
41            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+'] input[name="buy_switch_services"]').each(function (){
42                var _th = $(this);
43                if(_th.closest('.buy_services_wrap').attr('class') !== currentWrapClasses){
44                    _th.prop('checked', true);
45                }
46            });
47        }
48    }
49});
50
51function updateBasketInfoServices (refreshBasket){
52    if(refreshBasket === undefined)
53        refreshBasket = true;
54
55    var basketFly = $('#basket_line .basket_fly').length;
56
57    if(basketFly){
58        $.ajax({
59        url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
60        type: 'post',
61        success: function(html) {
62            $('#basket_line .basket_fly').addClass('loaded').html(html);
63            if(window.matchMedia('(min-width: 769px)').matches)
64			{
65                $('.opener .basket_count').removeClass('small')
66                $('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
67                $('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
68                $("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
69            }
70        }
71        });
72    } else if($("#ajax_basket").length){
73        reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
74        basketTop('', $('.basket_hover_block'));
75    }
76
77    //for basket page
78    if($('.wrapper1.basket_page').length && refreshBasket){
79        BX.Sale.BasketComponent.sendRequest('refreshAjax', {
80            fullRecalculation: 'Y',
81            otherParams: {
82               param: 'N'
83            }
84         });
85    }
86}
87
88$(document).on("change", ".services_in_product .counter_block input[type=text]", function(e){
89    var $this = $(this);    
90    var servItem = $this.closest('.services-item');
91    var servBuyButton = servItem.find('.services-item__buy .button_block .to-cart');
92    var parentProduct = $this.closest('.buy_services_wrap').attr('data-parent_product');
93    var servCount = servItem.find('.counter_block  input.text').val();
94
95    $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+'] .counter_block  input.text').val(servCount);
96
97    if(servBuyButton.length) {
98        var basketItem = arBasketAspro.SERVICES[servItem.attr('data-item_id') + '_' + parentProduct];
99        var quantity = $this.val();
100
101        if(typeof(basketItem) != "undefined" && basketItem['basket_id']){
102            $.ajax({
103                url: arAsproOptions['SITE_DIR'] + 'ajax/item.php?update_basket_id='+basketItem['basket_id'] + '&quantity=' + quantity,
104                type: 'post',
105                success: function(html) {
106                    updateBasketInfoServices();
107                    getActualBasket();
108                }
109            });
110        }
111    }
112});
113
114$(document).on('click', '.services_in_product .more-services-slide', function(){
115    var _this = $(this);
116    var servWrap = _this.closest('.buy_services_wrap');
117    servWrap.toggleClass('show_all');
118    servWrap.hasClass('show_all') ? _this.find('>span').text(_this.attr('data-close')) : _this.find('>span').text(_this.attr('data-open'));
119});
120
121

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.