PageSourceSearch

https://www.lobmeyr.at/wp-content/themes/lobmeyr/assets/js/script.js?ver=1.224

js lobmeyr.at collected 2026-10-02 06:01:16 UTC 20,533 bytes, 707 lines download raw bytes

1jQuery(document).ready(function($) {
2  function cartCount() {
3    $( ".crystal-template-default .ajax_add_to_cart, .wishlist_item .product-action .button" ).on( "click", function() {
4      var count = parseInt($("#cart_wrapper span.cart-contents-count").text());
5
6      if(count > 0) {
7        setTimeout(function (){
8              $('#cart_wrapper  span.cart-contents-count').text(count+1);
9              $('#woo_shop_this  span.cart-contents-count').text(count+1);
10          }, 1000);
11        }
12        else {
13          setTimeout(function (){
14
15            $('#cart_wrapper .lb-shopping-cart').after("<span class='cart-contents-count'>1</span>");
16            $("#cart_wrapper .lb-shopping-cart").addClass("full-cart");
17            $('#woo_shop_this .lb-shopping-cart').after("<span class='cart-contents-count'>1</span>");
18            $("#woo_shop_this .lb-shopping-cart").addClass("full-cart");
19          }, 1000);
20        }
21    } );
22  }
23  cartCount();
24  
25  (function(open) {
26    XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
27      this.addEventListener("readystatechange", function() {
28        if (this.readyState === 4) {
29          if (url.indexOf('/?wc-ajax=tinvwl') != -1) {
30            setTimeout(function() {
31              cartCount();
32            }, 1000);
33          }
34        }
35      }, false);
36      open.call(this, method, url, async, user, pass);
37    };
38  })(XMLHttpRequest.prototype.open);
39
40  // $('select#billing_country').on('change', function(){
41  //   setTimeout(function(){
42  //     location.reload();
43  //   }, 1000); 
44  // });
45
46
47  // $('select#shipping_country').on('change', function(){
48  //   setTimeout(function(){
49  //     location.reload();
50  //   }, 1000); 
51  // });
52
53  // $('#shipping_method input[type="radio"]').change(function() {
54  //   setTimeout(function() {
55  //     location.reload();
56  //   }, 1000); 
57  // });
58
59////Refresh Check-Out page /*Nina*/
60//$(document).ready(function() {
61    // Überwache Änderungen an den Versandmethoden
62//    $(document).on('change', 'input[name="shipping_method[0]"]', function() {
63//        setTimeout(function() {
64//            location.reload();
65//        }, 1000); 
66//    });
67
68    // Überwache Änderungen an den Rechnungs- und Versandland-Auswahlfeldern
69 //   $('select#billing_country, select#shipping_country').on('change', function() {
70 //       setTimeout(function() {
71 //          location.reload();
72 //       }, 1000);
73 //   });
74//});
75
76//Refresh Check-Out page /*Nina*/
77//jQuery(document).ready(function($) {
78    // Aktualisiere die Bestellübersicht bei Änderung von Versandland, Rechnungsland oder Versandmethode
79//    $('select#billing_country, select#shipping_country, input[name="shipping_method[0]"]').on('change', function() {
80  //      $('body').trigger('update_checkout');  // Nur die Bestellübersicht aktualisieren
81  //  });
82//});
83
84
85
86  // Sticky Nav
87  (function ($) {
88    $.fn.stickyHeader = function () {
89      var $window = $(window);
90      var $navCont = $(this);
91
92      var $navHeight = $navCont.outerHeight();
93
94      var $fixedPart = $navCont.find(".fixed_part");
95      var $fixedPartOffset = $fixedPart.offset().top;
96
97      $navCont.on("MakeItStick", function (event) {
98        $navCont.addClass("sticky_nav");
99      });
100
101      $navCont.css({ height: $navHeight }).trigger("MakeItStick");
102
103      const $homeSlider = $('.home_slider')
104
105      $window.scroll(function () {
106        if($('body').hasClass('home')){
107          if($window.scrollTop() > $fixedPartOffset + 50){
108            $fixedPart.addClass('sticky_home')
109          }else{
110            $fixedPart.removeClass('sticky_home')
111          }
112        }
113
114        if ($window.scrollTop() > $fixedPartOffset) {
115          $fixedPart.addClass("sticky");
116          if($window.width() >= 992){
117            hideNavElements()
118          }
119        } else if ($window.scrollTop() <= $fixedPartOffset) {
120          $fixedPart.removeClass("sticky");
121          if($window.width() >= 992){
122            hideNavElements(false)
123          }
124        }
125
126      });
127    };
128  })(jQuery);
129  $("header").stickyHeader();
130
131  function hideNavElements(hide = true){
132    if(hide){
133      $(".nav_wrapper .main_navi li, .additional_links li.cart-links").each(function() {
134        if($(this).find('.cart-contents-count').text() > 0){
135          return
136        }else{
137          $(this).addClass('hidden')
138        }
139      })
140    }else{
141      $(".nav_wrapper .main_navi li, .additional_links li.cart-links").each(function() {
142        $(this).removeClass('hidden')
143      })
144    }
145  }
146
147  $('.series_wrapper').scroll(function() {
148    if ($(this).scrollTop() >= 200) {
149        $(".shop_this_series .head_row.products").addClass("fixed");
150    } else{
151        $(".shop_this_series .head_row.products").removeClass("fixed");
152    }
153  });
154
155  $('.main_navi a').each(function() {
156    var href = $(this).attr('href');
157    if (window.location.href.indexOf(href) !== -1) {
158      $(this).parent().addClass('active'); // add 'active' class to the matching link
159    }
160  });
161
162  $('.single-product .cart .quantity input').on('click', function(){
163      $(this).val('');
164  })
165  
166 // Checkout: Pflichtvalidierung für die Anrede
167function validateCheckoutTitleField(fieldSelector, inputName) {
168  const $field = $(fieldSelector);
169
170  if (!$field.length) {
171    return true;
172  }
173
174  const isSelected =
175    $field.find('input[name="' + inputName + '"]:checked').length > 0;
176
177  if (isSelected) {
178    $field
179      .removeClass(
180        'woocommerce-invalid woocommerce-invalid-required-field'
181      )
182      .addClass('woocommerce-validated');
183
184    $field.find('.error').hide();
185
186    return true;
187  }
188
189  $field
190    .removeClass('woocommerce-validated')
191    .addClass(
192      'woocommerce-invalid woocommerce-invalid-required-field'
193    );
194
195  $field.find('.error').show();
196
197  return false;
198}
199
200
201// 1. Beim Klick auf „Weiter“ bzw. bei Checkout-Fehler prüfen
202$(document.body).on('checkout_error', function () {
203  validateCheckoutTitleField(
204    '#billing_contractions_field',
205    'billing_contractions'
206  );
207
208  const shippingIsActive =
209    $('#ship-to-different-address-checkbox').is(':checked') &&
210    $('#shipping_contractions_field').is(':visible');
211
212  if (shippingIsActive) {
213    validateCheckoutTitleField(
214      '#shipping_contractions_field',
215      'shipping_contractions'
216    );
217  } else {
218    $('#shipping_contractions_field')
219      .removeClass(
220        'woocommerce-invalid woocommerce-invalid-required-field'
221      )
222      .find('.error')
223      .hide();
224  }
225});
226
227
228// 2. Fehler entfernen, sobald eine Anrede ausgewählt wird
229$(document).on(
230  'change',
231  'input[name="billing_contractions"], input[name="shipping_contractions"]',
232  function () {
233    const inputName = $(this).attr('name');
234
235    if (inputName === 'billing_contractions') {
236      validateCheckoutTitleField(
237        '#billing_contractions_field',
238        'billing_contractions'
239      );
240    }
241
242    if (inputName === 'shipping_contractions') {
243      validateCheckoutTitleField(
244        '#shipping_contractions_field',
245        'shipping_contractions'
246      );
247    }
248  }
249);
250
251
252// 3. Anrede prüfen, sobald der Benutzer zum Vornamen weitergeht
253$(document).on(
254  'focus',
255  '#billing_first_name, #shipping_first_name',
256  function () {
257    const isShippingField = this.id === 'shipping_first_name';
258
259    if (isShippingField) {
260      const shippingIsActive =
261        $('#ship-to-different-address-checkbox').is(':checked') &&
262        $('#shipping_contractions_field').is(':visible');
263
264      if (shippingIsActive) {
265        validateCheckoutTitleField(
266          '#shipping_contractions_field',
267          'shipping_contractions'
268        );
269      }
270
271      return;
272    }
273
274    validateCheckoutTitleField(
275      '#billing_contractions_field',
276      'billing_contractions'
277    );
278  }
279);
280
281
282  //Single Product Accordion
283  var acc = document.getElementsByClassName("accordion");
284  var i;
285
286  for (i = 0; i < acc.length; i++) {
287    acc[i].addEventListener("click", function () {
288      this.classList.toggle("active");
289      var panel = this.nextElementSibling;
290      if (panel.style.display === "block") {
291        panel.style.display = "none";
292      } else {
293        panel.style.display = "block";
294      }
295    });
296  }
297
298  if (typeof Swiper !== 'undefined') {
299    document.querySelectorAll('.swiper-custom').forEach(function (sliderEl) {
300      if (sliderEl.classList.contains('swiper-initialized')) {
301        return;
302      }
303
304      new Swiper(sliderEl, {
305        watchOverflow: true,
306        loop: false,
307        slidesPerView: 2.5,
308        spaceBetween: 16,
309        breakpoints: {
310          768: {
311            slidesPerView: 3.5,
312          },
313          992: {
314            slidesPerView: 4,
315          },
316          1200: {
317            slidesPerView: 5,
318          },
319        },
320      });
321    });
322  }
323
324  $('.user_toggle.lb-user').on('click', function(){
325    $('body').removeClass('overlay');
326    $('.user_wrapper').addClass('show');
327  });
328
329  $('.user_toggle.lb-close').on('click', function(){
330    $('.user_wrapper').removeClass('show');
331  });
332
333  $('.search_toggle.lb-search').on('click', function(){
334    $('body').removeClass('overlay');
335    $('.search_wrapper').addClass('show');
336  });
337
338  $('.search_toggle.lb-close').on('click', function(){
339    $('.search_wrapper').removeClass('show');
340  });
341
342  // $('.cart_button').on('click', function(){
343  //   $('.mini_cart_holder').addClass('show');
344  //   $('body').addClass('overlay');
345  // });
346
347  // $('.close-wrapper').on('click', function(){
348  //   $('.mini_cart_holder').removeClass('show');
349  //   $('body').removeClass('overlay');
350  // });
351
352  if( $('.cart-contents-count').length ){
353    $('.cart_button .lb-shopping-cart').addClass('full-cart');
354  }
355
356  $('.visible_part').hover(
357    function () {
358      $('.toggle_part').addClass('display');
359      $('.visible_part').addClass('background');
360    },
361    function () {
362      $('.toggle_part').removeClass('display');
363      $('.visible_part').removeClass('background');
364    }
365  );
366
367  if($('#download_sidebar').hasClass('open')){
368    $('body').addClass('overlay');
369  }
370
371  $('.toggle_part').hover(
372    function () {
373      $('.toggle_part').addClass('display');
374      $('.visible_part').addClass('background');
375    },
376    function () {
377      $('.toggle_part').removeClass('display');
378      $('.visible_part').removeClass('background');
379    }
380  );
381
382  if ($('#login_form').change(function () {
383    $('body').toggleClass('overlay');
384  }));
385
386  if ($('#search_nav').change(function () {
387    $('body').toggleClass('overlay');
388  }));
389
390  $('#shop_button').on('click', function(e){
391    e.preventDefault();
392    $('#shop_series_wrapper').prop('checked', true);
393    $('body').addClass('overlay');
394  })
395
396  if ($('#shop_series_wrapper').change(function () {
397    $('body').toggleClass('overlay');
398  }));
399
400
401  // GET URL PARAMETERS FUNCTION
402  function getUrlParameter(sParam) {
403    var sPageURL = window.location.search.substring(1),
404      sURLVariables = sPageURL.split('&'),
405      sParameterName,
406      i;
407
408    for (i = 0; i < sURLVariables.length; i++) {
409      sParameterName = sURLVariables[i].split('=');
410
411      if (sParameterName[0] === sParam) {
412        return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
413      }
414    }
415    return false;
416  };
417
418
419 $(".media_carousel").mousemove(function(e) {
420    // COUNT SLIDES
421    var counter = $(this).find('.elementor-carousel-image').length;
422
423    if ($('body').hasClass('product-template-default')) {
424        counter = $(this).find('.woocommerce-product-gallery__image').length;
425    }
426
427    const element = `<div class="carousel-text">1/${counter}</div>`;
428
429    if ($('.media_carousel .carousel-text').length < 1) {
430        $(this).append(element);
431    }
432
433    const textEl = $('.media_carousel .carousel-text');
434
435    const x = `${e.pageX + 15}px`; 
436    const y = `${e.pageY - 70}px`; 
437
438    // STYLING THE APPENDED ELEMENT
439    $(textEl).css({
440        zIndex: 1,
441        position: 'fixed',
442        left: x,
443        top: y,
444        color: '#1d1d1d',
445        width: '30px',
446        fontSize: '20px',
447        pointerEvents: 'none'
448    });
449}).mouseout(function() {
450    $('.media_carousel .carousel-text').remove();
451});
452
453$(".elementor-image-gallery").mousemove(function(e) {
454    // COUNT SLIDES
455    var counter = $(this).find('.gallery-item').length;
456
457    const element = `<div class="carousel-text">1/${counter}</div>`;
458
459    if ($('.elementor-image-gallery .carousel-text').length < 1) {
460        $(this).append(element);
461    }
462
463    const textEl = $('.elementor-image-gallery .carousel-text');
464
465    const x = `${e.pageX - 30}px`; 
466    const y = `${e.pageY - 120}px`; 
467
468    // STYLING THE APPENDED ELEMENT
469    $(textEl).css({
470        zIndex: 1,
471        position: 'absolute',
472        left: x,
473        top: y,
474        color: '#1d1d1d',
475        width: '30px',
476        fontSize: '20px',
477        pointerEvents: 'none'
478    });
479}).mouseout(function() {
480    $('.elementor-image-gallery .carousel-text').remove();
481});
482
483
484  /* RUN/ATTACH FUNCTION IF SERIES WRAPPER EXISTS ON CURRENT PAGE */
485  if($(".series_wrapper").length > 0){
486      /*  EDMON BELCHEV
487        - ТОЗИ КОД РАБТОИ САМО АКО SERIES WRAPPER ЕЛЕМЕНТА СЪЩЕСТВУВА
488        - СЪЗДАВАМЕ ЕДИН OBSERVER И ГЛЕДАМЕ ЗА ПРОМЕНИ ПО ЕЛЕМЕНТА ЗА WISHLIST В ХЕДЪРА
489        - СЛЕД, КАТО ИМА ПРОМЯНА ПО БРОЯЧА НА WISHLIST-А ТОГАВА ДОБАВЯМЕ СТОЙНОСТА И В SERIES WRAPPER-А
490      */
491
492     /* GET THE TARGET NODE */
493     const targetNode = $('.wishlist-counter .wishlist_products_counter_number')
494
495     /* CREATE OBSERVER AND WATCH FOR DOM CHANGES ON THE TARGET ELEMENT */
496     const observer = new MutationObserver(function(mutations){
497      mutations.forEach(function(mutation){
498        /* GET WISHLSIT COUNTER'S VALUE */
499        const counter = $(mutation.target).html()
500        /* IF COUNTER IS GREATER THAN 0 ADD CLASS AND PASS THE COUNTER'S VALUE */
501        counter >= 1 ?
502        $(".wishlist-counter").addClass('active') :
503        $(".wishlist-counter").removeClass('active')
504      })
505     });
506
507     /* SET OBSERVER'S TARGET CONFIG */
508     const config = {
509       childList: true,
510       characterData: true,
511       attributes: true,
512       subtree: true
513     };
514
515    /* ADD OBSERVER TO THE TARGET NODE */
516    targetNode.each(function() {
517      observer.observe(this, config);
518    });
519  }
520
521  $(".trigger-newsletter-popup").on("click", function(e){
522    e.preventDefault()
523    $(".newsletter-popup").toggleClass("active")
524  })
525
526  $(".newsletter-popup").click(function(e){
527    const target = e.target
528
529    if($(this).hasClass("active")){
530      if($(target).hasClass("newsletter-popup")){
531        $(this).removeClass("active")
532      }
533    }
534  });
535
536// Checkout: Pflichtfelder sofort beim Verlassen validieren
537$(document).on(
538  'focusout change',
539  '.woocommerce-checkout .form-row.validate-required input.input-text,' +
540  '.woocommerce-checkout .form-row.validate-required textarea,' +
541  '.woocommerce-checkout .form-row.validate-required select',
542  function () {
543    const $input = $(this);
544    const $field = $input.closest('.form-row.validate-required');
545    const isEmpty = $.trim($input.val()) === '';
546
547    if (isEmpty) {
548      $field
549        .removeClass('woocommerce-validated')
550        .addClass(
551          'woocommerce-invalid woocommerce-invalid-required-field'
552        );
553
554      $field.find('.error').show();
555    } else {
556      $field
557        .removeClass(
558          'woocommerce-invalid woocommerce-invalid-required-field'
559        )
560        .addClass('woocommerce-validated');
561
562      $field.find('.error').hide();
563    }
564  }
565);
566
567});
568
569function createCookie(name, value, days) {
570  var expires;
571
572  if (days) {
573      var date = new Date();
574      date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
575      expires = "; expires=" + date.toGMTString();
576  } else {
577      expires = "";
578  }
579  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
580}
581
582function readCookie(name) {
583  var nameEQ = encodeURIComponent(name) + "=";
584  var ca = document.cookie.split(';');
585  for (var i = 0; i < ca.length; i++) {
586      var c = ca[i];
587      while (c.charAt(0) === ' ')
588          c = c.substring(1, c.length);
589      if (c.indexOf(nameEQ) === 0)
590          return decodeURIComponent(c.substring(nameEQ.length, c.length));
591  }
592  return null;
593}
594
595// $(document).on("click", ".store_locator a", function(e){
596//   e.preventDefault()
597//   $(".sidebar-store-locator").addClass('active')
598// })
599
600// $(document).on("click", ".sidebar-store-locator .close-btn", function(e){
601//   e.preventDefault()
602//   $(".sidebar-store-locator").removeClass('active')
603// })
604
605
606jQuery(document).ready(function($) {
607  function updateCartTotals() {
608    $.ajax({
609        url: '/wp-admin/admin-ajax.php',
610        type: 'POST',
611        data: {
612            action: 'get_cart_totals'
613        },
614        success: function(response) {
615          console.log(response.data);
616          if (response.success) {
617              let subtotal = '<bdi><span class="woocommerce-Price-currencySymbol">€</span>' + response.data.subtotal + '</bdi>';
618              let total = '<bdi><span class="woocommerce-Price-currencySymbol">€</span>' + response.data.total + '</bdi>';
619              let vat = '<span class="woocommerce-Price-currencySymbol">€</span>' + response.data.vat;
620              $('.cart_totals .shop_table tr.cart-subtotal .amount').html(subtotal);
621              $('.cart_totals .shop_table tr.order-total .amount').html(total);
622              $('.cart_totals .shop_table tr.tax-rate .amount').html(vat);
623              $('.cart_totals .shop_table tr.tax-rate #tax_label').text(response.data.tax_label);
624              $('.cart_totals .shop_table tr.tax-rate td').attr('data-title', response.data.tax_label);
625
626              if (response.data.shipping_options) {
627                $('.cart_totals .shop_table tr.woocommerce-shipping-totals').remove();
628                $('.cart_totals .shop_table tr.cart-subtotal').after(response.data.shipping_options);
629              }
630          }
631        },
632        error: function(error) {
633          console.log('Грешка при обновяване на количката:', error);
634        },
635        complete: function() {
636          $('.cart_totals').unblock();
637          changeShippingMethod();
638        }
639    });
640  }
641
642  $('#billing_country, #shipping_country, #shipping_method input[type="radio"]').on('change', function() {
643    // updateCartTotals();
644    $('.cart_totals').block({
645      message: null,
646      overlayCSS: {
647        background: '#fff',
648        opacity: 0.6
649      }
650    });
651  });
652
653  $(document).on('updated_checkout', function() {
654    updateCartTotals();
655  });
656
657  function changeShippingMethod() {
658    //// Checks the shipping methods & "local_pickup"
659    if ($('#shipping_method').length > 0) {
660      $('#shipping_method input[type="radio"]').change(function() {
661        $('.cart_totals').block({
662          message: null,
663          overlayCSS: {
664            background: '#fff',
665            opacity: 0.6
666          }
667        });
668
669        let val = $(this).val() || '';
670        if (val.indexOf('local_pickup:') !== -1) {
671          $('#ship-to-different-address').hide();
672          $('.woocommerce-shipping-fields > .shipping_address').hide();
673        }else {
674          $('#ship-to-different-address').show();
675          if ($('#ship-to-different-address-checkbox').is(':checked')) {
676            $('.woocommerce-shipping-fields > .shipping_address').show();
677          }
678        }
679      });
680      
681      if ($('#ship-to-different-address-checkbox').is(':checked')) {
682        $('.woocommerce-shipping-fields .shipping_address').show();
683      }else {
684        $('.woocommerce-shipping-fields .shipping_address').hide();
685      }
686      
687      $('#ship-to-different-address-checkbox').change(function() {
688        if ($(this).is(':checked')) {
689          $('.woocommerce-shipping-fields .shipping_address').show();
690        }else {
691          $('.woocommerce-shipping-fields .shipping_address').hide();
692        }
693      });
694      
695      if ($('#shipping_method input[type="radio"]').length > 0) {
696        let shipping_method = $('#shipping_method input[type="radio"]:checked').val() || '';
697        if (shipping_method.indexOf('local_pickup:') !== -1) {
698          $('#ship-to-different-address').hide();
699          $('#ship-to-different-address-checkbox').attr('checked', false);
700          $('.woocommerce-shipping-fields .shipping_address').hide();
701        }
702      }
703    }
704  }
705  changeShippingMethod();
706
707});

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.