PageSourceSearch

https://casadafare.com/wp-content/plugins/wc-quantity-plus-minus-button/assets/js/scripts.js?ver=1.0.0

js casadafare.com collected 2026-10-03 18:24:17 UTC 3,647 bytes, 96 lines download raw bytes

1jQuery(function ($) {
2
3    // Make the code work after page load.
4    $(document).ready(function () {
5        QuantityChange();
6    });
7
8    // Make the code work after executing AJAX.
9    $(document).ajaxComplete(function () {
10        QuantityChange();
11    });
12
13    $(document.body).on('change','ul.products input.input-text.qty.text',function(){
14        var qty_val = $(this).val();
15        if(typeof qty_val !== 'undefined' ){
16            $(this).closest('li.product').find('a.button').attr('data-quantity', qty_val);
17        }
18        
19    });
20    // alert(444444);
21    // $(document.body).on('click', '.qib-button',function(){
22    //     alert(2323);
23    //     QuantityChange();
24    // });
25    function QuantityChange() {
26        $(document).off("click", ".qib-button").on("click", ".qib-button", function () {
27            // Find quantity input field corresponding to increment button clicked.
28            var qty = $(this).siblings(".quantity").find(".input-text");
29            // Read value and attributes min, max, step.
30            var val = parseFloat(qty.val());
31            var max = parseFloat(qty.attr("max"));
32            var min = parseFloat(qty.attr("min"));
33            var step = parseFloat(qty.attr("step"));
34            // var static = 8;
35            
36            var qtyObj = $(this).siblings(".quantity");
37            var last_step = qtyObj.attr('data-last_step');
38            last_step = parseFloat( last_step );
39            var prev_step = qtyObj.attr('data-prev_step');
40            prev_step = parseFloat( prev_step );
41            // Change input field value if result is in min and max range.
42            // If the result is above max then change to max and alert user about exceeding max stock.
43            // If the field is empty, fill with min for "-" (0 possible) and step for "+".
44            if ($(this).is(".plus")) {
45                if (val === max){
46                    return false;
47                }
48                    
49                if (isNaN(val)) {
50                    qty.val(step);
51                    return false;
52                }
53                if (val + step > max) {
54                    qtyObj.attr('data-last_step', ( max-val < 0 ? 1 : max-val ) );
55                    qtyObj.attr('data-prev_step', ( step ) );
56                    qtyObj.find(".input-text").removeAttr('step' );
57                    qty.val(max);
58                } else {
59                    qty.val(val + step);
60                }
61            } else {
62
63                if (last_step) {
64                    
65                    qty.val(max - last_step);
66                    qtyObj.removeAttr('data-last_step');
67                    qtyObj.find(".input-text").attr('step', prev_step );
68                    qtyObj.removeAttr('data-prev_step');
69                    return false;
70                }
71                if (val === min){
72                    return false;
73                }
74                    
75                if (isNaN(val)) {
76                    qty.val(min);
77                    return false;
78                }
79                if (val - step < min) {
80                    qty.val(min);
81                } else {
82                    qty.val(val - step);
83                }
84            }
85            qty.val(Math.round(qty.val() * 100000) / 100000);
86            qty.trigger('change');
87
88            // Ajax call has been removed here.
89            // setTimeout(function(){
90			// 	$('button.button[name=update_cart]').trigger('click');
91			// }, 800);
92            $("body").removeClass("sf-input-focused");
93        });
94    }
95
96});

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.