PageSourceSearch

https://hondabike.co.il/wp-content/themes/hondabike_24/src/js/ajax.js?ver=1.1122222

js hondabike.co.il collected 2026-09-29 17:33:19 UTC 3,962 bytes, 101 lines download raw bytes

1(function($){
2    const cart_total = []
3	$('.remove-product').click(function(e){
4        this.closest('.product-item').remove()
5		e.preventDefault();
6		$.ajax({
7			type: "POST",
8			url: ajax_params.ajax_url,
9			data: {
10					action: 'remove_item_from_cart',
11				   'cart_item_key': String($(this).data('cart-item-key'))
12				   }
13		});
14    });
15    $('.add-product').click(function(e){
16        const products = []
17        products.push($(this).data())
18        // cart_total.push($(this).data('productPrice'))
19        // console.log(cart_total)
20        // const reducer = (accumulator, currentValue) => accumulator + currentValue;
21        // let current = +$('.popup_cart .priceT1').html()
22        // let total = cart_total.reduce(reducer, current);
23        // console.log(total)
24        const markup = `
25        <li class="product-item" data-cart-item-id="${products[0].cartItemId}">
26        <div class="productT3">
27            <div class="productT3_btn_container">
28            <button class="remove-product productT3_btn btn_closeT1 type2" data-cart-item-key="${products[0].productKey}">
29                <i class="icon-close"></i><span>הסר</span>
30            </button>
31            </div>
32            <div class="productT3_item">
33                <a href="${products[0].productLink}" class="productT3_image"><img src="${products[0].productImage}" alt=""></a>
34                <div class="productT3_text">
35                    <a href="" class="title textT7 redText">${products[0].productTitle}</a>
36                    <div class="price priceT1">${products[0].productPrice}</div>
37                    <div class="amount_container" data-cart-item-id="${products[0].cartItemId}">
38                        <div class="title textT7 boldType">כמות</div>
39                        <button onclick="return product_decrease(this)" class="amount_btn"><span>-</span></button>
40                        <div class="num">1</div>
41                        <button onclick="return product_increase(this)" class="amount_btn"><span>+</span></button>
42                    </div>
43                </div>
44            </div>
45        </div>
46    </li>
47        `
48        $('.popup_cart_list').append(markup)
49		e.preventDefault();
50		$.ajax({
51			type: "POST",
52			url: ajax_params.ajax_url,
53			data: {
54					action: 'add_item_to_cart',
55				   'cart_item_id': String($(this).data('cart-item-id')),
56				   'quantity': String($(this).data('quantity')),
57                   }
58		});
59	});
60
61  $('.all-sale-filter-btn').on('click', function () {
62      $('.all-sale-filter-btn').removeClass('isActive');
63      $(this).addClass('isActive');
64      let termId = $(this).data('term_id');
65
66      // Prepare the overlay with spinner
67      var overlayHtml = '<div class="overlay" style="position: absolute; top: 0; left: 0;display:block; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); z-index: 10;">' +
68                        '<div class="spinner" style="position: absolute; top: 150px; left: 50%; transform: translate(-50%, -50%); border: 4px solid #f3f3f3;
68 border-top: 4px solid #E81B2F; border-radius: 50%; width: 100px; height: 100px; animation: spin 2s linear infinite;"></div>' +
69                        '</div>';
70
71      // Append overlay to .all-sale-grid
72  $('.all-sale-grid').prepend(overlayHtml);
73
74      $.ajax({
75          url: '/wp-admin/admin-ajax.php',
76          type: 'POST',
77          data: {
78              action: 'filter_all_sales',
79              termId: termId,
80          },
81          success: function (response) {
82              $('.all-sale-grid').html(response);
83
84          },
85          error: function (xhr, status, error) {
86              console.log(error);
87          },
88          complete: function() {
89              // Remove the overlay with spinner once the request is complete
90              setTimeout(
91  function() {
92
93    $('.overlay').remove();
94  }, 1000);
95          }
96      });
97  });
98
99  // Don't forget to add keyframe animations for the spinner in your CSS
100
101  })(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.