1$(function () { 2 3 $(document.body).on('click', '.auto-order-edit', function() { 4 $('.row-item-product .not-instock').each(function(i, e) { 5 $(e).closest('.row-item-product').find('a.delete').trigger('click') 6 }); 7 8 $('.row-item-product .not-instock2').each(function(i, e) { 9 var count = $(e).data('count'); 10 $(e).closest('.row-item-product').find('input.qty').val(count).removeClass('error').trigger('change'); 11 $(e).remove(); 12 }); 13 }); 14 15 function updateCart(data) 16 { 17 $(".cart-total").html(data.total); 18 if (data.discount_numeric) { 19 $(".cart-discount").closest('div.row').show(); 20 } 21 $(".cart-discount").html('− ' + data.discount); 22 23 let bonusRow = parseInt(data.add_affiliate_bonus.replace(/[^.0-9]/gim, '')); 24 $(".affiliate strong span").html(bonusRow); 25 26 if (data.add_affiliate_bonus) { 27 /*$(".affiliate").show().html(data.add_affiliate_bonus);*/ 28 $(".affiliate").show() 29 } else { 30 $(".affiliate").hide(); 31 } 32 33 if (typeof $.flexdiscountFrontend !== 'undefined') { 34 $.flexdiscountFrontend.cartChange(); 35 } 36 37 let totalRow = data.total.replace(/[^0-9]/gim, ''); 38 let partnerBonus = parseInt(+totalRow * 0.07); 39 $('.partner-bonus span b').html(partnerBonus+' ÑÑб.'); 40 41 $.ajax({ 42 url: "/repeatorder/", 43 type: "POST", 44 data: {'type':'cart'}, 45 async: false, 46 success: function(ret) { 47 $('.js-weight-value span').html(ret.data.weight); 48 } 49 }); 50 } 51 52 $(".cart a.delete").click(function () { 53 var row = $(this).closest('div.row'); 54 $.post('delete/', {html: 1, id: row.data('id')}, function (response) { 55 if (response.data.count == 0) { 56 location.reload(); 57 } 58 row.remove(); 59 updateCart(response.data); 60 61 $('.product-iteration').each(function(i, e) { 62 var it = +i + 1; 63 $(e).html(it+'.'); 64 }); 65 }, "json"); 66 return false; 67 }); 68 69 $(".cart .quantity-minus1, .cart .quantity-plus1").on('click', function () { 70 var that = $(this).parent().find('input'); 71 if (that.val() > 0) { 72 var row = that.closest('div.row'); 73 if ($(this).hasClass('quantity-minus1')) { 74 var quantity = parseInt($(this).next().val()); 75 if (quantity > 1) quantity = quantity - 1; 76 $(this).next().val(quantity); 77 } 78 if ($(this).hasClass('quantity-plus1')) { 79 var quantity = parseInt($(this).prev().val()); 80 if (quantity >= 0) quantity = quantity + 1; 81 $(this).prev().val(quantity); 82 } 83 if (that.val()) { 84 $.post('save/', {html: 1, id: row.data('id'), quantity: that.val()}, function (response) { 85 row.find('.item-total').html(response.data.item_total); 86 if (response.data.q) { 87 that.val(response.data.q); 88 } 89 if (response.data.error) { 90 if (response.data.error.indexOf('но в налиÑии ÑолÑко') !== -1) { 91 $.fancybox( 92 '<p style="margin-bottom: 10px;"> </p> <p style="font-size: 17px;text-align: center; min-width: 350px;">РналиÑии ÑолÑко <b>'+response.data.q+' ÑÑ.</b></p> <p style="text-align: center;"><input style="font-size: 18px;" type="button" value="ÐÑодолжиÑÑ" class="continueSelect" onclick="$.fancybox.close(); return false;"></p>', 93 { } 94 ); 95 } else { 96 alert(response.data.error); 97 } 98 } 99 updateCart(response.data); 100 }, "json"); 101 } 102 } else { 103 that.val(1); 104 } 105 });
106 107 $(".cart input.qty").change(function () { 108 var that = $(this); 109 if (that.val() > 0) { 110 var row = that.closest('div.row'); 111 if (that.val()) { 112 $.post('save/', {html: 1, id: row.data('id'), quantity: that.val()}, function (response) { 113 row.find('.item-total').html(response.data.item_total); 114 if (response.data.q) { 115 that.val(response.data.q); 116 } 117 if (response.data.error) { 118 if (response.data.error.indexOf('но в налиÑии ÑолÑко') !== -1) { 119 $.fancybox( 120 '<p style="margin-bottom: 10px;"> </p> <p style="font-size: 17px;text-align: center; min-width: 350px;">РналиÑии ÑолÑко <b>'+response.data.q+' ÑÑ.</b></p> <p style="text-align: center;"><input style="font-size: 18px;" type="button" value="ÐÑодолжиÑÑ" class="continueSelect" onclick="$.fancybox.close(); return false;"></p>', 121 { } 122 ); 123 } else { 124 alert(response.data.error); 125 } 126 } 127 updateCart(response.data); 128 }, "json"); 129 } 130 } else { 131 that.val(1); 132 } 133 }); 134 135 $(".cart .services input:checkbox").change(function () { 136 var obj = $('select[name="service_variant[' + $(this).closest('div.row').data('id') + '][' + $(this).val() + ']"]'); 137 if (obj.length) { 138 if ($(this).is(':checked')) { 139 obj.removeAttr('disabled'); 140 } else { 141 obj.attr('disabled', 'disabled'); 142 } 143 } 144 145 var div = $(this).closest('div'); 146 var row = $(this).closest('div.row'); 147 if ($(this).is(':checked')) { 148 var parent_id = row.data('id') 149 var data = {html: 1, parent_id: parent_id, service_id: $(this).val()}; 150 var variants = $('select[name="service_variant[' + parent_id + '][' + $(this).val() + ']"]'); 151 if (variants.length) { 152 data['service_variant_id'] = variants.val(); 153 } 154 $.post('add/', data, function(response) { 155 div.data('id', response.data.id); 156 row.find('.item-total').html(response.data.item_total); 157 updateCart(response.data); 158 }, "json"); 159 } else { 160 $.post('delete/', {html: 1, id: div.data('id')}, function (response) { 161 div.data('id', null); 162 row.find('.item-total').html(response.data.item_total); 163 updateCart(response.data); 164 }, "json"); 165 } 166 }); 167 168 $(".cart .services select").change(function () { 169 var row = $(this).closest('div.row'); 170 $.post('save/', {html: 1, id: $(this).closest('div').data('id'), 'service_variant_id': $(this).val()}, function (response) { 171 row.find('.item-total').html(response.data.item_total); 172 updateCart(response.data); 173 }, "json"); 174 }); 175 176 $("#cancel-affiliate").click(function () { 177 $(this).closest('form').append('<input type="hidden" name="use_affiliate" value="0">').submit(); 178 return false; 179 }) 180 181 $("div.addtocart input:button").click(function () { 182 var f = $(this).closest('div.addtocart'); 183 if (f.data('url')) { 184 var d = $('#dialog'); 185 var c = d.find('.cart'); 186 c.load(f.data('url'), function () { 187 c.prepend('<a href="#" class="dialog-close">×</a>'); 188 c.find('form').data('cart', 1); 189 d.show(); 190 if ((c.height() > c.find('form').height())) { 191 c.css('bottom', 'auto'); 192 } else { 193 c.css('bottom', '15%'); 194 } 195 }); 196 return false; 197 } 198 $.post($(this).data('url'), {html: 1, product_id: $(this).data('product_id')}, function (response) { 199 if (response.status == 'ok') { 200 var cart_total = $(".cart-total");
201 $("#cart-content").parent().load(location.href, function () { 202 cart_total.closest('#cart').removeClass('empty'); 203 cart_total.html(response.data.total); 204 }); 205 } 206 }, 'json'); 207 return false; 208 }); 209});
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.