PageSourceSearch

https://www.bregtobjects.nl/wp-content/themes/bz-waas/assets/javas…/parts/packages/custom-webshop.js?v=26.0

js bregtobjects.nl collected 2026-10-09 23:21:37 UTC 38,099 bytes, 1,081 lines download raw bytes

1// ON LOAD
2jQuery(window).on('load', function () {
3
4    var slug = window.location.href;
5    if (slug.indexOf("afrekenen") > -1 || slug.indexOf("checkout") > -1 || slug.indexOf("winkelwagen") > -1 || slug.indexOf("cart") > -1) {
6        jQuery('body,html').scrollTop(0);
7    }
8
9    move_cart_parts_mobile();
10    sync_pdp_price_header();
11    initProductSliderHeight();
12});
13
14jQuery(window).on('renderDimensionsBefore', function () {
15    initProductSliderHeight();
16    addToCartButtonHeight();
17});
18
19jQuery(window).on('esAjaxLoad', function() {
20    addToCartButtonHeight();
21});
22
23function addToCartButtonHeight(){
24    var quantityChooser = jQuery('.product-single-buttons-left .quantity:visible');
25    var pdpButtonRight = jQuery('.product-single-buttons-right.has-qty-chooser .button-new');
26    if(quantityChooser.length){
27        var qtyHeight = quantityChooser.outerHeight();
28        pdpButtonRight.outerHeight(qtyHeight);
29    } else {
30        pdpButtonRight.height('auto');
31    }
32}
33
34// REST FUNCTIONS
35function move_cart_parts_mobile() {
36    var windowWidth = window.innerWidth;
37    if (windowWidth <= 1024) {
38        jQuery('.brick-cart-1 .item-products-3, .brick-contact-1 .item-products-3').each(function () {
39            jQuery(this).find('.quantity').detach().appendTo(jQuery(this).find('.column-2 .column-in'));
40        });
41    }
42    if (windowWidth <= 768) {
43        if (typeof mobile_parts_order !== 'undefined') {
44            var product_part = jQuery('.brick-cart-1 .loop-products-3').detach();
45            var shipping_part = jQuery('.brick-cart-1 .cart-shipping-part').detach();
46            var to_checkout_part = jQuery('.brick-cart-1 .cart-to-checkout-part').detach();
47            var cross_sell_part = jQuery('.brick-cart-1 .cart-cross-sells-part').detach();
48            var component_group_1 = jQuery('.brick-cart-1 .component-group-1').detach();
49            var append_to_select = ".brick-cart-1 .cart-bottom > .columns > .column-1 > .column-in";
50            product_part.addClass('mb-10');
51            shipping_part.addClass('mb-10');
52            to_checkout_part.addClass('mb-30');
53            cross_sell_part.addClass('mb-10');
54
55            jQuery.each(mobile_parts_order, function (index, value) {
56
57                if (value == 'products') {
58                    product_part.appendTo(append_to_select);
59                    jQuery('.item-products-3.column-has-qty-input').each(function () {
60                        jQuery(this).find('.quantity').detach().appendTo(jQuery(this).find('.column-2.column-has-qty-input .column-in'));
61                    });
62                } else if (value == 'shipping') {
63                    shipping_part.appendTo(append_to_select);
64
65                } else if (value == 'to_checkout') {
66                    to_checkout_part.appendTo(append_to_select);
67
68                } else if (value == 'cross_sell') {
69                    cross_sell_part.appendTo(append_to_select);
70
71                }
72            });
73            component_group_1.appendTo(append_to_select);
74        }
75    }
76}
77
78jQuery(function ($) {
79    var wc_checkout_coupons_extended = {
80        init: function () {
81
82            if ( typeof wc_checkout_params === 'undefined'  && typeof  wc_cart_params === 'undefined') {
83                return false;
84            }
85
86
87            jQuery(document.body).on('click', '.woocommerce-remove-coupon', this.remove_coupon);
88            jQuery(document.body).on('keyup input', '.checkout_coupon input', this.submit_coupon);
89            jQuery(document.body).on('click', '.coupon-button', this.submit_coupon_actual);
90        },
91
92        submit_coupon: function (e) {
93            var checkout_coupon = jQuery(this).parents('.checkout_coupon');
94            if (jQuery('.checkout_coupon input').val() == "") {
95                checkout_coupon.find('.coupon-button').addClass('hidden').hide();
96            } else {
97                checkout_coupon.find('.coupon-button').removeClass('hidden').show();
98            }
99
100            if (e.which != 13) {
101                return e;
102            }
103
104            e.preventDefault();
105
106            return this.submit_coupon_actual;
107
108        },
109
110        submit_coupon_actual: function () {
111            var $form = jQuery(this).parents('.checkout_coupon');
112
113            if ($form.is('.processing')) {
114                return false;
115            }
116
117            $form.addClass('processing').block({
118                message: null,
119                overlayCSS: {
120                    background: '#fff',
121                    opacity: 0.6
122                }
123            });
124
125
126            var wc_or_cart_checkout_params = typeof wc_checkout_params !== 'undefined' ? wc_checkout_params : wc_cart_params;
127
128            var data = {
129                security: wc_or_cart_checkout_params.apply_coupon_nonce,
130                coupon_code: $form.find('input[name="coupon_code"]').val()
131            };
132
133            jQuery.ajax({
134                type: 'POST',
135                url: wc_or_cart_checkout_params.wc_ajax_url.toString().replace('%%endpoint%%', 'apply_coupon'),
136                data: data,
137                success: function (code) {
138                    jQuery('.woocommerce-error, .woocommerce-message').remove();
139                    $form.removeClass('processing').unblock();
140                    if (code.indexOf('woocommerce-message') !== -1) {
141
142
143                        if(jQuery('.woocommerce-cart-form').length){
144                            jQuery(document).trigger('wc_update_cart',{preserve_notices: false})
145                        }else {
146                            jQuery('.coupon_feedback div').addClass('clr-green-1').removeClass('clr-red-1').html(code);
147
148
149                            jQuery(document.body).trigger('applied_coupon_in_checkout', [data.coupon_code]);
150                            jQuery(document.body).trigger('update_checkout', {update_shipping_method: false});
151                        }
152                    } else {
153                        jQuery('.coupon_feedback div').removeClass('clr-green-1').addClass('clr-red-1').html(code);
154
155                    }
156
157                },
158
159                dataType: 'html'
160            });
161
162            return false;
163        },
164
165
166        remove_coupon: function (e) {
167            e.preventDefault();
168
169            var container = jQuery(this).parents('.woocommerce-checkout-review-order'),
170                coupon = jQuery(this).data('coupon');
171
172            container.addClass('processing').block({
173                message: null,
174                overlayCSS: {
175                    background: '#fff',
176                    opacity: 0.6
177                }
178            });
179
180
181            var wc_or_cart_checkout_params = typeof wc_checkout_params !== 'undefined' ? wc_checkout_params : wc_cart_params;
182
183
184            var data = {
185                security: wc_or_cart_checkout_params.remove_coupon_nonce,
186                coupon: coupon
187            };
188
189            jQuery.ajax({
190                type: 'POST',
191                url: wc_or_cart_checkout_params.wc_ajax_url.toString().replace('%%endpoint%%', 'remove_coupon'),
192                data: data,
193                success: function (code) {
194                    jQuery('.woocommerce-error, .woocommerce-message').remove();
195                    container.removeClass('processing').unblock();
196
197                    if (code) {
198                        jQuery('form.woocommerce-checkout').before(code);
199
200                        jQuery(document.body).trigger('update_checkout', {update_shipping_method: false});
201
202                        // Remove coupon code from coupon field
203                        // jQuery('form.checkout_coupon').find('input[name="coupon_code"]').val('');
204                        jQuery('input[name="coupon_code"]').val('');
205                    }
206                },
207                error: function (jqXHR) {
208                    if (wc_checkout_params.debug_mode) {
209                        /* jshint devel: true */
210
211                    }
212                },
213                dataType: 'html'
214            });
215        }
216    };
217
218    wc_checkout_coupons_extended.init();
219
220
221    jQuery(document.body).on('wc_fragments_refreshed wc_fragments_loaded', function () {
222        jQuery('.cart-items-count').text() > 0 ? jQuery('.cart-items-count').parent().removeClass('hidden') : jQuery('.cart-items-count').parent().addClass('hidden');
223    });
224
225    jQuery('.cart-items-count').text() > 0 ? jQuery('.cart-items-count').parent().removeClass('hidden') : jQuery('.cart-items-count').parent().addClass('hidden');
226
227
228    jQuery('.perpage').on('change', function () {
229        jQuery(this).closest('form').submit();
230    });
231
232    jQuery('.empty-filters').on('click', function () {
233        jQuery('.wc_filter_input').remove();
234        jQuery('.rating_filter').remove();
235        jQuery('.wc_filter_term_select').val('');
236        jQuery(this).closest('form').submit();
237    });
238
239    jQuery('.show-register-form').on('click', function () {
240        jQuery('.login-part').addClass('hidden');
241        jQuery('.register-part').removeClass('hidden');
242    });
243
244    jQuery('.show-login-form').on('click', function () {
245        jQuery('.register-part').addClass('hidden');
246        jQuery('.login-part').removeClass('hidden');
247    });
248
249
250    jQuery(".single_variation_wrap").on("show_variation", function (event, variation) {
251
252
253        var buttonUrl = variation.dynamic_button_url;
254        var buttonId = variation.dynamic_button_id;
255
256        if (buttonId != '' && jQuery('[data-button-id="' + buttonId + '"]').length) {
257            jQuery('[data-button-id="' + buttonId + '"]').attr('data-sidebar-url', buttonUrl);
258        }
259        checkSidebarButtons();
260
261
262
263        var slidesContainer = jQuery(this).parents('.brick').find('.product-single-slides');
264
265        var slider_scroll_func = function(){
266            if (variation.length !== 0 && variation.image_id !== undefined) {
267                var slideLeftOffset = slidesContainer.find("[data-media-id='" + variation.image_id + "']").data('scroll-left');
268                slidesContainer.find('.es-slider-items-in').scrollLeft(slideLeftOffset);
269            }
270        }
271
272
273        if(typeof window.loaded !== 'undefined' &&  window.loaded){
274            slider_scroll_func();
275        }else{
276            var slider_scroll_interval = setInterval(function(){
277
278                if(typeof window.loaded !== 'undefined' &&  window.loaded) {
279                    slider_scroll_func();
280                    clearInterval(slider_scroll_interval);
281                }else{
282
283                }
284            },200)
285        }
286
287
288
289        handle_required_prices();
290
291        jQuery('.product-variation-from-price').hide();
292        handle_variation_select_change(variation);
293
294    });
295
296    jQuery(".variations_form").on("reset_data", function (event, variation) {
297
298        jQuery('.product-variation-from-price').show();
299        handle_variation_select_change(false);
300    });
301
302
303    function disabel_all_color_variation_prices(){
304        jQuery('.color-swatch-item.show-price').addClass('hidden');
305    }
306
307
308    function handle_variation_select_change(variation) {
309
310        //var priceVal = jQuery('.brick-products-single-1 .product-single-price:visible').html();
311        if (!jQuery('.brick-products-single-1').hasClass('product-type-composite')) {
312            sync_pdp_price_header();
313        }
314
315
316
317        if (variation !== false &&  ! variation.is_in_stock  ) {
318            jQuery('.pdp-stock-mail').show();
319        }else{
320            jQuery('.pdp-stock-mail').hide();
321        }
322
323
324
325        if(!jQuery('.product-single-colors').length || variation == false){
326            return disabel_all_color_variation_prices();
327        }
328
329        jQuery('.product-single-colors').each(function(){
330
331            var colors_container = jQuery(this);
332
333            var current_attribute = colors_container.data('attribute_name');
334            var selected_color = colors_container.find('.color-swatch-item.active');
335
336            if(!selected_color.length){
337                return disabel_all_color_variation_prices();
338            }else{
339
340                var current_price = variation.display_price;
341
342                $form = jQuery('.variations_form');
343
344                var $attributeFields = $form.find('.variations select');
345                var data = {};
346                var count = 0;
347                var chosen = 0;
348
349                $attributeFields.each(function () {
350                    var attribute_name = jQuery(this).data('attribute_name') || jQuery(this).attr('name');
351                    var value = jQuery(this).val() || '';
352
353                    if (value.length > 0) {
354                        chosen++;
355                    }
356                    count++;
357                    data[attribute_name] = value;
358                });
359
360                $attributeFields.each(function () {
361                    var attribute_name = jQuery(this).data('attribute_name') || jQuery(this).attr('name');
362                    var value = jQuery(this).val() || '';
363
364                    if (value.length > 0) {
365                        chosen++;
366                    }
367                    count++;
368                    data[attribute_name] = value;
369                });
370
371
372
373
374                var isMatchCustom = function (variation_attributes, attributes) {
375                    var match = true;
376                    for (var attr_name in variation_attributes) {
377                        if (variation_attributes.hasOwnProperty(attr_name)) {
378                            var val1 = variation_attributes[attr_name];
379                            var val2 = attributes[attr_name];
380                            if (val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2) {
381                                match = false;
382                            }
383                        }
384                    }
385                    return match;
386                };
387
388                var findMatchingVariationsCustom = function (variations, attributes) {
389                    var matching = [];
390                    for (var i = 0; i < variations.length; i++) {
391                        var variation = variations[i];
392
393                        if (isMatchCustom(variation.attributes, attributes)) {
394                            matching.push(variation);
395                        }
396                    }
397                    return matching;
398                };
399
400                var variationData = $form.data('product_variations');
401
402
403                colors_container.find('.color-swatch-item').each(function () {
404                    var color_item = jQuery(this);
405
406
407
408                    data[current_attribute] = color_item.data('color');
409                    var matching_variations = findMatchingVariationsCustom(variationData, data);
410
411                    new_variation = matching_variations.shift();
412
413                    if(typeof new_variation !== 'undefined' && new_variation.length){
414                        color_item.find('.show-price').removeClass('hidden').find('p').html(jQuery(new_variation.price_html).find('.woocommerce-Price-amount').html());
415
416                    }
417                    // new_item += '<div class="custom-select-dropdown-item-right">' + variation.price_html + '</div>';
418                });
419
420            }
421
422        });
423    }
424});
425
426
427jQuery(document).on('click', '.checkout-data-edit', function () {
428    jQuery(this).parents('.checkout-data').hide();
429    jQuery(this).parents('.column-in').find('.checkout-form.hidden').show();
430});
431
432jQuery(document).on('click', '.checkout-payment', function () {
433    jQuery(this).parent().find('.active').removeClass('active');
434    jQuery(this).addClass('active');
435});
436
437jQuery(document).on('mouseover touchend', '.item-products-1 .product-color', function(event){
438    if (event.originalEvent.touches) {
439        var touch = event.originalEvent.touches[0];
440        event.preventDefault();
441        event.stopPropagation();
442    }
443
444    var id = jQuery(this).data('color');
445    var baseUrl = jQuery(this).parents('.item-in').attr('data-product-url');
446    var termName = jQuery(this).parents('.product-colors').attr('data-term-name');
447    var newUrl = baseUrl + '?' + termName + '=' + id;
448    jQuery(this).parents('a.item-in').attr('href', newUrl);
449
450});
451
452jQuery(document).on('click', '.product-colors-dropdown-top', function(event){
453    event.preventDefault();
454    event.stopPropagation();
455    if (jQuery(this).parents('.brick').hasClass('brick-products-single-1')) {
456        jQuery(this).parents('.product-single-colors').toggleClass('dropdown-opened');
457    } else {
458        jQuery(this).parents('.item').toggleClass('dropdown-opened');
459    }
460});
461
462jQuery(document).on('click', '.brick-products-single-1 .color-swatch-item', function(){
463    var color_id = jQuery(this).data('color');
464    jQuery(this).parents('.product-single-colors').find('select.color-select option[value="' + color_id + '"]').prop('selected', true);
465    jQuery(this).parents('.product-single-colors').find('select.color-select').trigger('change');
466});
467
468jQuery(document).on('click', '[data-sidebar="products-option"] .color-swatch-item', function(e) {
469    var color_id = jQuery(this).data('color');
470
471    var options = jQuery('.product-single-options-sidebar.sidebar-waiting');
472    var sidebar = jQuery(this).parents('.sidebar');
473    options.find('select.color-select').val(color_id).trigger('change');
474    options.addClass('chosen').removeClass('sidebar-waiting');
475
476
477    var optionImage = jQuery(this).find('.visual').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
478    var optionValue =  jQuery(this).data('name');
479    options.find('.product-option-image img').attr('src', optionImage);
480    options.find('.product-option-value .text').html(optionValue);
481    sidebar.removeClass('active');
482});
483
484jQuery(document).on('click', '[data-sidebar="products-option"] .form-radio', function(e) {
485    var name = jQuery(this).find('input').attr('name');
486
487    var dataVal = jQuery(this).find('input').val();
488    var options = jQuery('.product-single-options-sidebar.sidebar-waiting');
489    var sidebar = jQuery(this).parents('.sidebar');
490    if(sidebar.hasClass('active')){
491        options.find('input[name="' + name+ '"]').prop("checked", false);
492        options.find('input[name="' + name+ '"][value="' + dataVal + '"]').prop("checked", true).trigger('change');
493
494        options.addClass('chosen').removeClass('sidebar-waiting');
495        var optionValue = jQuery(this).find('.value').html();
496        options.find('.product-option-value .text').html(optionValue);
497        sidebar.removeClass('active');
498    }
499
500});
501
502jQuery(document).on('click', '.product-single-options-sidebar-toggle', function(){
503    var option = jQuery(this).parents('.product-single-options-sidebar');
504    var sidebar = jQuery('[data-sidebar="products-option"]');
505    var dynContent = option.find('.product-single-options-sidebar-content').html();
506    var options = option.find('.product-single-option-options');
507    option.addClass('sidebar-waiting');
508    sidebar.find('.sidebar-content').html(dynContent);
509    sidebar.find('.sidebar-content').append(options.html());
510    sidebar.addClass('active');
511
512
513
514    var itemsBottom = sidebar.find('.color-swatch-item-bottom');
515    var itemsBottomHeight = 0;
516    itemsBottom.each(function(){
517        var itemHeight = jQuery(this).height();
518        if(itemHeight > itemsBottomHeight){
519            itemsBottomHeight = itemHeight;
520        }
521    });
522    itemsBottom.height(itemsBottomHeight);
523
524    jQuery(window).trigger('setRatio');
525    jQuery(window).trigger('resize');
526});
527
528jQuery(document).on('click', '.product-colors-dropdown-item', function(event){
529    event.preventDefault();
530    event.stopPropagation();
531
532    if (typeof jQuery(this).data('color') !== 'undefined') {
533        var id = jQuery(this).data('color');
534    }
535    var item = jQuery(this);
536    var imagesContainer = jQuery(this).parents('.item').find('.loop-component-image-in');
537    var topContainer = jQuery(this).parents('.product-colors-dropdown').find('.product-colors-dropdown-top-in');
538
539    topContainer.html(jQuery(this).get(0).outerHTML);
540    imagesContainer.find('img').hide();
541    imagesContainer.find("[data-color-image='" + id + "']").show();
542
543    item.parents('.product-single-colors').find('select.color-select').val(id).trigger('change');
544
545    jQuery(this).parents().removeClass('dropdown-opened');
546
547    var baseUrl = jQuery(this).parents('.item-in').attr('data-product-url');
548    var termName = jQuery(this).parents('.product-colors').attr('data-term-name');
549    var newUrl = baseUrl + '?' + termName + '=' + id;
550    jQuery(this).parents('a.item-in').attr('href', newUrl);
551});
552
553jQuery(document).on('click touchend', '.color-swatch-item, .wc-pao-addon-image-swatch', function(event){
554    var items = jQuery(this).parents('.color-swatch-items');
555    items.find('.color-swatch-item.active').removeClass('active');
556    jQuery(this).addClass('active');
557});
558
559jQuery(document).on('click', '.product-required-option-item', function(event){
560    var input = jQuery(this).find('input');
561    if(input.is(':checked')){
562        jQuery(this).addClass('active');
563    } else {
564        jQuery(this).removeClass('active');
565    }
566
567    var inputs = jQuery(this).parents('.product-required-option').find('input
567:checked').length;
568    if(inputs > 0){
569        jQuery(this).parents('.product-required-options').addClass('chosen');
570    } else {
571        jQuery(this).parents('.product-required-options').removeClass('chosen');
572    }
573
574    if(jQuery('.variations_form').length){
575        jQuery('.variations_form').trigger( 'check_variations' );
576    }else{
577        //handle_required_prices();
578    }
579
580});
581
582jQuery(window).on('load', function () {
583
584    if(jQuery('form.variations_form .product-single-colors .product-colors-dropdown').length !== 0) {
585        jQuery('form.variations_form .product-single-colors .product-colors-dropdown .product-colors-dropdown-item.active').trigger('click');
586    }
587
588    if(jQuery('form.variations_form .product-single-colors .product-color').length !== 0) {
589        jQuery('form.variations_form .product-single-colors .product-color.active').trigger('click');
590    }
591
592    jQuery('.form-review-stars svg').on('mouseover', function () {
593        var starVal = parseInt(jQuery(this).attr('data-rating'), 10);
594
595        jQuery(this).parent().children('svg').each(function (e) {
596            if (e < starVal) {
597                jQuery(this).addClass('hover');
598            }
599            else {
600                jQuery(this).removeClass('hover');
601            }
602        });
603    }).on('mouseout', function () {
604        jQuery(this).parent().children('i').each(function (e) {
605            jQuery(this).removeClass('hover');
606        });
607    });
608
609    jQuery('.form-review-stars svg').on('click', function () {
610        var starVal = parseInt(jQuery(this).attr('data-rating'), 10);
611        var stars = jQuery(this).parent().children('svg');
612        for (i = 0; i < stars.length; i++) {
613            jQuery(stars[i]).removeClass('selected');
614        }
615        for (i = 0; i < starVal; i++) {
616            jQuery(stars[i]).addClass('selected');
617        }
618        var select = jQuery(this).parents('.form-review-stars').find('select');
619        select.find("option[value='" + starVal + "']").prop('selected', 'selected');
620    });
621});
622
623jQuery(document).on('click', '.reviews-show-all', function(){
624    jQuery(this).parents('.products-single-tab').find('.item.hidden').show();
625    jQuery(this).hide();
626});
627
628jQuery(document).on('update_checkout', function () {
629    waas_form_initFocus(); // Function in custom-main.js
630});
631
632jQuery(document).on('click', '.brick-cart-1 .quantity', function (e) {
633    e.preventDefault();
634    e.stopPropagation();
635});
636
637
638var timeout;
639jQuery(document).on('change', '.woocommerce-cart-form .item-products-3 input', function () {
640
641    var quantity = jQuery(this).val();
642    var linked_product_hashes = jQuery(this).parents('.quantity').data('linked-product-hashes');
643
644    if (linked_product_hashes != "") {
645        jQuery.each(linked_product_hashes.split(","), function (index, hash) {
646            jQuery('[data-cart-hash="' + hash + '"] input').val(quantity);
647            jQuery('[data-cart-hash="' + hash + '"] .column-3 p').text(quantity + "x");
648        });
649    }
650
651    if (timeout !== undefined) {
652        clearTimeout(timeout);
653    }
654    timeout = setTimeout(function () {
655        showLoader();
656        jQuery('.woocommerce-cart-form :input[name="update_cart"]').prop("disabled", 0);
657        jQuery("[name='update_cart']").trigger("click");
658        setTimeout(function(){
659            hideLoader();
660        },10000);
661    }, 500);
662});
663
664function sync_pdp_price_header(){
665    var checkSingleSalePrice = jQuery('.brick-products-single-1 .product-single-price .product-single-sale-price:visible .woocommerce-Price-amount');
666
667
668
669    if (checkSingleSalePrice.length) {
670        var priceVal = checkSingleSalePrice.html();
671        if (!jQuery('.brick-products-single-1').hasClass('product-type-composite')) {
672            jQuery('.header-row-pdp .product-single-sale-price').removeClass('hidden');
673            jQuery('.header-row-pdp').find('.product-single-sale-price .text').html(priceVal);
674        }
675    } else {
676        jQuery('.header-row-pdp .product-single-sale-price').addClass('hidden');
677    }
678
679    var checkSinglePrice = jQuery('.brick-products-single-1 .product-single-price .product-single-total-price:visible .woocommerce-Price-amount');
680    if (checkSinglePrice.length) {
681        var priceVal = checkSinglePrice.html();
682        if (!jQuery('.brick-products-single-1').hasClass('product-type-composite')) {
683            jQuery('.header-row-pdp').find('.product-single-total-price .text').html(priceVal);
684        }
685    }else{
686        var checkSinglePrice = jQuery('.brick-products-single-1 .product-single-price .component-price-taxes-in .component:first-child .woocommerce-Price-amount');
687        if (checkSinglePrice.length) {
688            var priceVal = checkSinglePrice.html();
689            if (!jQuery('.brick-products-single-1').hasClass('product-type-composite')) {
690                jQuery('.header-row-pdp').find('.product-single-total-price .text').html(priceVal);
691            }
692        }
693    }
694
695
696}
697
698function handle_required_prices(){
699    var possible_required_options = jQuery('input[name="required-options[]"]:checked');
700
701    if(possible_required_options.length){
702
703        var extra_price = 0;
704        var extra_price_ex_vat = 0;
705
706        possible_required_options.each(function(){
707            var extra_price_option  = jQuery(this).parents('.product-required-option-item').data('extra-product-price');
708            var extra_price_option_ex_vat  = jQuery(this).parents('.product-required-option-item').data('extra-product-price-ex-vat');
709            extra_price +=extra_price_option;
710            extra_price_ex_vat +=extra_price_option_ex_vat;
711        });
712
713
714
715
716        if(jQuery('.variations_form').length){
717            var priceObject = jQuery('.single_variation .product-single-price').find('.woocommerce-Price-amount');
718            var selector = '.single_variation .product-single-price .woocommerce-Price-amount';
719        }else{
720            var priceObject = jQuery('.product-single-price').find('.woocommerce-Price-amount');
721            var selector = '.product-single-price .woocommerce-Price-amount';
722        }
723
724
725
726        var regex_as_string = "";
727        if(typeof woocommerce_decimal_separator !== 'undefined' && woocommerce_decimal_separator == '.'){
728            regex_as_string = "([\\d,]+)(?:\\.(-|\\d{1,2}))";
729
730
731            var decimal_seperator = ".";
732            var thousand_seperator = ",";
733        }else{
734            regex_as_string = "([\\d.]+)(?:\\,(-|\\d{1,2}))";
735
736            var decimal_seperator = ",";
737            var thousand_seperator = ".";
738        }
739
740        var replace_regex = new RegExp(regex_as_string, "g");
741
742
743
744        jQuery(selector).each(function(){
745
746            if(!jQuery('.variations_form').length) {
747
748            }
749
750            var wcpa = jQuery(this);
751            wcpa.html(wcpa.html().replace(replace_regex, function (regex, units, cents) {
752                if (cents == "-") {
753                    cents = 0;
754
755                } else {
756                    cents = +(cents || 0);
757
758                }
759
760                units = parseInt(units.replace(",", "").replace(".", ""));
761
762
763                if(wcpa.parents('.no-tax').length){
764                    var new_value = (units + cents / 100) + extra_price_ex_vat;
765
766                }else{
767                    var new_value = (units + cents / 100) + extra_price;
768
769                }
770                if (isNaN(new_value + Number.EPSILON)) {
771                    return regex;
772                }
773
774                var formatted_result = format_money_custom(new_value + Number.EPSILON, decimal_seperator, thousand_seperator);
775
776
777                return formatted_result;
778            }));
779
780
781        });
782
783
784    }
785}
786
787jQuery(window).on('load', function() {
788    jQuery('.brick-products-single-1.product-type-composite .composite_data[data-item_id="review"] .composite_price, .brick-products-single-1.product-type-composite .product-single-duplicate-price').each(function () {
789        var sel = this;
790        var priceDiv = jQuery(this);
791        if (priceDiv.parents('.brick-products-single-1').hasClass('product-type-composite')) {
792            new MutationObserver(function () {
793                var priceVal = priceDiv.find('.product-single-total-price');
794                if (priceVal.length) {
795                    jQuery('.header-row-pdp').find('.product-single-total-price .text').html(priceVal.find('.text').html());
796                }
797
798
799                var salePrice = priceDiv.find('.product-single-sale-price');
800                if (salePrice.length) {
801                    jQuery('.header-row-pdp .product-single-sale-price').removeClass('hidden');
802                    jQuery('.header-row-pdp').find('.product-single-sale-price .text').html(salePrice.find('.text').html());
803                } else {
804                    jQuery('.header-row-pdp .product-single-sale-price').addClass('hidden');
805                }
806
807            }).observe(sel, {childList: true, subtree: true, attributes: true});
808
809            jQuery(sel).attr('data-observer', 'true');
810        }
811    });
812
813});
814
815
816jQuery('.product-single-buttons button[type=submit]').each(function(){
817
818    if(jQuery(this).hasClass('enquiry-add-to-cart-button')){
819        return;
820    }
821
822    var button = jQuery(this);
823    var handle_trigger = function(button) {
824        var is_disabled = button.attr('disabled') || button.hasClass('disabled');
825        jQuery('.add-to-cart-header-button').attr('disabled', is_disabled);
826    };
827
828    new MutationObserver(function(){handle_trigger(button)}).observe(this, {childList: true, subtree: true, attributes: true,});
829
830    handle_trigger(button);
831
832});
833
834
835
836
837
838
839jQuery(document).on("wc_fragments_refreshed", function () {
840    var hash = window.location.hash;
841    if (hash !== -1) {
842        var hash = hash.substring(1);
843        if (hash === 'open-mini-cart') {
844            var sidebar_toggle_div = jQuery('<div data-sidebar-open="mini-cart"></div>');
845
846            var open_sidebar_mini_cart = function(){
847                if (typeof   window.loaded !== 'undefined' || window.loaded) {
848                    openSidebar(sidebar_toggle_div);
849                    clearInterval(open_sidebar_mini_cart_interval);
850                }
851            }
852
853            var open_sidebar_mini_cart_interval = setInterval(open_sidebar_mini_cart,100);
854
855        }
856    }
857
858});
859
860jQuery(document).on('click', '.remove-mini-cart', function(e){
861
862    e.preventDefault();
863
864
865    showLoader();
866    var $thisbutton = jQuery(this);
867    jQuery.ajax({
868        type: 'POST',
869        url: woocommerce_params.wc_ajax_url.toString().replace('%%endpoint%%', 'remove_from_cart'),
870        data: {
871            cart_item_key: $thisbutton.data('cart_item_key')
872        },
873        success: function (response) {
874            if (!response || !response.fragments) {
875                window.location = $thisbutton.attr('href');
876                return;
877            }
878
879            jQuery(document.body).trigger('removed_from_cart', [response.fragments, response.cart_hash]);
880
881            $.each( response.fragments, function( key, value ) {
882                jQuery( key ).replaceWith( value );
883            });
884
885            openSidebar(jQuery('<div data-sidebar-open="mini-cart"></div>'));
886            hideLoader();
887        },
888        error: function () {
889            window.location = $thisbutton.attr('href');
890            hideLoader();
891            return;
892        },
893        dataType: 'json'
894    });
895
896});
897
898
899
900var minicart_timeout = null;
901jQuery(document).on('click', '.mini-cart-content .quantity-in', function(e){
902    e.preventDefault();
903    e.stopPropagation();
904});
905
906jQuery(document).on('change', '.mini-cart-content .quantity-in input', function(e){
907
908    e.preventDefault();
909    e.stopPropagation();
910
911    var input = jQuery(this);
912    var cart_hash = jQuery(this).parents('.item-products-3').data('cart-hash');
913
914    if (minicart_timeout !== undefined) {
915        clearTimeout(minicart_timeout);
916    }
917    minicart_timeout = setTimeout(function () {
918
919        showLoader();
920        jQuery.ajax({
921            type: 'POST',
922            url: woocommerce_params.ajax_url,
923            data: {
924                action: 'change_cart_item_quantity',
925                cart_item_key: cart_hash,
926                quantity: input.val(),
927            },
928            success: function (response) {
929                if (!response || !response.fragments) {
930                    return;
931                }
932
933                jQuery(document.body).trigger('removed_from_cart', [response.fragments, response.cart_hash]);
934
935                $.each( response.fragments, function( key, value ) {
936                    jQuery( key ).replaceWith( value );
937                });
938
939                openSidebar(jQuery('<div data-sidebar-open="mini-cart"></div>'));
940                hideLoader();
941            },
942            error: function () {
943                window.location = $thisbutton.attr('href');
944                hideLoader();
945                return;
946            },
947            dataType: 'json'
948        });
949
950        setTimeout(function(){
951            hideLoader();
952        },10000);
953    }, 500);
954
955});
956
957jQuery(document).on('click', '.enquiry-add-to-cart-button, .back-in-stock-submit', function(){
958    jQuery('.active-submit-button').removeClass('active-submit-button');
959    jQuery(this).addClass('active-submit-button');
960});
961
962jQuery(document).on('mousedown touchstart', 'select.orderby[data-sidebar-open]', function(e){
963    e.preventDefault();
964    //openSidebar(jQuery(this));
965    this.blur();
966    window.focus();
967});
968
969jQuery(document).on('mousedown touchstart', '[data-sort]', function(e){
970    var data = jQuery(this).data('sort');
971    var select = jQuery('select.orderby');
972    select.find("option[value='" + data + "']").prop('selected', 'selected');
973    jQuery('form.woocommerce-ordering').submit();
974});
975
976jQuery(document).on('submit', '.products-single-top .cart', function(e){
977
978    if (jQuery(this).find('input[type="file"]').length) {
979        return;
980    }
981
982    if (typeof add_to_cart_type === "undefined" || add_to_cart_type !== "open_mini_cart") {
983        return;
984    }
985
986    if (jQuery(this).hasClass('external-product')) {
987        return;
988    }
989
990    var form = jQuery(this);
991    var actionUrl = form.attr('action');
992
993    var formData = form.serializeArray();
994    var activeSubmitButton = jQuery('.active-submit-button');
995    if (activeSubmitButton.length && ( activeSubmitButton.hasClass('enquiry-add-to-cart-button') ||  activeSubmitButton.hasClass('back-in-stock-submit'))) {
996        jQuery(this).attr('action','');
997        return;
998    }
999
1000    e.preventDefault(); // avoid to execute the actual submit of the form.
1001    showLoader();
1002
1003
1004    if(typeof actionUrl === 'undefined'){
1005        actionUrl = '?nowprocket';
1006    }else{
1007        actionUrl += (actionUrl.split('?')[1] ? '&':'?') + 'nowprocket';
1008    }
1009
1010    jQuery.ajax({
1011        type: "POST",
1012        url: actionUrl,
1013        dataType: 'html',
1014        data: formData, // serializes the form's elements.
1015        success: function(data, textstatus, xhrReq) {
1016            var body = jQuery(data).filter('.body');
1017
1018            var has_errors = body.find('.woocommerce-error').length;
1019
1020
1021            checkNotifications(true, body);
1022
1023            if(has_errors){
1024                hideLoader();
1025            }else{
1026                $.ajaxSetup({data: {'nowprocket':true}})
1027
1028                after_fragment_load_function = function (){
1029                    setTimeout(function() {
1030
1031
1032                        openSidebar(jQuery('<div data-sidebar-open="mini-cart"></div>'));
1033
1034                        checkNotifications(true);
1035
1036                    },1)
1037
1038                    jQuery(document.body).off('wc_fragments_refreshed',after_fragment_load_function);
1039                    jQuery(document.body).off('wc_fragments_refreshed',hideL
1039oader);
1040                }
1041
1042                jQuery(document.body).on('wc_fragments_refreshed', hideLoader);
1043                jQuery(document.body).on('wc_fragments_refreshed', after_fragment_load_function);
1044                jQuery(document.body).trigger('wc_fragment_refresh');
1045            }
1046        }
1047    });
1048
1049});
1050
1051function initProductSliderHeight() {
1052    jQuery('.product-single-slider').each(function () {
1053        var columnWidth = jQuery(this).width();
1054        var image = jQuery(this).find('.product-single-slide img');
1055        image.css('max-height', columnWidth);
1056    });
1057}
1058
1059function submit_filter_on_desktop() {
1060    var windowWidth = window.innerWidth;
1061    if (windowWidth > 768) {
1062        showLoader();
1063        jQuery('.filter-container-in').parents('form').submit();
1064    }
1065
1066}
1067
1068function waas_mirror_sendy_pickup() {
1069    var $actual = jQuery('form .cart_totals .sendy-pickuppoint-actual, form .woocommerce-checkout-review-order .sendy-pickuppoint-actual');
1070    var $mirror = jQuery('.waas-sendy-shipping-method-mirror');
1071
1072    if ($actual.length && $mirror.length) {
1073        // Check of er echt relevante content in staat (bijv. een button of tekst)
1074        var hasContent = $actual.find('button, p').length > 0;
1075
1076        if (hasContent) {
1077
1078            $mirror.html($actual);
1079        }
1080    }
1081}

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.