1$(function(){ 2 Array.prototype.remove = function(from, to) { 3 var rest = this.slice((to || from) + 1 || this.length); 4 this.length = from < 0 ? this.length + from : from; 5 return this.push.apply(this, rest); 6 }; 7 8 var totalWeight = 0; 9 var orders = []; 10 var isLocked = false; 11 $(".add-brochure").click(function(e) { 12 $(".orderlink").addClass("active"); 13 e.preventDefault(); 14 $('.order-message').html(''); 15 var orderId = $(this).data('bid'); 16 var articleWeight = $(this).data('weight'); 17 if(orders.indexOf(orderId) != -1) 18 { 19 totalWeight = totalWeight - articleWeight; 20 orders.remove(orders.indexOf(orderId)); 21 $(this).toggleClass("active"); 22 $(this).closest(".item").toggleClass("active"); 23 //$(".brochure-orders-link").removeClass("active"); 24 $(".brochure-orders-empty").removeClass("active"); 25 26 } 27 else { 28 //$(".brochure-orders-link").addClass("active"); 29 $(".brochure-orders-empty").removeClass("active"); 30 $(".brochure-orders-link").addClass("active"); 31 if(totalWeight + articleWeight <= 950) { 32 totalWeight = totalWeight + articleWeight; 33 orders.push(orderId); 34 $(this).toggleClass("active"); 35 $(this).closest(".item").toggleClass("active"); 36 } 37 else { 38 //$('#order-message').html('Das Gesamtgewicht, darf 950g nicht überschreiten.'); 39 $('.order-message').html('Sie haben das Maximalgewicht erreicht!'); 40 41 } 42 } 43 44 $('#brochures-orderedbrochures').val(orders.join(',')); 45 46 $('#itemcount').html(orders.length); 47 $('#weightcount').html(totalWeight); 48 if(totalWeight > 950 && !isLocked) { 49 $('.add-brochure:not(active)').attr('disabled'); 50 isLocked = true; 51 52 } 53 if(totalWeight <= 950 && isLocked) { 54 $('.add-brochure:not(active)').removeAttr('disabled'); 55 isLocked = false; 56 } 57 }); 58 $(".add-brochure").click(function() { 59 // If checked 60 var value = $(this).data('title'), 61 link = $(this).data('link'), 62 $list = $("#brochure-item-list"); 63 if ($(this).hasClass("active")) { 64 //add to the right 65 $list.append("<li data-value='" + value + "'><a href='#" + link + "'>" + value + "</a></li>"); 66 } 67 else { 68 //hide to the right
69 $list.find('li[data-value="' + value + '"]').slideUp("fast", function() { 70 $(this).remove(); 71 }); 72 } 73 }); 74}); 75 76 77 78 79
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.