PageSourceSearch

https://wineartshop.rs/js/main.js?v=WqxY8N57KEBNzYPioLDbRQ5f3Z12bd1dlEE95m0u1TU

js wineartshop.rs collected 2026-10-02 01:08:25 UTC 5,216 bytes, 168 lines download raw bytes

1
2'use strict';
3
4var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
5var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
6    return new bootstrap.Tooltip(tooltipTriggerEl);
7});
8
9// cart https://codepen.io/justinklemm/pen/kyMjjv
10
11var taxRate = 0.05;
12var shippingRate = 15.00;
13var fadeTime = 300;
14
15/* Assign actions */
16document.querySelectorAll('.product-quantity').forEach(function (input) {
17    input.addEventListener('change', function () {
18        updateQuantity(this);
19    });
20});
21
22// WE DON'T NEED THIS FUNCTION SINCE i DO IT IN CART SCRIPT
23//document.querySelectorAll('.product-remove').forEach(function (button) {
24//    button.addEventListener('click', function () {
25//        removeItem(this);
26//    });
27//});
28
29/* Recalculate cart */
30function recalculateCart() {
31    var subtotal = 0;
32
33    /* Sum up row totals */
34    document.querySelectorAll('.shopping-cart_item').forEach(function (product) {
35        subtotal += parseFloat(product.querySelector('.product-line-price').textContent);
36    });
37
38    /* Calculate totals */
39    var tax = subtotal * taxRate;
40    var shipping = subtotal > 0 ? shippingRate : 0;
41    var total = subtotal + tax + shipping;
42
43    /* Update totals display */
44    document.querySelectorAll('.product-value').forEach(function (totalValue) {
45        totalValue.style.display = 'none';
46    });
47    document.getElementById('cart-subtotal').textContent = subtotal.toFixed(2);
48    document.getElementById('cart-tax').textContent = tax.toFixed(2);
49    document.getElementById('cart-shipping').textContent = shipping.toFixed(2);
50    document.getElementById('cart-total').textContent = total.toFixed(2);
51    var checkout = document.querySelector('.checkout');
52    if (total == 0) {
53        checkout.style.display = 'none';
54    } else {
55        checkout.style.display = 'block';
56    }
57    document.querySelectorAll('.totals-value').forEach(function (totalValue) {
58        totalValue.style.display = 'block';
59    });
60}
61
62/* Update quantity */
63function updateQuantity(quantityInput) {
64    /* Calculate line price */
65    var productRow = quantityInput.parentNode.parentNode;
66    var price = parseFloat(productRow.querySelector('.product-price').textContent);
67    var quantity = quantityInput.value;
68    var linePrice = price * quantity;
69
70    /* Update line price display and recalc cart totals */
71    var productLinePrice = productRow.querySelector('.product-line-price');
72    productLinePrice.style.display = 'none';
73    productLinePrice.textContent = linePrice.toFixed(2);
74    productLinePrice.style.display = 'block';
75    recalculateCart();
76}
77
78/* Remove item from cart */
79function removeItem(removeButton) {
80    /* Remove row from DOM and recalc cart total */
81    var productRow = removeButton.parentNode.parentNode;
82    productRow.style.transition = "all " + fadeTime + "ms ease-in-out";
83    productRow.style.maxHeight = productRow.clientHeight + "px";
84    productRow.style.overflow = "hidden";
85    setTimeout(function () {
86        productRow.style.maxHeight = "0px";
87    }, 10);
88    setTimeout(function () {
89        productRow.remove();
90        recalculateCart();
91    }, fadeTime);
92}
93
94// increase buttons
95
96/*
97* @Adilade Input Quantity Increment
98* 
99* Free to use - No warranty
100*/
101
102var input = document.querySelector('#qty');
103var btnminus = document.querySelector('.qtyminus');
104var btnplus = document.querySelector('.qtyplus');
105
106if (input !== undefined && btnminus !== undefined && btnplus !== undefined && input !== null && btnminus !== null && btnplus !== null) {
107    var qtyminus = function qtyminus(e) {
108        var current = Number(input.value);
109        var newval = current - step;
110        if (newval < min) {
111            newval = min;
112        } else if (newval > max) {
113            newval = max;
114        }
115        input.value = Number(newval);
116        e.preventDefault();
117    };
118
119    var qtyplus = function qtyplus(e) {
120        var current = Number(input.value);
121        var newval = current + step;
122        if (newval > max) newval = max;
123        input.value = Number(newval);
124        e.preventDefault();
125    };
126
127    var min = Number(input.getAttribute('min'));
128    var max = Number(input.getAttribute('max'));
129    var step = Number(input.getAttribute('step'));
130
131    btnminus.addEventListener('click', qtyminus);
132    btnplus.addEventListener('click', qtyplus);
133} // End if test
134
135var swiper = new Swiper(".heroSwiper", {
136    slidesPerView: 1,
137    pagination: {
138        el: ".swiper-pagination",
139        clickable: true
140    }
141});
142
143var swiper = new Swiper(".itemSwiper", {
144    slidesPerView: 1,
145    spaceBetween: 30,
146    breakpoints: {
147        700: {
148            slidesPerView: 3,
149            spaceBetween: 20
150        },
151        1024: {
152            slidesPerView: 4,
153            spaceBetween: 40
154        }
155    },
156    navigation: {
157        nextEl: ".swiper-button-next",
158        prevEl: ".swiper-button-prev"
159    }
160});
161
162var selects = document.querySelectorAll('select[id^="select-"]');
163
164selects.forEach(function (select) {
165    NiceSelect.bind(select);
166});
167
168

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.