PageSourceSearch

https://www.ikea.com.do/webroot/conjurer/js/quantityCounter.js?v=1088

js ikea.com.do collected 2026-10-04 00:54:53 UTC 4,662 bytes, 141 lines download raw bytes

1var qCounter = {
2
3    main: function(){
4        
5        qCounter.init();
6    },
7    
8    "init" : function() {
9        const quantityCounterComponent = $('.itemCounter_js .quantityStepper_js');
10        quantityCounterComponent.removeAttr('aria-live')
11
12        
13        quantityCounterComponent.each(function() {
14            let updateTimer = null;
15
16            $(this)
17                .off('skapa-quantity-stepper-change')
18                .on('skapa-quantity-stepper-change', function(event) {
19
20                    clearTimeout(updateTimer);
21
22                    const $this = $(this);
23
24                    updateTimer = setTimeout(() => {
25
26                        let newValue = event.detail;
27
28                        const minValue = $this.attr("min-value") ? Number($this.attr("min-value")) : null;
29                        const maxValue = $this.attr("max-value") ? Number($this.attr("max-value")) : null;
30
31                        if (minValue !== null && newValue < minValue) {
32                            newValue = minValue;
33                        } else if (maxValue !== null && newValue > maxValue) {
34                            newValue = maxValue;
35                        }
36
37                        $this.val(newValue);
38
39                        qCounter.setValue($this, newValue);
40
41                        $this.find('input').attr('aria-label', newValue);
42
43                    }, 250);
44                }
45            );
46        });       
47    },
48    
49    "setValue": function (obj, value) {
50        if (isNaN(value) == true || value == '' || value == 0 || parseInt(value) < 1) {
51            value = 1;
52        }
53
54        qCounter.showSetValue(obj, value);
55        qCounter.sendValue(obj, value, obj.parents('.itemCounter_js').find('.value').data("partnumber"));
56    },
57    
58    "showSetValue" : function( obj, value ) {
59        
60        if( parseInt(value)  > parseInt(obj.parents('.itemCounter_js').find('.value').data("max")) ) {
61            
62            value = parseInt(obj.parents('.itemCounter_js').find('.value').data("max") );
63        }
64        
65        obj.parents('.itemCounter_js').find('.quantityStepper_js').data('value', value);   
66    }
67    ,
68    
69    "sendValue" : function( obj,quantity, id_item ) {
70        var $wcModal = $("#wc-modal");
71
72        if (($wcModal.length && $wcModal.prop("open")) || obj.parents('#modal').length === 1) {
73            qCounter.popupadd(obj, quantity);
74        }
75        
76        if (window.location.pathname.replace(/\/$/, '') == validateURL.URL() + '/shoppingcart/shoppingcart' || window.location.pathname.replace(/\/$/, '') == validateURL.URL() + '/savelist') {
77            qCounter.popupadd( obj, quantity );
78
79            // if( validateURL.URL().match(/sintmaarten/i) ) {
80            //     Shoppincart.addDeliveryMethod('delivery');
81            // }
82	    }
83        
84        if ( obj.parents('[data-page="lists"]').length == 1  ) {
85            // $.busyLoadFull('show');
86            var id_purchase = obj.closest("[data-purchase]").data("purchase");
87            var id_item     = obj.closest("[data-item]").data("item");
88       
89            qCounter.modifyQuantitySel( id_item, quantity,id_purchase );
90            
91        }
92    },
93    
94    "popupadd": function( obj, quantity) {
95        
96        modifyQuantityItemPurchase( obj, quantity )
97        
98    },
99    
100    "modifyQuantitySel" : function (id_item, quantity, id_purchase ) {
101        $.ajax({
102            async: true,
103            type: "POST",
104            data: {"id": id_item, "quantity": quantity, "id_purchase" : id_purchase },
105            dataType: "json",
106            url: validateURL.URL() + "/products/build_listItem_line",
107            beforeSend: function() {
108                $.busyLoadFull('show');
109            },
110            success: function (data) {
111
112                const $purchase = $(`[data-purchase='${id_purchase}']`);
113
114                $purchase.find(".resumeTotalListSave").html( data.purchase  );
115                $("#line_"+data.id+"_"+data.id_purchase ).find("[data-action='resumeLineTotal']").html( data.line );
116                
117                const hasProducts = data.products != null;
118
119                if (!hasProducts) return;
120
121                const selector = $purchase.find(".withoutItems").length > 0
122                ? ".withoutItems"
123                : ".listitem-quantity";
124
125                $purchase.find(selector).text(data.products);
126            },
127            complete: function() {
128                setTimeout(() => {
129                    $.busyLoadFull('hide');
130                }, 100);
131            },
132            timeout: 10000
133        });
134            
135    }
136    
137}
138
139$(document).ready( qCounter.main );
140
141    

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.