1jQuery(function ($) { 2 3 $('.add_to_wishlist').click(function () { 4 const product_id = $(this).data('product_id'); 5 var $this = $(this); 6 var button = $(this), 7 data = { 8 'action': 'add_to_wishlist', 9 'product_id': product_id 10 }; 11 12 $.ajax({ 13 url: ajax_params.ajaxurl, // AJAX handler 14 data: data, 15 type: 'POST', 16 success: function (data) { 17 var data = JSON.parse(data); 18 if (data.status == 200) { 19 if (data.added == 0) { 20 if (window.location.href.indexOf('wishlist') > -1) { 21 console.log($this.parent().parent()); 22 $this.parent().parent().parent()[0].remove(); 23 } 24 const wishlistCount = parseInt($('.wishlist').text()); 25 if (wishlistCount > 0) { 26 $('.wishlist').text(wishlistCount - 1); 27 if (wishlistCount == 1) { 28 $(".uber_heading_section").html('<h3 style="text-align: center; width: 100%">Keine Wunschliste!</h3>') 29 $(".uber_heading_section").css('text-align', 'center') 30 } 31 } 32 $this.children().attr('src', ajax_params.directory_uri + '/assets/img/heart.svg') 33 } else { 34 const wishlistCount = parseInt($('.wishlist').text()); 35 $('.wishlist').text(wishlistCount + 1); 36 $this.children().attr('src', ajax_params.directory_uri + '/assets/img/heart_added.svg'); 37 } 38 } else { 39 window.location.replace(ajax_params.siteurl + '/mein-konto') 40 } 41 } 42 }); 43 }); 44 45 46 $('#custom_login').on('submit',function (e) { 47 e.preventDefault(); 48 const form_data = $(this).serializeArray(); 49 $('.login_loader').css('display','block'); 50 const data = { 51 'action': 'custom_login', 52 'username': form_data[1].value, 53 'password': form_data[2].value 54 }; 55 56 $.ajax({ 57 url: ajax_params.ajaxurl, // AJAX handler 58 data: data, 59 type: 'POST', 60 success: function (res) { 61 $('.login_loader').css('display','none'); 62 res = JSON.parse(res); 63 if (res.status == 200) { 64 window.location.replace(res.url) 65 } else { 66 $('.error_msg').html(res.message); 67 } 68 } 69 }); 70 }); 71 72 $('#custom_registration').on('submit',function (e) { 73 e.preventDefault(); 74 const form_data = $(this).serializeArray(); 75 $('.register_loader').css('display','block'); 76 const data = { 77 'action': 'custom_registration', 78 'email': form_data[1].value, 79 'password': form_data[2].value 80 }; 81 82 $.ajax({ 83 url: ajax_params.ajaxurl, // AJAX handler 84 data: data, 85 type: 'POST', 86 success: function (res) { 87 $('.register_loader').css('display','none'); 88 res = JSON.parse(res); 89 console.log(res); 90 if (res.status == 200) { 91 window.location.replace(res.url) 92 } else { 93 $('.error_msg').html(res.message); 94 } 95 } 96 }); 97 }); 98 99 100 var intro_swiper_container = new Swiper(".intro_swiper_container", { 101 slidesPerView: 1, 102 visibilityFullFit: true, 103 cssWidthAndHeight: true, 104 spaceBetween: 0, 105 navigation: { 106 nextEl: ".intro_swiper_button_next", 107 prevEl: ".intro_swiper_button_prev", 108 }, 109 // pagination: { 110 // el: ".swiper-pagination", 111 // clickable: true, 112 // }, 113 breakpoints: { 114 0: { 115 slidesPerView: 1, 116 spaceBetween: 15, 117 }, 118 576: { 119 slidesPerView: 1, 120 spaceBetween: 15, 121 }, 122 123 992: { 124 slidesPerView: 1, 125 spaceBetween: 20, 126 }, 127 1200: { 128 slidesPerView: 1, 129 spaceBetween: 20, 130 }, 131 1380: { 132 slidesPerView: 1, 133 spaceBetween: 45, 134 }, 135 1920: { 136 slidesPerView: 1, 137 spaceBetween: 45, 138 }, 139 140 }, 141 }); 142 143 let stories_swiper_container = new Swiper(".stories_swiper_container", { 144 slidesPerView: 1, 145 visibilityFullFit: true, 146 cssWidthAndHeight: true, 147 spaceBetween: 0, 148 pagination: { 149 el: ".swiper-pagination", 150 clickable: true, 151 }, 152 breakpoints: { 153 0: { 154 slidesPerView: 1, 155 spaceBetween: 15, 156 }, 157 576: { 158 slidesPerView: 1, 159 spaceBetween: 15, 160 }, 161 162 992: { 163 slidesPerView: 1, 164 spaceBetween: 20, 165 }, 166 1200: { 167 slidesPerView: 1, 168 spaceBetween: 20, 169 }, 170 1380: { 171 slidesPerView: 1, 172 spaceBetween: 45, 173 }, 174 1920: { 175 slidesPerView: 1, 176 spaceBetween: 45, 177 }, 178 179 }, 180 }); 181 182 183 $(".custom_veriation_change").on('click', function () { 184 // console.log('clicked') 185 // console.log(this) 186 // console.log(this.dataset.value) 187 const selected_attri_vari_name = $(this).parent().data('attribute-name'); 188 const attri_tax_name = $(this).parent().data('attribute-tax'); 189 $("#"+attri_tax_name).val(this.dataset.value).trigger('change'); 190 $(this).parent().parent().addClass('active').siblings().removeClass('active'); 191 const variations = $(".variations_form").data('product_variations'); 192 const index = variations.findIndex((element) => element.attributes[selected_attri_vari_name] === this.dataset.value); 193 const variation_id = variations[index].variation_id; 194 const variation_image = variations[index].image.url; 195 if (typeof variation_image != undefined) { 196 $(".woocommerce-product-gallery__image a img").attr('src', variation_image); 197 } 198 // $('.variation_id').val(variation_id); 199 // $('.price').html(variations[index].price_html); 200 // $('.single_add_to_cart_button').removeClass('disabled
200wc-variation-selection-needed') 201 // $('.woocommerce-variation-add-to-cart').removeClass('woocommerce-variation-add-to-cart-disable') 202 // $('.woocommerce-variation-add-to-cart').addClass('woocommerce-variation-add-to-cart-enable') 203 // $('.woocommerce-variation-add-to-cart').addClass('woocommerce-variation-add-to-cart-enabled') 204 }); 205 206}); 207 208window.addEventListener("load", (event) => { 209 210 function isDefaultVariation() { 211 const is_default_veri_set = jQuery('.default_variation'); 212 if (is_default_veri_set.length) { 213 jQuery(is_default_veri_set).parent().parent().addClass('active'); 214 const selected_attri_vari_name = jQuery(is_default_veri_set).parent().data('attribute-name'); 215 const attri_tax_name = jQuery(is_default_veri_set).parent().data('attribute-tax'); 216 jQuery("#"+attri_tax_name).val(is_default_veri_set.data('value')).trigger('change'); 217 const variations = jQuery(".variations_form").data('product_variations'); 218 const index = variations.findIndex((element) => element.attributes[selected_attri_vari_name] === is_default_veri_set[0].dataset.value); 219 const variation_id = variations[index].variation_id; 220 const variation_image = variations[index].image.url; 221 if (typeof variation_image != undefined) { 222 jQuery(".woocommerce-product-gallery__image a img").attr('src', variation_image); 223 } 224 // jQuery('.variation_id').val(variation_id); 225 // jQuery('.single_add_to_cart_button').removeClass('disabled wc-variation-selection-needed'); 226 // jQuery('.woocommerce-variation-add-to-cart').removeClass('woocommerce-variation-add-to-cart-disable'); 227 // jQuery('.woocommerce-variation-add-to-cart').addClass('woocommerce-variation-add-to-cart-enable'); 228 // jQuery('.woocommerce-variation-add-to-cart').addClass('woocommerce-variation-add-to-cart-enabled'); 229 } 230 } 231 232 isDefaultVariation(); 233 234}); 235 236 237jQuery(function ($) { 238 //Menu Hamburger icon 239 jQuery(".menu_toggle").click(function () { 240 jQuery(".main_mobile_menu").toggle(); 241 jQuery('body').addClass('full_screen_menu_active'); 242 }); 243 244 //Mobile Menu Close 245 jQuery('.mobile_close_button').click(function () { 246 jQuery('.main_mobile_menu').toggle(); 247 jQuery('body').removeClass('full_screen_menu_active'); 248 }); 249 250 $('.main_mobile_menu .menu .menu-item-has-children > a').addClass('has-submenu'); 251 $('.main_mobile_menu .menu .menu-item-has-children > a').click(function (e) { 252 e.preventDefault(); 253 $(this).parent().find('ul').slideToggle('show_sub_menu'); 254 }); 255 256 257 $('.mobile_search_button').on('click', function (e) { 258 e.preventDefault(); 259 $('.full_screen_search').slideToggle(); 260 // $('#mobile-nav-offcanvas-layer').toggleClass('open'); 261 262 $('body').addClass('full_screen_menu_active'); 263 264 $('.mobile_menu').hide(); 265 266 }); 267 268 //Mobile Menu Close 269 $('.close_search_button').click(function () { 270 $('.full_screen_search').slideToggle(); 271 $('#mobile-nav-offcanvas-layer').toggleClass('open'); 272 $('body').removeClass('full_screen_menu_active'); 273 $('#ajaxsearchprores10_1').hide(); 274 }); 275 276 277 //Mobile Menu Close 278 $('.close_newsletter, .open_newsletter_box').click(function () { 279 $('.newsletter_box').slideToggle(); 280 }); 281 282 //Hide Menu when newlsetter box open 283 $('.main_mobile_menu .open_newsletter_box').click(function () { 284 $('.main_mobile_menu').hide(); 285 $('body').removeClass('full_screen_menu_active'); 286 $('#ajaxsearchprores10_1').hide(); 287 }); 288 289
290 $('.close_woocommerce_alert_message').on('click', function () { 291 $(this).parent().parent().parent().html(''); 292 }) 293 294 295 /*checking custom checkout process*/ 296 $(".show_checkout_payment").on("click", function (e) { 297 e.preventDefault(); 298 const notice_wrappers = jQuery(".woocommerce-notices-wrapper"); 299 if (notice_wrappers.length > 1) { 300 jQuery(notice_wrappers[0]).remove(); 301 } 302 303 const shipingBox = document.getElementById('ship-to-different-address-checkbox'); 304 305 var $checkout_form = $("form.checkout"); 306 var country = $("#billing_country").val(), 307 first_name = $("#billing_first_name").val(), 308 last_name = $("#billing_last_name").val(), 309 company = $("#billing_company").val(), 310 billing_phone = $("#billing_phone").val(), 311 state = $("#billing_state").val(), 312 postcode = $(":input#billing_postcode").val(), 313 city = $("#billing_city").val(), 314 address = $(":input#billing_address_1").val(), 315 street_name = $(":input#billing_street_name").val(), 316 house_number = $(":input#billing_house_number").val(), 317 address_2 = $(":input#billing_address_2").val(), 318 $required_inputs = $("form.checkout").find( 319 ".address-field.validate-required:visible" 320 ), 321 has_full_address = true; 322 323 if (typeof shipingBox !== 'undefined' && shipingBox !== null) { 324 if (shipingBox.checked) { 325 var s_first_name = $("#shipping_first_name").val(), 326 s_last_name = $("#shipping_last_name").val(), 327 s_company = $("#shipping_company").val(), 328 // s_country = $("#shipping_country").val(), 329 s_country = $("#shipping_country option:selected").text(), 330 s_state = $("#shipping_state").val(), 331 s_postcode = $("#shipping_postcode").val(), 332 s_city = $("#shipping_city").val(), 333 s_address = $("#shipping_address_1").val(), 334 s_address_2 = $("#shipping_address_2").val(); 335 } 336 } 337 338 339 if ($required_inputs.length) { 340 $required_inputs.each(function () { 341 if ($(this).find(":input").val() === "") { 342 has_full_address = false; 343 } 344 }); 345 } 346 if (first_name == "") { 347 has_full_address = false; 348 console.log(ajax_params.errors.first_name) 349 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.first_name+'</p>'); 350 } 351 if (last_name == "") { 352 has_full_address = false; 353 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.last_name+'</p>'); 354 } 355 if (city == "") { 356 has_full_address = false; 357 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.city+'</p>'); 358 } 359 if (country == "") { 360 has_full_address = false; 361 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.country+'</p>'); 362 } 363 // if (address == "") { 364 // has_full_address = false; 365 // $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.address+'</p>'); 366 // } 367 if (street_name == "") { 368 has_full_address = false; 369 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.street_name+'</p>'); 370 } 371 if (house_number == "") { 372 has_full_address = false; 373 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.house_number+'</p>'); 374 } 375 if (billing_phone == "") { 376 has_full_address = false;
377 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.billing_phone+'</p>'); 378 } 379 if (typeof shipingBox !== 'undefined' && shipingBox !== null) { 380 if (shipingBox.checked) { 381 if (s_first_name == '') { 382 has_full_address = false; 383 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.s_first_name+'</p>'); 384 } 385 if (s_last_name == '') { 386 has_full_address = false; 387 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.s_last_name+'</p>'); 388 389 } 390 if (s_address == '') { 391 has_full_address = false; 392 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.s_address+'</p>'); 393 394 } 395 if (s_address_2 == '') { 396 has_full_address = false; 397 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.s_address_2+'</p>'); 398 399 } 400 if (s_postcode == '') { 401 has_full_address = false; 402 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.s_postcode+'</p>'); 403 } 404 if (s_city == '') { 405 has_full_address = false; 406 $(".woocommerce-notices-wrapper").append('<p class="woocommerce_checkout_required_field_notice">'+ajax_params.errors.s_city+'</p>'); 407 } 408 } 409 } 410 411 if (has_full_address) { 412 if($(".woocommerce-notices-wrapper").hasClass("checkout_errors")){ 413 $(".woocommerce-notices-wrapper").removeClass("checkout_errors"); 414 } 415 $("#billing_wrapper").css("display", "none"); 416 $("#order_review").css("display", "block"); 417 418 419 jQuery(".step_3").addClass("active"); 420 jQuery(".step_2").addClass("d-none"); 421 jQuery(".step_2_img").removeClass("d-none") 422 $(".woocommerce-notices-wrapper").html(""); 423 424 const full_name = 425 $("#billing_first_name").val() + " " + $("#billing_last_name").val(); 426 const address = 427 $("#billing_address_1").val(); 428 const company = $("#billing_company").val(); 429 const postal_code = $("#billing_postcode").val(); 430 const city = $("#billing_city").val(); 431 // const country = $("#billing_country").val(); 432 const country = $("#billing_country option:selected").text(); 433 const email = $("#billing_email").val(); 434 const phone = $("#billing_phone").val(); 435 436 $(".short_full_name").text(full_name); 437 $(".short_company").text(company); 438 $(".short_street_address").text(address); 439 $(".short_postal_code").text(postal_code + " " + city); 440 $(".short_country").text(country); 441 $(".short_email").text(email); 442 $(".short_phone").text(phone); 443 if (typeof shipingBox !== 'undefined' && shipingBox !== null) { 444 if (shipingBox.checked) { 445 $('.short_shipping_info').css('display', 'block'); 446 $(".s_short_full_name").text(s_first_name + " " + s_last_name); 447 $(".s_short_company").text(s_company); 448 $(".s_short_street_address").text(s_address); 449 $(".s_short_postal_code").text(s_postcode + " " + city); 450 $(".s_short_country").text(s_country); 451 // $(".s_short_email").text(s_email); 452 // $(".s_short_phone").text(phone); 453 } 454 } 455 window.scrollTo(200, 0); 456 } else { 457 $(".woocommerce-notices-wrapper").addClass("checkout_errors"); 458 window.scrollTo(200, 0); 459 } 460 // // Remove any notices added previously 461 // $( '.woocommerce-NoticeGroup-updateOrderReview' ).remove(); 462 463 // $( '.woocommerce-error, .woocommerce-message' ).remove(); 464 // 465 // // Add new errors returned by this event 466 // if ( data.messages ) { 467 // $form.prepend( '<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-updateOrderReview">' + data.messages + '</div>' ); // eslint-disable-line max-len 468 // } else { 469 // $form.prepend( data ); 470 // } 471 }); 472 473 $("#checkout_previous, .edit_billing_info_custom").on("click", function (e) { 474 e.preventDefault(); 475 $("#billing_wrapper").css("display", "block"); 476 jQuery(".step_3").removeClass("active"); 477 jQuery(".step_2").removeClass("d-none"); 478 jQuery(".step_2_img").addClass("d-none"); 479 $("#order_review").css("display", "none"); 480 }); 481 482 $(".order_review_handler").on("click", function () { 483 $(".order_review_custom, .checkout_extra_info").toggle(); 484 }); 485 486 487 /* 488 * Toggle mini cart on cart icon click 489 * */ 490 $(".cart_button_toggle, .close_mini_cart").on("click", function (e) { 491 e.preventDefault(); 492 $(".checkout_order_review_cart").toggle(); 493 }); 494 495 /* 496 * Update cart quantity 497 * */ 498 let free = true; 499 $(".custom_cart_quantity").on("change", custom_cart_quantity); 500 $(".custom_cart_quantity").on("keyup", custom_cart_quantity); 501 502 function custom_cart_quantity(e) { 503 e.preventDefault(); 504 const quantity = $(this).val(); 505 const item_key = $(this).data("item_key"); 506 // let key = (e.keyCode ? e.keyCode : e.which); 507 // let character = String.fromCharCode(key) 508 // console.log('You pressed key : ' + e.key); 509 // console.log(e.target.classList[0]); 510 const isNumber = /^[0-9]$/i.test(e.key); 511 512 if ( 513 (isNumber || e.target.classList[0] == "custom_cart_quantity") && 514 $(this).val() > 0 && 515 quantity != "" && 516 item_key != "" 517 ) { 518 $(".custom_cart_loader").toggle(); 519 if (free) { 520 free = false;
521 const data = { 522 action: "custom_update_cart", 523 item_key: item_key, 524 quantity: quantity, 525 }; 526 $.ajax({ 527 url: ajax_params.ajaxurl, // AJAX handler 528 data: data, 529 type: "POST", 530 success: function (data) { 531 free = true; 532 $(".custom_cart_loader").toggle(); 533 var data = JSON.parse(data); 534 if (data.status == 200) { 535 $(".woocommerce-mini-cart__total").html(data.total); 536 // $('.custom_message').text(data.message) 537 // location.reload(); 538 } else { 539 // $('.custom_message').text(data.message) 540 // location.reload(); 541 } 542 }, 543 }); 544 } 545 } 546 } 547 548 /* 549 * change mini cart quantity on plus minus button click 550 * */ 551 $(".quantitya").on( 552 "click", 553 "button.plus_mini, button.minus_mini", 554 function () { 555 // Get current quantity values 556 var show_qty = $(this).siblings(".custom_cart_quantity"); 557 var qty = $(this).siblings(".custom_cart_quantity"); 558 var val = parseInt(show_qty.val()); 559 560 // Change the value if plus or minus 561 if ($(this).is(".plus_mini")) { 562 $(this) 563 .siblings(".custom_cart_quantity") 564 .val(parseInt(val + 1)) 565 .trigger("change"); 566 } else { 567 if (val <= 1) { 568 return; 569 } 570 $(this) 571 .siblings(".custom_cart_quantity") 572 .val(parseInt(val - 1)) 573 .trigger("change"); 574 } 575 } 576 ); 577 578 579 $( ".variations_form" ).on( "woocommerce_variation_select_change", function () { 580 setTimeout(function () { 581 const stuck_vari = document.getElementById('pa_stuck'); 582 if(stuck_vari != null) { 583 changeCustomVariView(stuck_vari.options) 584 }else{ 585 const stuck_vari = document.getElementById('pa_stueck'); 586 changeCustomVariView(stuck_vari.options) 587 } 588 589 },100); 590 591 } ); 592}); 593 594function changeCustomVariView(options){ 595 /* 596 *this.options 597 * first child will be default choice option 598 * so have to ignore that 599 * */ 600 const values_object = []; 601 if (options.length > 1) { 602 for (let i = 1; i <= options.length; i++) { 603 if (options[i]) { 604 // const option_value = options[i].value 605 // we can also use hasAttribute(name) and getAttribute(name) functions 606 const option_value = options[i].attributes[0].nodeValue 607 values_object.push(option_value); 608 } 609 } 610 showCustomVariation(values_object); 611 } 612} 613 614function showCustomVariation(variations) { 615 /* 616 * show custom variation if option value exist 617 * */ 618 const custom_variation = document.querySelector('.custom_variation_row'); 619 if (custom_variation) { 620 const custom_var = custom_variation.children; 621 if (custom_var.length > 0) { 622 for (let i = 0; i < custom_var.length; i++) { 623 624 // console.log(custom_var[i].dataset.mirror); 625 if (variations.includes(custom_var[i].dataset.mirror)) { 626 custom_var[i].style.display = 'block'; 627 } else { 628 custom_var[i].style.display = 'none'; 629 } 630 631 } 632 } 633 } 634} 635 636jQuery(function (jQuery) { 637 // Select parent elements with the class 'parent' 638 var parentElements = jQuery("td.value"); 639 640 // Loop through each parent element 641 parentElements.each(function () { 642 // Check if the parent element contains a child with the class 'specific-class'
643 var hasSpecificChild = 644 jQuery(this).find("select#menge").length > 645 0; 646 // If it does, add the class 'parent-with-child-class' to the parent element 647 if (hasSpecificChild) { 648 jQuery('td.value a.reset_variations').addClass('mleft'); 649 } 650 }); 651}); 652
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.