PageSourceSearch

https://www.signzoom.com/assets/frontend/theme_6/js/cart.js?id=95bd965ec52f23285f2a0efb8798de80

js signzoom.com collected 2026-10-08 13:09:12 UTC 3,948 bytes, 123 lines download raw bytes

1$(function() {
2    Cart = {
3        submitNextAction: null,
4        emptyCartRoute: null,
5
6        init: function () {
7            this.initSelectors();
8            this.bindEvents();
9        },
10
11        initSelectors: function () {
12            this.selectors = {
13                cartForm: $("#cartForm"),
14                submitButton: $('.js_submit'),
15                incrementQuantity: $('.js_plus'),
16                decrementQuantity: $('.js_minus'),
17                emptyCart: $('.js_empty_cart'),
18                emptyCartModalConfirm: $("#confirmEmptyCartModal"),
19                quantityInput: $('.js_quantity_input')
20            }
21        },
22
23        bindEvents: function () {
24            this.selectors.submitButton.on('click', this.submitButtonClicked);
25            this.selectors.cartForm.on('submit', this.beforeSubmitCartForm);
26            this.selectors.incrementQuantity.on('click', this.incrementQuantity);
27            this.selectors.decrementQuantity.on('click', this.decrementQuantity);
28            this.selectors.emptyCart.on('click', this.showConfirmEmptyCart);
29
30            var _this = this;
31
32            this.selectors.quantityInput.on('change', function (e) {
33                var productId = +$(e.target).data().productId;
34                var track = +$(e.target).data().track;
35
36                if (+e.target.value < 1 || isNaN(+e.target.value)) {
37                    $(e.target).val(1);
38                    return;
39                }
40
41                if (track) {
42                    _this.checkProductAvailability(productId, +e.target.value, $(e.target));
43                }
44            });
45        },
46
47        checkProductAvailability: function (productId, quantity, input) {
48            this.selectors.submitButton.attr('disabled', 'disabled');
49            var _this = this;
50
51            $.ajax({
52                type: 'GET',
53                url: route('frontend.product.get', { id: productId }),
54                success: function (product) {
55                    _this.selectors.submitButton.removeAttr('disabled');
56                    if (product.quantity <= 0) {
57                        input.val(0);
58                    } else if (product.quantity < quantity) {
59                        input.val(product.quantity);
60                    }
61                },
62            });
63        },
64
65        incrementQuantity: function (event) {
66            var _this = Cart,
67              $self = $(event.currentTarget),
68              $quantityInput = $self.parent().find('.js_quantity_input'),
69              quantity = $quantityInput.val();
70
71            var productId = +$quantityInput.data().productId;
72            var track = +$quantityInput.data().track;
73
74            ++quantity
75
76            if (track) {
77                _this.checkProductAvailability(productId, quantity, $quantityInput);
78            }
79
80            $quantityInput.val(quantity);
81        },
82
83        decrementQuantity: function (event) {
84            var _this = Cart,
85              $self = $(event.currentTarget),
86              $quantityInput = $self.parent().find('.js_quantity_input'),
87              quantity = $quantityInput.val();
88
89            --quantity;
90            if (quantity < 1) {
91                return;
92            }
93
94            $quantityInput.val(quantity);
95        },
96
97        showConfirmEmptyCart: function () {
98            var _this = Cart;
99
100            _this.selectors.emptyCartModalConfirm.modal('show');
101        },
102
103        submitButtonClicked: function (event) {
104            var _this = Cart,
105                $self = $(event.currentTarget),
106                id = $self.attr('id');
107
108            _this.submitNextAction = id;
109        },
110
111        beforeSubmitCartForm: function (event) {
112            var _this = Cart;
113
114            _this.selectors.cartForm.append($('<input>', {
115                type: 'hidden',
116                name: 'next_action',
117                val: _this.submitNextAction
118            }));
119        },
120    }
121
122    Cart.init();
123});

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.