1(function ($) { 2 $.incarts = { 3 options: {}, 4 init: function (options) { 5 this.options = options; 6 this.initSpan('body'); 7 }, 8 initSpan: function (className) { 9 var self = this; 10 11 if (self.options.show_info) { 12 $(className + ' span.inCarts').html(self.options.show_info); 13 } 14 15 if (self.options.submit_class && self.options.selector_submit) { 16 $(className + ' span.inCarts').closest('form').find(self.options.selector_submit).each(function(i, e) { 17 $(e).addClass(self.options.submit_class); 18 }); 19 } 20 21 if (self.options.submit_name && self.options.selector_name) { 22 $(className + ' span.inCarts').closest('form').find(self.options.selector_name).each(function(i, e) { 23 if ($(e).attr('value')) { 24 $(e).val(self.options.submit_name); 25 } else { 26 $(e).html(self.options.submit_name); 27 } 28 }); 29 } 30 31 if (self.options.action_add && self.options.selector_submit) { 32 $(className + ' span.noInCarts').closest('form').find(self.options.selector_submit).each(function(i, e) { 33 if (!$(e).hasClass('event-inCarts')) { 34 35 $(e).on('click', function() { 36 var product_id = $(this).closest('form').find('[name="product_id"]').val(); 37 38 if (self.options.show_info) { 39 $('span.noInCarts[data-product_id="'+product_id+'"]').html(self.options.show_info).addClass('inCarts'); 40 } 41 42 if (self.options.submit_class) { 43 $('span.noInCarts[data-product_id="'+product_id+'"]').closest('form').find(self.options.selector_submit).addClass(self.options.submit_class); 44 } 45 46 if (self.options.submit_name && self.options.selector_name) { 47 $('span.noInCarts[data-product_id="'+product_id+'"]').closest('form').find(self.options.selector_name).each(function(i, e) { 48 if ($(e).attr('value')) { 49 $(e).val(self.options.submit_name); 50 } else { 51 $(e).html(self.options.submit_name); 52 } 53 }); 54 } 55 }); 56 57 $(e).addClass('event-inCarts'); 58 } 59 }); 60 } 61 62 /* 63 if (self.options.selector_remove) { 64 $('body').on('click', self.options.selector_remove, function(e) { 65 var product_id = $(this).data('id') || $(this).data('product_id'); 66 if (product_id) { 67 if (self.options.show_info) { 68 $('span.inCarts[data-product_id="'+product_id+'"]').html('').addClass('noInCarts'); 69 } 70 71 if (self.options.submit_class && self.options.selector_submit) { 72 $('span.inCarts[data-product_id="'+product_id+'"]').closest('form').find(self.options.selector_submit).removeClass(self.options.submit_class); 73 } 74 75 if (self.options.submit_name && self.options.selector_name) { 76 $('span.inCarts[data-product_id="'+product_id+'"]').closest('form').find(self.options.selector_name).each(function(i, e) { 77 if ($(e).attr('value')) { 78 79 } else { 80 81 } 82 }); 83 } 84 } 85 }); 86 } 87 */ 88 } 89 }; 90})(jQuery);
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.