1$(function () { 2 function updateCart(data) 3 { 4 $(".cart-total").html(data.total); 5 if (data.discount_numeric) { 6 $(".cart-discount").closest('tr').show(); 7 } 8 $(".cart-discount").html('− ' + data.discount); 9 10 if (data.add_affiliate_bonus) { 11 $(".affiliate").show().html(data.add_affiliate_bonus); 12 } else { 13 $(".affiliate").hide(); 14 } 15 16 } 17 18 // add to cart block: services 19 $(".services input:checkbox").click(function () { 20 var obj = $('select[name="service_variant[' + $(this).closest('tr').data('id') + '][' + $(this).val() + ']"]'); 21 if (obj.length) { 22 if ($(this).is(':checked')) { 23 obj.removeAttr('disabled'); 24 } else { 25 obj.attr('disabled', 'disabled'); 26 } 27 } 28 }); 29 30 31 $(".cart a.delete").click(function () { 32 var tr = $(this).closest('tr'); 33 $.post('delete/', {html: sumbolrub, id: tr.data('id')}, function (response) { 34 if (response.data.count == 0) { 35 location.reload(); 36 } 37 tr.remove(); 38 updateCart(response.data); 39 $('.wrap-cart-load').load(location.href, function () { 40 $(window).unbind('load.jcarousel, resize.jcarousel'); 41 $('ul[class^="product-slider-"]').jcarousel({ 42 scroll: 1, 43 buttonNextHTML: '<div><i class="icon-angle-right"></i></div>', 44 buttonPrevHTML: '<div><i class="icon-angle-left"></i></div>', 45 reloadCallback: function(carousel){ carousel.scroll(1, false); carousel.list.css('left', 0); } 46 }); 47 }); 48 }, "json"); 49 return false; 50 }); 51 52 $(".cart input.qty").change(function () { 53 var that = $(this); 54 if (that.val() > 0) { 55 var tr = that.closest('tr'); 56 if (that.val()) { 57 $.post('save/', {html: sumbolrub, id: tr.data('id'), quantity: that.val()}, function (response) { 58 tr.find('.item-total').html(response.data.item_total); 59 if (response.data.q) { 60 that.val(response.data.q); 61 } 62 if (response.data.error) { 63 alert(response.data.error); 64 } else { 65 that.removeClass('error'); 66 } 67 updateCart(response.data); 68 }, "json"); 69 } 70 } else { 71 that.val(1); 72 } 73 }); 74 75 $(".cart .services input:checkbox").change(function () { 76 var div = $(this).closest('div'); 77 var tr = $(this).closest('tr'); 78 if ($(this).is(':checked')) { 79 var parent_id = $(this).closest('tr').data('id') 80 var data = {html: sumbolrub, parent_id: parent_id, service_id: $(this).val()}; 81 var variants = $('select[name="service_variant[' + parent_id + '][' + $(this).val() + ']"]'); 82 if (variants.length) { 83 data['service_variant_id'] = variants.val(); 84 } 85 $.post('add/', data, function(response) { 86 div.data('id', response.data.id); 87 tr.find('.item-total').html(response.data.item_total); 88 updateCart(response.data); 89 }, "json"); 90 } else { 91 $.post('delete/', {html: sumbolrub, id: div.data('id')}, function (response) { 92 div.data('id', null); 93 tr.find('.item-total').html(response.data.item_total); 94 updateCart(response.data); 95 }, "json"); 96 } 97 }); 98 99 $(".cart .services select").change(function () { 100 var tr = $(this).closest('tr'); 101 $.post('save/', {html: sumbolrub, id: $(this).closest('div').data('id'), 'service_variant_id': $(this).val()}, function (response) { 102 tr.find('.item-total').html(response.data.item_total); 103 updateCart(response.data); 104 }, "json"); 105 });
106 107 $("#cancel-affiliate").click(function () { 108 $(this).closest('form').append('<input type="hidden" name="use_affiliate" value="0">').submit(); 109 return false; 110 }); 111 112 $('.cart-quantity').each(function(){ 113 var asd = $(this); 114 asd.find('a.minus').click(function() { 115 var data = asd.find('input').val(); 116 if(data >= 2){asd.find('input').val(parseInt(data) - 1).change();} 117 return false 118 }); 119 asd.find('a.plus').click(function() { 120 var data = asd.find('input').val(); 121 asd.find('input').val(parseInt(data) + 1).change(); 122 return false 123 }); 124 }); 125});
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.