1$(document).ready(function () { 2 // PRICE RANGE 3 var minVal = parseInt($('#minCost').val()); 4 var maxVal = parseInt($('#maxCost').val()); 5 var choosen_minVal = parseInt($('#choosen_minCost').val()); 6 var choosen_maxVal = parseInt($('#choosen_maxCost').val()); 7 var uri = $('#uri').val(); 8 $("#price_slider").slider({ 9 range: true, 10 min: minVal, 11 max: maxVal, 12 values: [choosen_minVal, choosen_maxVal], 13 stop: function (event, ui) { 14 $("#amount").val("kr " + ui.values[ 0 ] + " - kr " + ui.values[ 1 ]); 15 16 var chMin = ui.values[ 0 ]; 17 var chMax = ui.values[ 1 ]; 18 var link = uri + '&min=' + chMin + '&max=' + chMax; 19 window.location.href = link; 20// $.ajax({ 21// type:"GET", 22// dataType: 'json', 23// data: { 24// min: chMin, 25// max: chMax, 26// ajaxCall: 1 27// }, 28// success: function(result){ 29// var link = uri + '&min='+chMin+'&max='+chMAx; 30// windows.location.href() 31// //$(".prod_list").html(result.html); 32// return; 33// } 34// }); 35 } 36 }); 37 $("#amount").val("kr " + $("#price_slider").slider("values", 0) + 38 " - kr " + $("#price_slider").slider("values", 1)); 39 40 41 // FANCYBOX 42 $('.fancybox').fancybox(); 43 $('.fancybox-thumb').fancybox({ 44 padding: 0, 45 margin: 0, 46 maxWidth: '100%', 47 maxHeight: '100%', 48 //height: '100%', 49 arrows: false, 50 helpers: { 51 thumbs: true, 52 } 53 }); 54 55 56 // TOP MENU FOR TOUCH SCREEN 57 $('.topmenu li:has(ul)').doubleTapToGo(); 58 59 60 // PRODUCT TABS 61 $('.tabs_holder div.tab:not(:first)').hide(); 62 63 $('.tabs_nav:not(.notabs) li').click(function (event) { 64 event.preventDefault(); 65 $('.tabs_holder div.tab').hide(); 66 $('.tabs_nav .current').removeClass("current"); 67 $(this).addClass('current'); 68 69 var clicked = $(this).find('a:first').attr('href'); 70 $('.tabs_holder ' + clicked).fadeIn('fast'); 71 }).eq(0).addClass('current'); 72 73 74 //MOBILE MENU 75 $("nav#mobile_menu").mmenu({ 76 // "slidingSubmenus": false, 77 "extensions": [ 78 "border-full", 79 "pagedim-black", 80 ], 81 "offCanvas": { 82 "position": "left", 83 }, 84 navbar: { 85 title: "Strikkemekka" 86 }, 87 /*"navbars": [ 88 { 89 "position": "bottom", 90 "content": [ 91 "searchfield" 92 ] 93 } 94 ],*/ 95 96 }); 97 98 /* //FIXED MOBILE MENU BUTTON 99 var stickyNavTop = $('.btn_mobile_menu').offset().top; 100 var stickyNav = function(){ 101 var scrollTop = $(window).scrollTop(); 102 103 if (scrollTop > stickyNavTop) { 104 $('.btn_mobile_menu').addClass('fixed'); 105 } else { 106 $('.btn_mobile_menu').removeClass('fixed'); 107 } 108 }; 109 110 stickyNav(); 111 112 $(window).scroll(function() { 113 stickyNav(); 114 });*/ 115 116 117 // MENU FILTERS 118 /*$('.btn_open_filters').click(function(){ 119 $(this).toggleClass('active'); 120 $('.prodlist_left').toggleClass('active'); 121 });*/ 122 123 // MENU FILTERS 124 /*$('.btn_open_filters').click(function () { 125 $('.prodlist_left').addClass('active'); 126 }); 127 128 $('.btn_close_filters').click(function () { 129 $('.prodlist_left').removeClass('active'); 130 });*/ 131 132 133 //SCROLL IN SELECT COLORS 134 $(".all_options").mCustomScrollbar({ 135 theme: 'dark-2', 136 scrollInertia: 0, 137 mouseWheel: { 138 scrollAmount: 50 139 } 140 }); 141 142 //FIXED HEADER / FIXED PRODLIST CATEGORIES / FIXED FITLERS / BOTTOM TOOLBAR 143 var topmenuOffsetTop = $('.topmenu_sec').offset().top; 144 //var headerSecOffsetTop = $('.header_sec').offset().top + $('.header_sec').height(); 145 146 if ($('.prodlist_categories_menu_box').length) { 147 var categoriesMenuOffsetTop = $('.prodlist_categories_menu_box').offset().top + 100; 148 } 149 150 var stickyNav = function () { 151 var scrollTop = $(window).scrollTop(); 152 153 if (scrollTop > topmenuOffsetTop) { 154 $('.topmenu_sec').addClass('sticky'); 155 } else { 156 $('.topmenu_sec').removeClass('sticky'); 157 } 158 159 /*if (scrollTop > headerSecOffsetTop) { 160 $('.bottom_toolbar').addClass('active'); 161 $('#CookiebotWidget').css('bottom','75px'); 162 } else { 163 $('.bottom_toolbar').removeClass('active'); 164 $('#CookiebotWidget').css('bottom','0'); 165 }*/ 166 167 if (scrollTop > categoriesMenuOffsetTop ) { 168 $('.prodlist_categories_menu_box').addClass('sticky'); 169 } else { 170 $('.prodlist_categories_menu_box').removeClass('sticky'); 171 } 172 173 if (scrollTop > 50) { 174 $('.catalog_filters_box').addClass('sticky'); 175 }else { 176 $('.catalog_filters_box').removeClass('sticky'); 177 } 178 }; 179 180 stickyNav(); 181 182 $(window).scroll(function () { 183 stickyNav(); 184 });
185 186 /*// DIXED MOBILE NAVIGATION 187 var stickyMobileNavTop = $('.mobile_header_btns_holder').offset().top; 188 var stickyMobileNav = function(){ 189 var scrollTop = $(window).scrollTop(); 190 191 if (scrollTop > stickyMobileNavTop) { 192 $('.mobile_header_btns_holder').addClass('sticky'); 193 } else { 194 $('.mobile_header_btns_holder').removeClass('sticky'); 195 } 196 }; 197 198 stickyMobileNav(); 199 200 $(window).scroll(function() { 201 stickyMobileNav(); 202 });*/ 203 204 // OPEN SEARCH 205 $('.btn_open_search').click(function () { 206 if ($('.mobile_header_btns_holder .search_form').css('display') === 'block') { 207 $(this).removeClass('current'); 208 $('.mobile_header_btns_holder .search_form').slideUp(); 209 } else { 210 $(this).addClass('current'); 211 $('.mobile_header_btns_holder .search_form').slideDown(); 212 } 213 }); 214 215 /* // DISPLAY SEARCH FORM 216 $('.header_search .btn_open_search').click(function(){ 217 $(this).parent('.header_search').find('form').fadeIn(); 218 });*/ 219 220 //POPUP DOWNLOAD 221 $('.button_download').click(function() { 222 $('.download_modal_box').addClass('active'); 223 }); 224 225 //POPUP LOGIN 226 $('.btn_open_login_popup').click(function() { 227 $('.popup_box_login').addClass('active'); 228 }); 229 230 //POPUP 231 $('.btn_close_popup, .btn_continue').click(function () { 232 $('.popup_box').removeClass('active'); 233 }); 234 235 // Placeholder crossbrowser 236 $('input, textarea').placeholder(); 237 238 239 $('.show_giftcard_field').click(function () { 240 $(this).hide(); 241 $('.giftcard_box').fadeIn(300); 242 $('.giftcard_box input:first-child').focus(); 243 244 return false; 245 }); 246 247 248 $('.edit_password').click(function () { 249 $('.password_static').hide(); 250 $('.password_row').css('display', 'flex'); 251 $('input.password_ip').focus(); 252 253 return false; 254 }); 255 256 $('.mobile_all_options_close').click(function () { 257 $('.simulation_select > input').prop('checked', false); 258 return false; 259 }); 260 261 //ANCHOR REVIEWS SECTION 262 $('#lipscore-rating').on('click', function (event) { 263 $('html, body').stop().animate({ 264 scrollTop: $('.reviews_holder').offset().top - 70 265 }, 1000); 266 267 $('.reviews_holder .accordion_title').next('.accordion_content').slideDown(); 268 $('.reviews_holder .accordion_title').parent('.accordion_item').addClass('open'); 269 }); 270 271 //ANCHOR INFO SECTION 272 $('.js_btn_read_more').on('click', function (event) { 273 $('html, body').stop().animate({ 274 scrollTop: $('.prod_info_holder').offset().top - 170 275 }, 1000); 276 277 $('.prod_info_holder .accordion_title').next('.accordion_content').slideDown(); 278 $('.prod_info_holder .accordion_title').parent('.accordion_item').addClass('open'); 279 }); 280 281 //CHANGE PRODUCT QTY 282 $('.js_prod_package_selectQty').change(function(){ 283 var prodPackageQty = parseInt($(this).find('option:selected').val()); 284 var addPrice = $('.addPrice').val() ? parseInt($('.addPrice').val()) : 0; 285 286 var oldPrice = parseInt($('.js_mainPriceHolder .priceValue').attr("data-price")); 287 var newPrice = parseInt((addPrice + oldPrice)*prodPackageQty); 288 var regularPoints = newPrice; 289 290 // members price 291 var oldMemberPrice = parseInt($('.js_mainPriceHolder .memberPriceValue').attr("data-memberPrice")); 292 var newMemberPrice = parseInt((addPrice + oldMemberPrice)*prodPackageQty); 293 294 if(!isNaN(newMemberPrice)) { 295 regularPoints = newMemberPrice; 296 } 297 298 var goldenPoints = regularPoints * 2; 299 300 $('.js_total_sum .priceValue').html(newPrice); 301 $('.js_mainPriceHolder .prod_price_box .priceValue').html(newPrice); 302 303 $('.js_mainPriceHolder .prod_price_info_box .priceValue').html(regularPoints); 304 $('.js_mainPriceHolder .prod_price_info_box .goldenPriceValue').html(golde
304nPoints); 305 306 // members price 307 $('.js_total_sum .memberPriceValue').html(newMemberPrice); 308 $('.js_mainPriceHolder .memberPriceValue').html(newMemberPrice); 309 310 // MER+ price 311 var oldMerplusPrice = parseInt($('.js_mainPriceHolder .merPlusValue').attr("data-merplus")); 312 var newMerplusPrice = parseInt((addPrice + oldMerplusPrice)*prodPackageQty); 313 $('.js_total_sum .merPlusValue').html(newMerplusPrice); 314 $('.js_mainPriceHolder .merPlusValue').html(newMerplusPrice); 315 }); 316 317 $('.prod_package .minus').on('click', function () { 318 var inputQty = $(this).parent().find('.input_qty'); 319 var count = parseInt(inputQty.val()) - 1; 320 var prodPackageQty = parseInt($('.js_prod_package_selectQty').find('option:selected').val()); 321 322 count = count < 1 ? 1 : count; 323 inputQty.val(count); 324 325 var inputs = $(".input_qty"); 326 var addPrice = 0; 327 for (var i = 0; i < inputs.length; i++) 328 { 329 defQtty = parseInt($(inputs[i]).attr("data-defaultQtty")); 330 331 if ($(inputs[i]).val() > defQtty) 332 { 333 diff = parseInt($(inputs[i]).val() - defQtty); 334 sizePrice = parseInt($(inputs[i]).attr("data-sizePrice")); 335 336 addPrice = parseInt(addPrice) + (diff * parseInt(sizePrice)); 337 } 338 //alert($(inputs[i]).val()); 339 } 340 341 342 343 if (addPrice >= 0) 344 { 345 $('.addPrice').val(addPrice); 346 347 var oldPrice = parseInt($('.js_mainPriceHolder .priceValue').attr("data-price")); 348 var newPrice = parseInt((addPrice + oldPrice)*prodPackageQty); 349 var regularPoints = newPrice; 350 351 // members price 352 var oldMemberPrice = parseInt($('.js_mainPriceHolder .memberPriceValue').attr("data-memberPrice")); 353 var newMemberPrice = parseInt((addPrice + oldMemberPrice)*prodPackageQty); 354 355 if (!isNaN(newMemberPrice)) { 356 regularPoints = newMemberPrice; 357 } 358 359 var goldenPoints = regularPoints * 2; 360 361 $('.js_total_sum .priceValue').html(newPrice); 362 $('.js_mainPriceHolder .prod_price_box .priceValue').html(newPrice); 363 364 $('.js_mainPriceHolder .prod_price_info_box .priceValue').html(regularPoints); 365 $('.js_mainPriceHolder .prod_price_info_box .goldenPriceValue').html(goldenPoints); 366 367 // members price 368 $('.js_total_sum .memberPriceValue').html(newMemberPrice); 369 $('.js_mainPriceHolder .memberPriceValue').html(newMemberPrice); 370 371 // MER+ price 372 var oldMerplusPrice = parseInt($('.merPlusValue').attr("data-merplus")); 373 var newMerplusPrice = parseInt((addPrice + oldMerplusPrice)*prodPackageQty); 374 $('.js_total_sum .merPlusValue').html(newMerplusPrice); 375 $('.js_mainPriceHolder .merPlusValue').html(newMerplusPrice) 376 } 377 }); 378 379 $('.prod_package .plus').on('click', function () { 380 var inputQty = $(this).parent().find('.input_qty'); 381 var maxQty = parseInt(inputQty.attr('max')); 382 var count = parseInt(inputQty.val()) + 1; 383 var prodPackageQty = parseInt($('.js_prod_package_selectQty').find('option:selected').val()); 384 385 count = count > maxQty ? maxQty : count; 386 inputQty.val(count); 387 388 var inputs = $(".input_qty"); 389 var addPrice = 0; 390 for (var i = 0; i < inputs.length; i++) 391 { 392 defQtty = parseInt($(inputs[i]).attr("data-defaultQtty")); 393 394 if ($(inputs[i]).val() > defQtty) 395 { 396 diff = parseInt($(inputs[i]).val() - defQtty); 397 sizePrice = parseInt($(inputs[i]).attr("data-sizePrice")); 398 399 addPrice = parseInt(addPrice) + (diff * parseInt(sizePrice)); 400 } 401 // alert($(inputs[i]).val()); 402 } 403 404 if (addPrice >= 0) 405 { 406 $('.addPrice').val(addPrice); 407 408 var oldPrice = parseInt($('.js_mainPriceHolder .priceValue').attr("data-price")); 409 var newPrice = parseInt((addPrice + oldPrice)*prodPackageQty); 410 var regularPoints = newPrice; 411 412 // members price 413 var oldMemberPrice = parseInt($('.js_mainPriceHolder .memberPriceValue').attr("data-memberPrice")); 414 var newMemberPrice = parseInt((addPrice + oldMemberPrice)*prodPackageQty); 415 416 if (!isNaN(newMemberPrice)) { 417 regularPoints = newMemberPrice; 418 } 419 420 var goldenPoints = regularPoints * 2; 421 422 $('.js_total_sum .priceValue').html(newPrice); 423 $('.js_mainPriceHolder .prod_price_box .priceValue').html(newPrice); 424 425 $('.js_mainPriceHolder .prod_price_info_box .priceValue').html(regularPoints); 426 $('.js_mainPriceHolder .prod_price_info_box .goldenPriceValue').html(golde
426nPoints); 427 428 // members price 429 $('.js_total_sum .memberPriceValue').html(newMemberPrice); 430 $('.js_mainPriceHolder .memberPriceValue').html(newMemberPrice); 431 432 // MER+ price 433 var oldMerplusPrice = parseInt($('.merPlusValue').attr("data-merplus")); 434 var newMerplusPrice = parseInt((addPrice + oldMerplusPrice)*prodPackageQty); 435 $('.js_total_sum .merPlusValue').html(newMerplusPrice); 436 $('.js_mainPriceHolder .merPlusValue').html(newMerplusPrice); 437 } 438 439 }); 440 441 //CHANGE PRODUCT QTY - ONLY FOR 'JUST COLOR' PRODUCTS 442 $('.prod_yarn .minus').on('click', function () { 443 var inputQty = $(this).parent().find('.input_qty'); 444 var count = parseInt(inputQty.val()) - 1; 445 count = count < 1 ? 1 : count; 446 inputQty.val(count); 447 448 var oldPrice = parseInt($('.js_mainPriceHolder .priceValue').attr("data-price")); 449 var newPrice = parseInt(oldPrice*count); 450 var regularPoints = newPrice; 451 452 // members price 453 var oldMemberPrice = parseInt($('.js_mainPriceHolder .memberPriceValue').attr("data-memberPrice")); 454 var newMemberPrice = parseInt(oldMemberPrice*count); 455 456 if (!isNaN(newMemberPrice)) { 457 regularPoints = newMemberPrice; 458 } 459 460 var goldenPoints = regularPoints * 2; 461 462 // MER+ price 463 var oldMerplusPrice = parseInt($('.js_mainPriceHolder .merPlusValue').attr("data-merplus")); 464 var newMerplusPrice = parseInt(oldMerplusPrice*count); 465 466 $('.addPrice').val(newPrice); 467 $('.js_total_sum .priceValue').html(newPrice); 468 $('.js_mainPriceHolder .prod_price_box .priceValue').html(newPrice); 469 470 $('.js_mainPriceHolder .prod_price_info_box .priceValue').html(regularPoints); 471 $('.js_mainPriceHolder .prod_price_info_box .goldenPriceValue').html(goldenPoints); 472 473 // members price 474 $('.js_total_sum .memberPriceValue').html(newMemberPrice); 475 $('.js_mainPriceHolder .memberPriceValue').html(newMemberPrice); 476 477 // MER+ price 478 $('.js_total_sum .merPlusValue').html(newMerplusPrice); 479 $('.js_mainPriceHolder .merPlusValue').html(newMerplusPrice); 480 }); 481 482 $('.prod_yarn .plus').on('click', function () { 483 var inputQty = $(this).parent().find('.input_qty'); 484 var maxQty = parseInt(inputQty.attr('max')); 485 var count = parseInt(inputQty.val()) + 1; 486 487 count = count > maxQty ? maxQty : count; 488 inputQty.val(count); 489 490 var oldPrice = parseInt($('.js_mainPriceHolder .priceValue').attr("data-price")); 491 var newPrice = parseInt(oldPrice * count); 492 var regularPoints = newPrice; 493 494 // members price 495 var oldMemberPrice = parseInt($('.js_mainPriceHolder .memberPriceValue').attr("data-memberPrice")); 496 var newMemberPrice = parseInt(oldMemberPrice * count); 497 498 if (!isNaN(newMemberPrice)) { 499 regularPoints = newMemberPrice; 500 } 501 502 var goldenPoints = regularPoints * 2; 503 504 // MER+ price 505 var oldMerplusPrice = parseInt($('.js_mainPriceHolder .merPlusValue').attr("data-merplus")); 506 var newMerplusPrice = parseInt(oldMerplusPrice * count); 507 508 $('.addPrice').val(newPrice); 509 $('.js_total_sum .priceValue').html(newPrice); 510 $('.js_mainPriceHolder .prod_price_box .priceValue').html(newPrice); 511 512 $('.js_mainPriceHolder .prod_price_info_box .priceValue').html(regularPoints); 513 $('.js_mainPriceHolder .prod_price_info_box .goldenPriceValue').html(goldenPoints); 514 515 // members price 516 $('.js_total_sum .memberPriceValue').html(newMemberPrice); 517 $('.js_mainPriceHolder .memberPriceValue').html(newMemberPrice); 518 519 // MER+ price 520 $('.js_total_sum .merPlusValue').html(newMerplusPrice); 521 $('.js_mainPriceHolder .merPlusValue').html(newMerplusPrice); 522 523 }); 524 525 $('.ch_filter + label, .ch_subfilter + label').click(function(){ 526 $(this).prev('input').click(); 527 }) 528 529 $('.ch_subfilter').change(function(){ 530 let submenu = $(this).closest('.catalog_filters_submenu'); 531 let count = submenu.find('.ch_subfilter:checked').length; 532 if (count > 0) { 533 submenu.parent('li').children('.ch_filter').prop('checked', true) 534 } else { 535 submenu.parent('li').children('.ch_filter').prop('checked', false) 536 } 537 }) 538 539 $('.ch_filter').change(function(){ 540 let status = $(this).prop('checked'); 541 if (status == true) { 542 $(this).closest('li').find('.ch_subfilter').prop('checked', true) 543 } else { 544 $(this).closest('li').find('.ch_subfilter').prop('checked', false) 545 } 546 }) 547 548 /*$('.reset_filters').click(function(){ 549 $('.ch_filter, .ch_subfilter').prop('checked', false); 550 return false; 551 })*/ 552 553 $('.apply_filters').click(function(){ 554 $('.catalog_filters_box').fadeOut(); 555 $('.overlay').fadeOut(); 556 $('body').removeClass('inactive'); 557 }) 558 559 560 $(document).click(function (event) { 561 if (!$(event.target).is(".catalog_filters_box, .catalog_filters_box *")) { 562 $('.catalog_filters_box').fadeOut(); 563 $('.overlay').fadeOut(); 564 $('body').removeClass('inactive'); 565 } 566 });
567 568 $('.btn_filters').click(function(){ 569 if ( $('.catalog_filters_box').is(':visible') ) { 570 $('.catalog_filters_box').fadeOut(); 571 $('.overlay').fadeOut(); 572 $('body').removeClass('inactive'); 573 $(document).find('iframe[data-test-id="ChatWidgetMobileButton-iframe"]').show() 574 } else { 575 $(document).find('iframe[data-test-id="ChatWidgetMobileButton-iframe"]').hide() 576 $('.catalog_filters_box').css('display', 'flex'); 577 $('.overlay').fadeIn(); 578 $('body').addClass('inactive'); 579 } 580 return false; 581 }); 582 583 $(document).on('click', '.catalog_filters_column h3', function(){ 584 $(this).toggleClass('opened '); 585 $(this).next('ul').toggle(); 586 }) 587 588 //SHOW BESTSELLER FILTERS 589 $('.bestseller_filtering_box .button').click(function(){ 590 $('.bestseller_filters').fadeToggle(); 591 }) 592/* 593 $('.catalog_filters_submenu').closest('li').append('<span class="catalog_submenu_arrow"><i class="fa fa-angle-down"></i></span>') 594 595 $(document).on('click', '.catalog_submenu_arrow', function(){ 596 $(this).parent('li').toggleClass('opened '); 597 return false; 598 }) 599 */ 600 601 //change size of subprod 602 $('.changeSizeSubprod').click(function () { 603 $('.changeSizeSubprod').removeClass('current'); 604 $(this).addClass('current'); 605 606 var key = $(this).attr("data-propskey");//the key of subprod 607 var value = $(this).attr("data-propsval");//size id 608 var src = $(this).attr("data-propspic");//pic of the size 609 var name = $(this).attr("data-propsname");//name of the size 610 var maxQtty = parseInt($(this).attr("data-propsmax"));//max qtty for size 611 612 //alert(value); 613 //add the new values from the selected input 614 $('[name="props\\[' + key + '\\]"]').val(value); 615 $('[data_index="' + key + '"]').val(value); 616 $('[data_image="' + key + '"]').attr("src", src); 617 $('[data_name="' + key + '"]').html(name); 618 $('[name="props_qtty\\[' + key + '\\]"]').attr('max', maxQtty); 619 620 //check if qtty now for this size is not more than possible qtty for this size,problem with total price for this is in comment!!! 621// var qttyNow = parseInt($('[name="props_qtty\\[' + key +'\\]"]').val()); 622// if(qttyNow > maxQtty) 623// { 624// $('[name="props_qtty\\[' + key +'\\]"]').val(maxQtty); 625// 626// } 627 628 //if size is out of stock and u choose other,open all buy options 629 //1.change flag data-nostock to 0,and color from red to normal 630 //2.check all subprods if they ave this flag 631 //3.open buy options 632 // 633 //point 1,change flag data-nostock to 0,and color from red to normal 634 $('[data_name="' + key + '"]').attr("data-nostock", 0); 635 $('[data_name="' + key + '"]').css('color', "#4c4c4c;"); 636 //point 2,check all subprods if they ave this flag 637 var noStock = 0; 638 var inputs = $(".colorNames"); 639 for (var i = 0; i < inputs.length; i++) 640 { 641 noStockFlag = parseInt($(inputs[i]).attr("data-nostock")); 642 if (noStockFlag == 1) 643 { 644 noStock = 1; 645 } 646 } 647 648 //point 3 649 var mainSelectQtty = parseInt($('.qty').val()); 650 if (mainSelectQtty == 0 && noStock == 0) 651 { 652 $('.qty option:selected').attr('value', 1); 653 $('.qty option:selected').html(1); 654 $('.qty option:selected').css('color', "#4c4c4c;"); 655 $('.qty').css('color', ""); 656 $('#soldOutText').hide(); 657 var $activeCartBox = $('.mobible_cart_btn_box:visible, .prod_footer .cell:visible').first(); 658 $activeCartBox.find('#sendMailButton').hide(); 659 $activeCartBox.find('#buyButton').show(); 660 $('[data_name="' + key + '"]').css('color', "#4c4c4c;"); 661 } 662 663 // refresh "packs using same color" 664 // only trigger for main yarn (first row) 665 if (parseInt(key, 10) === 0) { 666 refreshPacksWithSameColor(value); // value === sizeId 667 } 668 });
669 670 function refreshPacksWithSameColor(sizeId) { 671 var prodId = $('#product-page').data('prodid'); 672 if (!sizeId || !prodId) return; 673 674 $.post('prod.php', { 675 ajaxCall: 1, 676 packsWithSameColor: 1, 677 prodid: prodId, 678 sizeid: sizeId 679 }, function (html) { 680 $('#js-packs-with-same-color').html(html); 681 682 var $s = $('#js-packs-with-same-color .prod_list_slider'); 683 684 if ($s.length) { 685 $s.slick({ 686 slidesToShow: 4, 687 slidesToScroll: 1, 688 arrows: true, 689 infinite: false, 690 responsive: [ 691 {breakpoint: 981, settings: {slidesToShow: 3}}, 692 {breakpoint: 801, settings: {slidesToShow: 2}} 693 ] 694 }); 695 } 696 }); 697 } 698 699 700 //reset quantity in prodpage to default values 701 $('#resetQtty').on('click', function (event) { 702 703 event.preventDefault(); 704 var inputs = $(".input_qty"); 705 706 for (var i = 0; i < inputs.length; i++) 707 { 708 defQtty = parseInt($(inputs[i]).attr("data-defaultQtty")); 709 $(inputs[i]).val(defQtty); 710 } 711 712 $('.addPrice').val(0); 713 var prodPackageQty = parseInt($('.js_prod_package_selectQty').find('option:selected').val()); 714 var oldPrice = parseInt($('.js_mainPriceHolder .priceValue').attr("data-price")); 715 var newPrice = parseInt(oldPrice*prodPackageQty); 716 var regularPoints = newPrice; 717 718 // members price 719 var oldMemberPrice = parseInt($('.js_mainPriceHolder .memberPriceValue').attr("data-memberPrice")); 720 var newMemberPrice = parseInt(oldMemberPrice*prodPackageQty); 721 722 if(!isNaN(newMemberPrice)) { 723 regularPoints = newMemberPrice; 724 } 725 726 var goldenPoints = regularPoints * 2; 727 728 $('.js_total_sum .priceValue').html(newPrice); 729 $('.js_mainPriceHolder .prod_price_box .priceValue').html(newPrice); 730 731 $('.js_mainPriceHolder .prod_price_info_box .priceValue').html(regularPoints); 732 $('.js_mainPriceHolder .prod_price_info_box .goldenPriceValue').html(goldenPoints); 733 734 // members price 735 $('.js_total_sum .memberPriceValue').html(newMemberPrice); 736 $('.js_mainPriceHolder .memberPriceValue').html(newMemberPrice); 737 }); 738 739 //reset names of subprods in prodpage to default values 740 $('#resetSizes').on('click', function (event) { 741 742 event.preventDefault(); 743 var imageTags = $(".colorPics"); 744 var colorNames = $(".colorNames"); 745 746 for (var i = 0; i < imageTags.length; i++) 747 { 748 defaultPic = $(imageTags[i]).attr("data-defaultsrc"); 749 if (defaultPic) 750 $(imageTags[i]).attr("src", defaultPic); 751 } 752 753 for (var i = 0; i < colorNames.length; i++) 754 { 755 colorName = $(colorNames[i]).attr("data-defaultname"); 756 if (colorName) 757 $(colorNames[i]).html(colorName); 758 } 759 760 $('.js_pack_color_value').each(function () { 761 var key = $(this).attr('data-propskey');//the key of subprod 762 var value = $(this).attr('data-default-value');//default size id 763 var maxQtty = $(this).attr('data-default-max');//default max qtty for size 764 765 $(this).val(value); 766 $('[data_index="' + key + '"]').val(value); 767 768 var $qty = $('[name="props_qtty\\[' + key + '\\]"]'); 769 if (maxQtty) { 770 $qty.attr('max', maxQtty); 771 } else { 772 $qty.removeAttr('max'); // the standard color has no limit (getIgnoreQtty) 773 } 774 775 if (parseInt(key, 10) === 0) { 776 refreshPacksWithSameColor(value); 777 } 778 }); 779 780 $('.changeSizeSubprod').removeClass('current'); 781 $('.changeSizeSubprod.defaultItem').addClass('current'); 782 });
783 784 /*PRODLIST PRODUCT FILTER */ 785 var prodlist = $('.static_prodlist'); 786 var products = $('.static_prodlist .prod_item'); 787 var filteredProducts; 788 var objFilters = {}; 789 790 function getCheckedFilters() { 791 var checkedFilters = $('.prodlist_filter .ch_box:checked'); 792 793 for (var i = 0; i < checkedFilters.length; i++) { 794 var val = $(checkedFilters[i]).val(); 795 var filterName = $(checkedFilters[i]).attr('name'); 796 797 if (!objFilters.hasOwnProperty(filterName)) { 798 objFilters[filterName] = []; 799 } 800 801 objFilters[filterName].push(val); 802 } 803 } 804 805 function productFiltering() { 806 $(filteredProducts).each(function () { 807 808 for (const property in objFilters) { 809 var filterName = property; 810 811 if ($(this).attr(filterName)) { 812 var attrVal = $(this).attr(filterName); 813 814 if (objFilters[property].includes(attrVal)) { 815 $(this).attr('isMatched', true); 816 } else { 817 $(this).removeAttr('isMatched', false); 818 break; 819 } 820 } 821 } 822 }); 823 824 filteredProducts = $(filteredProducts).filter(function () { 825 if ($(this).attr('isMatched')) { 826 return $(this); 827 } 828 }); 829 } 830 831 function showFilteredProducts() { 832 products.each(function () { 833 $(this).removeAttr('isMatched'); 834 }); 835 836 objFilters = {}; 837 filteredProducts = products; 838 839 getCheckedFilters(); 840 841 if (Object.keys(objFilters).length !== 0) { 842 productFiltering(); 843 } 844 845 $(prodlist).html(filteredProducts); 846 } 847 848 function resetFitlers() { 849 $('.btn_clear_filter').click(function () { 850 var checkedFilters = $(this).closest('.prodlist_filter').find('.ch_box:checked'); 851 852 if (checkedFilters.length !== 0) { 853 checkedFilters.each(function () { 854 $(this).prop('checked', false); 855 }); 856 } 857 858 showFilteredProducts(); 859 }); 860 } 861 862 $('.prodlist_filter .ch_box').change(function () { 863 showFilteredProducts(); 864 }); 865 866 resetFitlers(); 867 868 /* 869 var prodlist = $('.static_prodlist'); 870 var products = $('.static_prodlist .prod_item'); 871 var prodlistFilters = $('.prodlist_filter'); 872 var filteredProducts; 873 874 $('.prodlist_filter').change(function () { 875 filteredProducts = products; 876 877 for (var i = 0; i < prodlistFilters.length; i++) { 878 var val = $(prodlistFilters[i]).val(); 879 880 if (val) { 881 var filterName = $(prodlistFilters[i]).attr('name'); 882 883 filteredProducts = $(filteredProducts).filter(function () { 884 return $(this).attr(filterName) === val; 885 }); 886 } 887 } 888 889 $(prodlist).html(filteredProducts); 890 });*/ 891 892 //ACCORDION PROFILE ORDER ITEM 893 $('.order_item_title').click(function () { 894 $(this).parent('.order_item').addClass('open'); 895 $(this).next('.order_item_content').slideDown(); 896 }); 897 898 $('.order_item_content .head_part').click(function() { 899 $(this).closest('.order_item').removeClass('open'); 900 $(this).closest('.order_item_content').slideUp(); 901 }); 902 903 //OPEN PROFILE LEFT MENU 904 $('.js_btnOpen_profileMenu').click(function() { 905 $('.mobile_profile_leftMenu_box').addClass('active'); 906 $('.js_btnClose_profileLeftMenu').addClass('active'); 907 }); 908 909 $('.js_btnClose_profileLeftMenu').click(function() { 910 $('.mobile_profile_leftMenu_box').removeClass('active'); 911 $(this).removeClass('active'); 912 }); 913 914 //ACCORDION PRODUCT PAGE 915 $('.accordion_item .accordion_title').click(function () { 916 //$(this).parent('.accordion_item').prev().removeClass('open');
917 //$(this).parent('.accordion_item').prev().children('.accordion_content').slideUp(); 918 $(this).next('.accordion_content').slideToggle(); 919 $(this).parent('.accordion_item').toggleClass('open'); 920 921 }); 922 923 // PRODUCT POPUP SLIDER 924 $('.prod_related_sec .prod_list_slider').slick({ 925 slidesToShow: 4, 926 slidesToScroll: 1, 927 arrows: true, 928 infinite: false, 929 responsive: [ 930 { 931 breakpoint: 981, 932 settings: { 933 slidesToShow: 3 934 } 935 }, 936 { 937 breakpoint: 801, 938 settings: { 939 slidesToShow: 2 940 } 941 } 942 ] 943 }); 944 945 $('.popup_prod .prod_list_slider').slick({ 946 slidesToShow: 3, 947 slidesToScroll: 1, 948 arrows: true, 949 infinite: false, 950 responsive: [ 951 { 952 breakpoint: 700, 953 settings: { 954 slidesToShow: 2 955 } 956 }, 957 { 958 breakpoint: 480, 959 settings: { 960 slidesToShow: 1 961 } 962 } 963 ] 964 }); 965 966 // PRODUCT IMAGE SLIDER 967 var slidesCount = $('.product_slider_nav .slider_item').length; 968 969 $('.product_slider_for').slick({ 970 slidesToShow: 1, 971 slidesToScroll: 1, 972 arrows: false, 973 fade: true, 974 infinite: false, 975 asNavFor: '.product_slider_nav', 976 }); 977 978 $('.product_slider_nav').slick({ 979 slidesToShow: 4, 980 slidesToScroll: 1, 981 asNavFor: '.product_slider_for', 982 arrows: false, 983 focusOnSelect: true, 984 infinite: false, 985 responsive: [ 986 { 987 breakpoint: 980, 988 settings: { 989 slidesToShow: 3 990 } 991 }, 992 { 993 breakpoint: 801, 994 settings: { 995 slidesToShow: 1, 996 autoplay: true, 997 autoplaySpeed: 4000, 998 infinite: true, 999 dots: true, 1000 arrows: false, 1001 } 1002 } 1003 ] 1004 }); 1005 1006 if(slidesCount <= $('.product_slider_nav').slick('slickGetOption', 'slidesToShow')) { 1007 $('.product_slider_nav .slick-track').addClass('noDraggable') 1008 } 1009 1010 $('.product_slider_nav_box .slick-next').on('click', function () { 1011 $('.product_slider_for').slick('slickNext'); 1012 }); 1013 1014 $('.product_slider_nav_box .slick-prev ').on('click', function () { 1015 $('.product_slider_for').slick('slickPrev'); 1016 }); 1017 1018 // Fires after a breakpoint is hit 1019 $('.product_slider_nav').on('breakpoint', function () { 1020 if (slidesCount <= $('.product_slider_nav').slick('slickGetOption', 'slidesToShow')) { 1021 $('.product_slider_nav .slick-track').addClass('noDraggable') 1022 } 1023 }); 1024 1025 // PROFILE BANNER SLIDER 1026 $('.profile_banner_slider').slick({ 1027 slidesToShow: 1, 1028 slidesToScroll: 1, 1029 autoplay: true, 1030 autoplaySpeed: 5000, 1031 arrows: false, 1032 dots: true 1033 }); 1034 1035 // Click handler for images with data-href 1036 $(document).on('click', '.js-profile-banners img[data-href]', function () { 1037 window.location.href = $(this).data('href'); 1038 }); 1039 1040 // Keyboard accessibility 1041 $(document).on('keydown', '.js-profile-banners img[data-href]', function (e) { 1042 if (e.key === 'Enter' || e.key === ' ') { 1043 e.preventDefault(); 1044 window.location.href = $(this).data('href'); 1045 } 1046 }); 1047 1048 1049 /* SHOW MOBILE SEARCH - HEADER AND BOTTOM TOOLBAR */ 1050 const bottomSearchForm = $('.bottom_toolbar form'); 1051 1052 $('.bottom_toolbar .btn_show_search').on('click', function () { 1053 const cookieWidget = $('#CookiebotWidget'); 1054 1055 if (bottomSearchForm.hasClass('active')) { 1056 bottomSearchForm.removeClass('active');
1057 cookieWidget.removeClass('invisible'); 1058 } else { 1059 bottomSearchForm.addClass('active'); 1060 cookieWidget.addClass('invisible'); 1061 } 1062 }); 1063 1064 1065 /* PRODUCT PAGE - SHOW MORE COLORS */ 1066 /*$('.btn_show_more_colors').click(function() { 1067 $('.colors_list.short .colors_box').addClass('active'); 1068 $(this).hide(); 1069 });*/ 1070 1071 $('.prod_form .btn_show_colors_list').click(function() { 1072 $(this).closest('.prod_options_holder').find('.colors_list').fadeToggle(); 1073 $(this).toggleClass('active'); 1074 }); 1075 1076 /* PRODUCT PAGE RECOMMENDED ACCESSORIES*/ 1077 $('.recommended_accessories_select .ch_box').change(function() { 1078 /*var selectedItems = $('.recommended_accessories_select').find(".ch_box:checked").length; 1079 $('.recommended_accessory_name .val').text(selectedItems );*/ 1080 1081 var currentEl = $('.recommended_accessories_select .ch_box:checked:last').closest('.ch_box_lbl').html(); 1082 1083 if(currentEl) { 1084 $('.recommended_accessory_name').html(currentEl); 1085 }else { 1086 $('.recommended_accessory_name').html(''); 1087 } 1088 }); 1089 1090 /* PRODUCT PAGE GET BATCH NUMBER */ 1091 function getVatchNumber() { 1092 var selectedVal = $('.js_select_batch').find(":selected").val(); 1093 $('.js_batch_number').text(selectedVal); 1094 } 1095 1096 getVatchNumber(); 1097 1098 $('.js_select_batch').change(function() { 1099 getVatchNumber(); 1100 }); 1101 1102 //SHOW DISCOUNT FIELDS IN CART 1103 $('.btn_show_discount_fields').click(function() { 1104 $(this).toggleClass('active'); 1105 $('.discount_fields_box').slideToggle(); 1106 }); 1107 1108 //CART SCROLL TO PAYMENT 1109 $('.cart_btn_to_payment').click(function() { 1110 var elementTop = $('.cart_payment_box').offset().top; 1111 $('.cart_payment').show(); 1112 1113 $('body, html').animate({ 1114 scrollTop: elementTop - 50 1115 }, 1200); 1116 }); 1117 1118 //PRODUCT PDF CHECKBOX 1119 $('.prod_pdf_ch_box').change(function() { 1120 if ($(this).is(':checked')) { 1121 $('.input_hidden_pdf').val('paper'); 1122 }else { 1123 $('.input_hidden_pdf').val('download') 1124 } 1125 }) 1126 1127 //FOOTER SHOW MENU ON MOBILE 1128 $('.footer_title').click(function() { 1129 $(this).toggleClass('active'); 1130 $(this).next('.footer_menu').toggleClass('active'); 1131 }) 1132 1133 //CALC BANNER TITLE FONT SIZE 1134 /*function calcFontSize(bannerInfoHolder) { 1135 //CALC BANNER TITLE 1136 var title = $(bannerInfoHolder).find(".js_banner_title") 1137 var titleWidth = $(title).width(); 1138 1139 var titleTxt = $(title).find('.js_banner_title_txt'); 1140 var titleTxtWidth = $(titleTxt).width(); 1141 1142 var titleFontSize = titleWidth * 0.10; // 10% of container width 1143 $(title).css('font-size', titleFontSize); 1144 $(title).css('line-height', titleFontSize + 10 + 'px'); 1145 1146 //CALC BANNER SUBTITLE 1147 var subTitle = $(bannerInfoHolder).find(".js_banner_sub_title"); 1148 var subTitleWidth = $(subTitle).width(); 1149 1150 var subTitleTxt = $(subTitle).find(".js_banner_sub_title_txt"); 1151 var subTitleTxtWidth = $(subTitleTxt).width(); 1152 1153 var subTitleFontSize = subTitleWidth * 0.10; // 10% of container width 1154 $(subTitle).css('font-size', subTitleFontSize); 1155 $(subTitle).css('line-height', subTitleFontSize + 10 + 'px'); 1156 } 1157 1158 $('.banner_info_holder').each(function () { 1159 calcFontSize(this); 1160 }); 1161 1162 $(window).resize(function(){ 1163 $('.banner_info_holder').each(function () { 1164 calcFontSize(this); 1165 console.log(this) 1166 }); 1167 });*/ 1168 1169 function calcFontSize(bannerInfoHolder) { 1170 //CALC BANNER TITLE 1171 var title = $(bannerInfoHolder).find(".js_banner_title"); 1172 $(title).removeAttr('style'); 1173 1174 var titleWidth = $(title).width(); 1175 var titleTxt = $(title).find('.js_banner_title_txt'); 1176 var titleTxtWidth = $(titleTxt).width(); 1177 1178 var titleFontSize = parseInt($(title).attr("data-font-size")); 1179 var titleCurrentFontSize = parseInt($(title).css("font-size")); 1180 var titleNewFontSize = parseInt(titleCurrentFontSize * (titleWidth / titleTxtWidth)); 1181 1182 if(titleFontSize > titleNewFontSize) { 1183 $(title).css('font-size', titleNewFontSize); 1184 $(title).css('line-height', titleNewFontSize + 10 + 'px'); 1185 } 1186 1187 //CALC BANNER SUBTITLE 1188 var subTitle = $(bannerInfoHolder).find(".js_banner_sub_title"); 1189 $(subTitle).removeAttr('style'); 1190 1191 var subTitleWidth = $(subTitle).width(); 1192 var subTitleTxt = $(subTitle).find(".js_banner_sub_title_txt"); 1193 var subTitleTxtWidth = $(subTitleTxt).width(); 1194 1195 var subTitleFontSize = parseInt($(subTitle).attr("data-font-size")); 1196 var subTitleCurrentFontSize = parseInt($(subTitle).css("font-size")); 1197 var subTitleNewFontSize = parseInt(subTitleCurrentFontSize * (subTitleWidth / subTitleTxtWidth)); 1198 1199 if(subTitleFontSize > subTitleNewFontSize) { 1200 $(subTitle).css('font-size', subTitleNewFontSize); 1201 $(subTitle).css('line-height', subTitleNewFontSize + 10 + 'px'); 1202 } 1203 } 1204 1205 $('.banner_info_holder').each(function () { 1206 calcFontSize(this); 1207 });
1208 1209 $(window).on( "resize", function() { 1210 clearTimeout(resizeTimeout); 1211 1212 var resizeTimeout = setTimeout(function(){ 1213 $('.banner_info_holder').each(function () { 1214 calcFontSize(this); 1215 }); 1216 }, 10); 1217 }); 1218 1219 // SHOW SUPERDEAL INFO 1220 $(document).on('click', '.btn_show_superdeal_info', function(event){ 1221 event.preventDefault(); 1222 $(this).parent().find('.superdeal_info').addClass('active'); 1223 }); 1224 1225 $(document).on('click', '.superdeal_info', function(event){ 1226 event.preventDefault(); 1227 }); 1228 1229 $(document).on('click', '.superdeal_info .btn_close', function(event){ 1230 event.preventDefault(); 1231 $(this).parent().removeClass('active'); 1232 }); 1233 1234 // SHOW DELIVERY DESTINATIONS IN CART 1235 $('.js_delivery_ch_box').each(function () { 1236 if ($(this).is(':checked')) { 1237 var deliveryID = $(this).attr('id'); 1238 $('.cart_delivery_select' + '#' + deliveryID).show(); 1239 } 1240 }); 1241});
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.