1/* 2 * To change this license header, choose License Headers in Project Properties. 3 * To change this template file, choose Tools | Templates 4 * and open the template in the editor. 5 */ 6//HEADER 7(function () { 8 let mobileMenu = document.querySelector(".js-mobile-menu"); 9 function hideScroll() { 10 document.body.style.paddingRight = `${window.innerWidth - document.documentElement.clientWidth}px` 11 document.body.style.overflow = "hidden"; 12 } 13 14 function showScroll() { 15 document.body.style.paddingRight = `0px` 16 document.body.style.overflow = "initial"; 17 } 18 19 function showMenu() { 20 mobileMenu.classList.add("js-mobile-menu_active"); 21 } 22 23 function hideMenu() { 24 mobileMenu.classList.remove("js-mobile-menu_active"); 25 } 26 27 document.querySelectorAll('.js-open-mobile-menu').forEach(button => { 28 button.addEventListener('click', (e) => { 29 hideScroll(); 30 showMenu(); 31 }) 32 }); 33 34 document.querySelectorAll('.js-close-mobile-menu').forEach(button => { 35 button.addEventListener('click', (e) => { 36 showScroll(); 37 hideMenu(); 38 }) 39 }); 40})(); 41 42function dropDownMagager(groups) { 43 let dropDownGroups = {}; 44 45 for (const group in groups) { 46 if (!groups.hasOwnProperty(group)) 47 continue; 48 49 let groupOption = groups[group]; 50 51 dropDownGroups[group] = { 52 dropDowns: Array.from(document.querySelectorAll(`.js-dropdown[data-dd-group=${group}]`)), 53 only: ((groupOption.only === null || groupOption.only === undefined) ? true : groupOption.only), 54 backClose: ((groupOption.backClose === null || groupOption.backClose === undefined) ? true : groupOption.backClose), 55 } 56 } 57 58 document.addEventListener("click", (e) => { 59 let target = e.target; 60 61 if (target.closest(".js-dropdown__button")) { 62 let dropDown = target.closest(".js-dropdown"); 63 let groupName = dropDown.dataset.ddGroup; 64 65 if (dropDownGroups[groupName].only) 66 closeGroup(dropDownGroups[groupName], dropDown); 67 68 toggleCurrentDropDown(dropDown); 69 } else if (!target.closest(".js-dropdown")) { 70 closeAll(); 71 } 72 }) 73 74 function toggleCurrentDropDown(currentDropDown) { 75 let dropContent = currentDropDown.querySelector(".js-dropdown__content"); 76 if (currentDropDown.classList.toggle('js-dropdown_active')) { 77 dropContent.style.display = "block"; 78 79 } else { 80 dropContent.style.display = "none"; 81 } 82 } 83 84 function closeGroup(group, currentDropDown) { 85 for (const dropDown of group.dropDowns) { 86 if (dropDown == currentDropDown) 87 continue; 88 dropDown.classList.remove("js-dropdown_active"); 89 dropDown.querySelector(".js-dropdown__content").style.display = "none"; 90 } 91 } 92 93 function closeAll() { 94 for (const groupName in dropDownGroups) { 95 if (!dropDownGroups.hasOwnProperty(groupName)) 96 continue; 97 98 let group = dropDownGroups[groupName]; 99 100 if (!group.backClose) 101 continue; 102 103 closeGroup(group, null); 104 } 105 } 106} 107; 108 109dropDownMagager({ 110 kvmMobileMenu: { 111 only: false, 112 backClose: false, 113 }, 114 kvmMobileContacts: { 115 only: false, 116 backClose: true, 117 }, 118}); 119 120function menuFixed() { 121 const header = document.querySelector('header'), 122 mainMenu = document.getElementById('main-menu'), 123 mainMenuHolder = document.createElement('div'), 124 menuHolderClassList = 'menu-placeholder hidden'.split(' ') 125 126 mainMenuHolder.classList.add(...menuHolderClassList); 127 128 if (mainMenu) { 129 mainMenuHolder.style.height = mainMenu.offsetHeight + 'px' 130 } 131 132 if (mainMenuHolder.length) { 133 mainMenu.after(mainMenuHolder); 134 } 135 136 if (mainMenu && mainMenuHolder && header) { 137 if (mainMenu.offsetTop <= window.pageYOffset && header.getBoundingClientRect().bottom + mainMenuHolder.offsetHeight <= window.pageYOffset) { 138 mainMenu.classList.add('fixed') 139 mainMenuHolder.classList.remove('hidden') 140 } else { 141 mainMenu.classList.remove('fixed') 142 mainMenuHolder.classList.add('hidden') 143 } 144 } 145} 146 147document.addEventListener('DOMContentLoaded', () => { 148 149 menuFixed() 150 151 window.addEventListener('scroll', () => { 152 menuFixed() 153 }) 154}); 155 156//HEADER END 157/** 158 **************************************** 159 * РабоÑа Ñ ÐºÐ¾Ñзиной 160 * Basket 161 **************************************** 162 */ 163$(document).ready(function () { 164 $('a.buy-now').attr('rel', 'nofollow').wrapInner('<noindex></noindex>'); 165 166 var fancy_title = '' 167 168 $(document).on('click', '.ajax-fancybox', function (e) { 169 e.preventDefault(); 170 171 var link = $(this); 172 173 fancy_title = $(this).attr('title'); 174 175 $.ajax({ 176 type: 'POST', 177 url: link.attr('href'), 178 headers: { 179 'X-fancyBox': true 180 }, 181 success: function (data) { 182 $.fancybox(data, { 183 'title': fancy_title, 184 'helpers': { 185 title: { 186 type: 'inside', 187 position: 'top' 188 } 189 } 190 }); 191 } 192 }); 193 }); 194 195 $('.fancybox').fancybox({ 196 autoScale: false, 197 autoResize: false, 198 autoHeight: false, 199 autoWidth: false, 200 autoSize: false, 201 }); 202 203 /*! 204 * ÐакÑÑваем fancybox по ÐºÐ»Ð¸ÐºÑ Ð½Ð° ÐºÐ½Ð¾Ð¿ÐºÑ 205 */ 206 $(document).on('click', '.fancybox-close-link', function (e) { 207 e.preventDefault(); 208 $.fancybox.close(); 209 }); 210 211 $(document).on('submit', '.fancybox-form', function (e) { 212 e.preventDefault(); 213 var fancybox_form = $(this); 214 var callback_name = fancybox_form.attr('data-success-callback'); 215 var callback_close_name = fancybox_form.attr('data-close-callback'); 216 217 $.ajax({ 218 type: fancybox_form.attr('method'), 219 url: fancybox_form.attr('action'), 220 data: fancybox_form.serializeArray(), 221 headers: { 222 'X-fancyBox': true 223 }, 224 success: function (data) { 225 226 $.fancybox(data, { 227 padding: 25, 228 afterClose: function () { 229 if (callback_close_name) 230 { 231 self[callback_close_name](data); 232 } 233 } 234 }); 235 }, 236 complete: function () { 237 if (callback_name) 238 { 239 self[callback_name](); 240 } 241 } 242 }); 243 }); 244 245 246 247 // ÐÑплÑваÑÑие подÑказки 248 if ($("[rel=tooltip]").length > 0) 249 { 250 $("[rel=tooltip], [data-tooltip=tooltip]").tooltip({ 251 'placement': 'bottom' 252 }); 253 } 254 255 // СвеÑнÑÑÑ ÑазвеÑнÑÑÑ 256 $('.slide_toggle').on('click', function (e) 257 { 258 e.preventDefault(); 259 var $this = $(this); 260 var $div = $this.closest('h3').next('.show_hide'); 261 262 if ($this.attr('data-target') && $div.length < 1) 263 { 264 $div = $($this.attr('data-target')); 265 } 266 267 if ($div.length > 0) 268 { 269 $div.slideToggle('slow'); 270 271 var $span = $this.prev('span'); 272 273 if ($span.length > 0) 274 { 275 var data_text = $span.attr('data-text'); 276 var text = $span.text(); 277 $span.attr('data-text', text); 278 $span.text(data_text); 279 } 280 } 281 }); 282 283 /**
284 * Ðобавление ÑоваÑа в коÑÐ·Ð¸Ð½Ñ 285 */ 286 $(document).on('click', 'input.basket_mini', function (e) { 287 e.preventDefault(); 288 add_to_basket($(this).closest('.goods_item')); 289 }); 290 291 $(document).on('click', 'a.comparison_to_basket', function (e) { 292 e.preventDefault(); 293 294 add_to_basket($('#goods_' + $(this).attr('data-item'))); 295 }); 296 297 $(document).on('click', 'a.basket_micro', function (e) { 298 e.preventDefault(); 299 300 add_to_basket($(this).closest('.goods_item')); 301 }); 302 303 /** 304 * Удаление ÑоваÑа из коÑÐ·Ð¸Ð½Ñ 305 */ 306 $(document).on('click', 'a.delete_good', function (e) { //ÑдалÑÐµÑ 1 ÑÐ¾Ð²Ð°Ñ Ð¸Ð· коÑÐ·Ð¸Ð½Ñ 307 e.preventDefault(); 308 309 delete_in_basket($(this).closest('.goods_item')); 310 311 }); 312 313 314 /** 315 * ÐÑи ÑаÑкÑÑÑии подÑобноÑÑей заказа в иÑÑоÑии заказов 316 */ 317 $(document).on('click', '.show_order_details', function () { 318 var id = $(this).attr('data-id'); 319 $('#' + id).fadeToggle(); 320 }); 321 322 if (window.location.search !== '') 323 markKeywords(); 324 325 326 /** 327 * TODO 328 */ 329 $('.comparison.basket input.count.numbers').focusout(function () { 330 var id = $(this).attr('my_id'); 331 var quantity = $(this).val(); 332 var price = $(this).parent().parent().next().html(); 333 $.ajax({ 334 url: root_path + 'basket/?action=update', 335 type: 'POST', 336 dataType: 'json', 337 data: ({ 338 'quantity': quantity, 339 'id': id, 340 'price': price 341 }), 342 success: function (result) 343 { 344 $('.all_price_' + id).html(result['price_good'] + ' Ñ.'); 345 $('.price.only span b').html(result['goods_all_cost']); 346 }, 347 error: function (result) { 348 ;// 349 } 350 }); 351 update_basket_in_top(); 352 $('.price.only b').html($('#hidden_price').html()); 353 }); 354 355 /** 356 * УвелиÑение и ÑменÑÑение колиÑеÑÑва ÑоваÑа пÑи нажаÑии на + или - 357 */ 358 $(document).on('click', '.qty-minus, .qty-plus', function (e) { 359 e.preventDefault(); 360 361 var input = $(this).parent().find('input'); 362 var count = parseInt(input.val()); 363 if ($(this).hasClass('qty-plus')) 364 { 365 count++; 366 } else 367 { 368 count--; 369 } 370 if (count < 1 || count > 99) { 371 count = 1; 372 return false; 373 } 374 375 input.val(count); 376 var data = {modification: input.attr('data-modification'), size: input.attr('data-size'), quantity: count}; 377 378 $.post(root_path + 'basket/?action=update', data, function (resp) { 379 $('.section_padding_100 .col-12 .cart-table').html(resp); 380 update_basket_in_top(); 381 }) 382 383 }); 384 385 /** 386 * ÐÑпа в каÑÑоÑке ÑоваÑов 387 */ 388 $(".zoom-image").elevateZoom(); 389 390 391 /** 392 * ÐапÑеÑÐ°ÐµÑ Ð²Ð²Ð¾Ð´Ð¸ÑÑ ÑÑо-либо кÑоме ÑиÑÑ Ð² инпÑÑ Ñ ÐºÐ¾Ð»Ð¸ÑеÑÑвом 393 */ 394 $(document).on('keypress', 'input.basket-quantity', function (e) { 395 396 if ($(this).val() == 0 || $(this).val() == '') 397 { 398 if (!(e.which > 48 && e.which < 58)) 399 { 400 $(this).val(1); 401 return false; 402 } 403 } 404 if (!(e.which > 47 && e.which < 58 || e.which == 8 || e.which == 0)) 405 { 406 return false; 407 } 408 }); 409 410 /** 411 * Ðзменение колиÑеÑÑва ÑоваÑа в коÑзине 412 */ 413 $(document).on('change', 'input.basket-quantity', function (e) { 414 e.preventDefault(); 415 416 basket_update($(this).closest('span.qty-input')); 417 }); 418 419 /** 420 * УвелиÑение/ÑменÑÑение колиÑеÑÑва ÑоваÑов пеÑед добавлением в коÑÐ·Ð¸Ð½Ñ 421 */ 422 $(document).on('click', '.increment, .decrement', function (e) { 423 e.preventDefault(); 424 425 var qty_input = $(this).closest('div.qty-inputs'); 426 427 var input = qty_input.find('input.basket-quantity'); 428 var value = input.val(); 429 var limit = parseInt(input.attr('limit')); 430
431 if ($(this).attr('class') === 'increment') { 432 if (limit > 0 && value >= limit) { 433 $('#goodsLimitAlert').modal('show'); 434 } else { 435 value++; 436 } 437 } else if ($(this).attr('class') === 'decrement') { 438 value--; 439 if (value < 1) { 440 value = 1; 441 } 442 } 443 input.val(value); 444 basket_update(qty_input); 445 result_cost_update($(this).closest('div.add_to_basket')); 446 }); 447 448 /** 449 * УвелиÑение/ÑменÑÑение колиÑеÑÑва меÑÑов (иÑполÑзÑеÑÑÑ Ð¿Ñи пÑодаже пленки на оÑÑез) 450 */ 451 $(document).on('click', '.meter_increment, .meter_decrement', function (e) { 452 e.preventDefault(); 453 454 var qty_input = $(this).closest('span.qty-input'); 455 456 var input = qty_input.find('input.basket-quantity'); 457 var value = parseInt(input.val()); 458 459 var limit = parseFloat(input.attr('limit')); 460 var centimeter_value = parseInt($(this).closest('div.add_meter_to_basket,div.edit_meter_to_basket').find('input[name=centimeter_quantity]').val()); 461 var centimeter_limit = fract(limit) * 10; 462 463 464 if ($(this).attr('class') === 'meter_increment') { 465 if (limit > 0 && ((limit < (value + 1)) || ((limit < (value + 2)) && (centimeter_value > centimeter_limit)))) { 466 $('#goodsLimitAlert').modal('show'); 467 } else { 468 value++; 469 } 470 } else if ($(this).attr('class') === 'meter_decrement') { 471 value--; 472 if (value < 0) { 473 value = 0; 474 } 475 } 476 input.val(value); 477 basket_meter_update(qty_input); 478 result_meter_cost_update($(this).closest('div.add_to_basket')); 479 }); 480 481 /** 482 * УвелиÑение/ÑменÑÑение колиÑеÑÑва ÑанÑимеÑÑов (иÑполÑзÑеÑÑÑ Ð¿Ñи пÑодаже пленки на оÑÑез) 483 */ 484 $(document).on('click', '.centimeter_increment, .centimeter_decrement', function (e) { 485 e.preventDefault(); 486 487 var qty_input = $(this).closest('span.qty-input'); 488 489 var input = qty_input.find('input.basket-quantity'); 490 var value = parseInt(input.val()); 491 492 var limit = parseFloat(input.attr('limit')); 493 var meter_value = parseInt($(this).closest('div.add_meter_to_basket,div.edit_meter_to_basket').find('input[name=meter_quantity]').val()); 494 var centimeter_limit = fract(limit) * 10; 495 496 if ($(this).attr('class') === 'centimeter_increment') { 497 if (limit > 0 && limit < (meter_value + 1) && centimeter_limit < (value + 10)) { 498 $('#goodsLimitAlert').modal('show'); 499 } else { 500 value += 10; 501 if (value > 90) { 502 value = 90; 503 } 504 } 505 } else if ($(this).attr('class') === 'centimeter_decrement') { 506 value -= 10; 507 if (value < 0) { 508 value = 0; 509 } 510 } 511 input.val(value); 512 basket_meter_update(qty_input); 513 result_meter_cost_update($(this).closest('div.add_to_basket')); 514 }); 515 516 /** 517 * Удаление ÑоваÑа из коÑÐ·Ð¸Ð½Ñ 518 */ 519 $(document).on('click', 'a.delete', function (e) { 520 e.preventDefault(); 521 var goods_id = $(this).attr('data-id'); 522 var price_type = $(this).attr('price_type'); 523 524 $.ajax({ 525 url: root_path + 'basket/?action=delete', 526 type: 'post', 527 data: { 528 'goods_id': goods_id, 529 'price_type': price_type 530 }, 531 success: function (html) { 532 $('#basket-insert').html(html); 533 } 534 }); 535 update_head_basket(); 536 }); 537 538 /** 539 * ÐоказÑÐ²Ð°ÐµÑ Ð¿ÑимеÑÐ°Ð½Ð¸Ñ Ðº полÑм (еÑли вÑбÑаÑÑ ÑÐ°Ð´Ð¸Ð¾ÐºÐ½Ð¾Ð¿ÐºÑ ÑамовÑвоз, напÑимеÑ) 540 */ 541 $('.form-group div.note').hide(); 542 543 $(document).on('change', 'input[type="radio"]', function (e) { 544 e.preventDefault();
545 $(this).closest('.form-group').find('div.note').hide(); 546 $(this).closest('label').find('div.note').show(); 547 }); 548 549 $('.radio-block label div.note').hide(); 550 551 if ($('.radio-block input:checked').length > 0) 552 { 553 $('.radio-block input:checked').each(function () { 554 $(this).closest('label').find('div.note').show() 555 }); 556 } 557 558 if ($('input[name="delivery"]:checked').length > 0) 559 { 560 var payment_variants = $('input[name="delivery"]:checked').attr('data-payment').split(','); 561 } 562 563 /* 564 * ÐÑли ÑпоÑоб доÑÑавки не Ñказан - ÑнаÑала вÑводим пÑÑÑой ÑпиÑок 565 */ 566 if ($('input[name="delivery"]:checked').length == 0) 567 { 568 $('select[name="pay_method"] option').each(function () { 569 $(this).hide(); 570 }); 571 572 $('select[name="pay_method"]').attr('title', 'СнаÑала вÑбеÑиÑе ÑпоÑоб доÑÑавки') 573 } else { 574 /* 575 * ÐоказÑваем ÑпоÑÐ¾Ð±Ñ Ð¾Ð¿Ð»Ð°ÑÑ Ð² завиÑимоÑÑи Ð¾Ñ Ð²ÑбÑанного ÑпоÑоба 576 * доÑÑавки 577 */ 578 579 $('select[name="pay_method"] option').hide(); 580 581 $('select[name="pay_method"] option').each(function () { 582 583 if ($.inArray($(this).attr('data-payment'), payment_variants) > -1) 584 { 585 $(this).show(); 586 } 587 }); 588 } 589 590 $(document).on('change', '.radio-block input[type="radio"]', function (e) { 591 592 //$('.payment-variants').hide(); 593 594 /* 595 * СкÑÑваем или показÑваем ÑекÑÑовÑÑ Ð¾Ð±Ð»Ð°ÑÑÑ "ÐдÑеÑ" в завиÑимоÑÑи Ð¾Ñ 596 * вÑбÑанного ÑпоÑоба доÑÑавки 597 */ 598 if ($('input[value="moscow_pickup"]').prop('checked') == true || 599 $('input[value="pickup"]').prop('checked') == true || 600 $('input[value="pickup_liza"]').prop('checked') == true) 601 { 602 $('#address').hide(); 603 $('#address').find('textarea').html('СамовÑвоз'); 604 } else { 605 $('#address').fadeIn(); 606 $('#address').find('textarea').html(''); 607 } 608 609 if ($('input[value="transport_company_business_line"]').prop('checked') == true || 610 $('input[value="transport_company_pec"]').prop('checked') == true || 611 $('input[value="transport_company_dpd"]').prop('checked') == true) 612 { 613 $('#dop_fields').fadeIn(); 614 } else { 615 $('#dop_fields').hide(); 616 } 617 618 619 $('#payment').fadeIn(); 620 621 /* 622 * ÐоказÑваем ÑпоÑÐ¾Ð±Ñ Ð¾Ð¿Ð»Ð°ÑÑ Ð² завиÑимоÑÑи Ð¾Ñ Ð²ÑбÑанного ÑпоÑоба 623 * доÑÑавки 624 */ 625 var payment_variants = $(this).attr('data-payment').split(','); 626 627 $('select[name="pay_method"] option.empty_pay_method').attr('selected', 'selected'); 628 $('select[name="pay_method"] option').hide(); 629 630 $('select[name="pay_method"] option').each(function () { 631 632 if ($.inArray($(this).attr('data-payment'), payment_variants) > -1) 633 { 634 $(this).show(); 635 } 636 }); 637 638 /* 639 * ÐобавлÑем ÑÑоимоÑÑ Ð¾Ð¿Ð»Ð°ÑÑ Ðº иÑоговой ÑÑоимоÑÑи заказа 640 */ 641 var delivery_price = Number($(this).closest('label').find('.delivery-price').html()); 642 $('#delivery_price').parent('span').show(); 643 $('#delivery_price').html(delivery_price); 644 $('#result_price').html(Number($('#order_price').html()) + delivery_price); 645 646 }) 647 648 /* 649 * ÐÑли пÑи загÑÑзке ÑÑÑаниÑÑ Ð²ÑбÑан ÑамовÑвоз - ÑкÑÑваем ÑекÑÑовÑÑ Ð¾Ð±Ð»Ð°ÑÑÑ 650 * адÑÐµÑ 651 */ 652 if ($('input[value="self"]').prop('checked') == true) 653 { 654 $('#address').hide(); 655 } 656 657 /* 658 * ÐÑÐµÐ»Ð¾Ð°Ð´ÐµÑ Ð¿ÐµÑед ÑедиÑекÑом на ÑÐ½Ð´ÐµÐºÑ ÐºÐ°ÑÑÑ 659 */ 660 if ($('.yapay-form').length > 0) 661 { 662 $('body').append('<div class="block-display"></div>'); 663 $('.yapay-form').submit(); 664 } 665 666 if ($('.pay_sberbank').length > 0) 667 { 668 //$('body').append('<div class="block-display"></div>'); 669 //document.location.href = 'http://kvm-ko.ru/sberbank-payment/'; 670 } 671 672 $(document).on('change', 'input[name="email"]', function () { 673 $('#payinfo b').html($(this).val()); 674 }); 675 676 $(document).on('change', 'select[name="pay_method"]', function () { 677 $('#payinfo').html($(this).find('option:selected').attr('data-payinfo')); 678 $('#payinfo').show(); 679 680 $('#additional_info').fadeIn(); 681 $('#confirm_order').fadeIn(); 682 683 684 $('#payinfo b').html($('input[name="email"]').val()); 685 }); 686 687 $(document).on('click', '.radio-label', function () { 688 689 $('.radio-label').each(function () { 690 $(this).removeClass('selected'); 691 }); 692 $(this).addClass('selected') 693 }); 694 695 /** 696 * ÐÑи ÑкÑолле мÑÑÑÑ Ð²Ð½Ð¸Ð· - анимаÑÐ¸Ñ Ð½Ð° иконки воÑÑапа 697 */ 698 var lastScrollTop = 0; 699 var animation_complete = true; 700 var animation_complete2 = true; 701 702 $(window).scroll(function (event) { 703 if (animation_complete && animation_complete2) { 704 animation_complete = false;
705 animation_complete2 = false; 706 707 var st = $(this).scrollTop(); 708 if (st > lastScrollTop) { 709 // downscroll code 710 711 $('#whatsapp_fixed').animate({bottom: "5%"}, 500, function () { 712 animation_complete = true; 713 $('#whatsapp_fixed').animate({bottom: "20%"}, 500, function () { 714 animation_complete2 = true; 715 }); 716 }); 717 } else { 718 //upscroll code 719 720 $('#whatsapp_fixed').animate({bottom: "40%"}, 500, function () { 721 animation_complete = true; 722 $('#whatsapp_fixed').animate({bottom: "20%"}, 500, function () { 723 animation_complete2 = true; 724 }); 725 }); 726 } 727 728 lastScrollTop = st; 729 } 730 }); 731 732 /** 733 * ÐнимаÑÐ¸Ñ Ð½Ð° иконке воÑÑапа в адапÑиве беÑконеÑÐ½Ð°Ñ 734 */ 735 function whatsapp_adaptive_animate() { 736 $('#whatsapp_mobile_header div.product_image').animate({'margin-left': '20px'}, 500, function () { 737 $('#whatsapp_mobile_header div.product_image').animate({'margin-left': '0px'}, 500, function () { 738 whatsapp_adaptive_animate(); 739 }); 740 }); 741 } 742 whatsapp_adaptive_animate(); 743 744}); 745 746 747 748 749/** 750 * Ðобавление ÑоваÑа в коÑÐ·Ð¸Ð½Ñ 751 */ 752function add_to_basket(goods) 753{ 754 var id = goods.attr('data-id'); 755 var color = goods.find("input[name='color']:checked").val(); 756 var size = goods.find("select[name='size']").val(); 757 var modification; 758 759 if (!color) { 760 goods.find('.select_color_label').show(); 761 } else { 762 goods.find('.select_color_label').hide(); 763 } 764 765 if (!size) { 766 goods.find('.size_color_label').show(); 767 } else { 768 goods.find('.size_color_label').hide(); 769 } 770 771 if (id && id > 0 && color && size) 772 { 773 fly_to_basket(goods); 774 775 // обновление даннÑÑ ÐºÐ¾ÑÐ·Ð¸Ð½Ñ 776 var $input = $('#qty'); 777 var $quantity = ($input.length > 0 && $input.val() > 0) ? $input.val() : 1; 778 779 // ÑÐ¾Ñ Ñанение изменений на ÑеÑвеÑе 780 $.ajax({ 781 url: root_path + 'basket/?action=create', 782 type: 'POST', 783 async: false, 784 data: ({'quantity': $quantity, 'id': id, 'color': color, 'size': size}), 785 success: function () 786 { 787 goods.find('.add_to_basket_label').fadeOut(function () { 788 goods.find('.add_to_basket_label').fadeIn(); 789 }); 790 update_basket_in_top(); 791 } 792 }); 793 794 $('.add_to_basket').hide(); 795 $('.add__' + id).show(50); 796 } 797 return false; 798} 799 800/** 801 * Удаление ÑоваÑа из коÑÐ·Ð¸Ð½Ñ 802 */ 803function delete_in_basket(goods) { 804 var modification = goods.attr('data-modification'); 805 var size = goods.attr('data-size'); 806 807 $.get(root_path + 'basket/?action=delete&modification=' + modification + '&size=' + size, function (resp) { 808 $('.section_padding_100 .col-12 .cart-table').html(resp); 809 update_basket_in_top(); 810 }); 811} 812/** 813 * ÐнимаÑÐ¸Ñ Ð¿ÐµÑемеÑÐµÐ½Ð¸Ñ ÐºÐ°ÑÑинки ÑоваÑа в коÑÐ·Ð¸Ð½Ñ 814 * @returns {undefined} 815 */ 816function fly_to_basket(goods) { 817 var cart = $('.basket_block'); 818 var imgtodrag = goods.find(".goods_img img").eq(0); 819 if (imgtodrag) { 820 var imgclone = imgtodrag.clone() 821 .offset({ 822 top: imgtodrag.offset().top, 823 left: imgtodrag.offset().left 824 }) 825 .css({ 826 'opacity': '0.5', 827 'position': 'absolute', 828 'height': '150px', 829 'width': '150px', 830 'z-index': '9999' 831 }) 832 .appendTo($('body')) 833 .animate({ 834 'top': cart.offset().top + 10, 835 'left': cart.offset().left + 10, 836 'width': 75, 837 'height': 75 838 }, 1000, 'easeInOutExpo'); 839 840 setTimeout(function () { 841 cart.effect("shake", { 842 times: 2 843 }, 200); 844 }, 1500); 845 846 imgclone.animate({ 847 'width': 0, 848 'height': 0 849 }, function () { 850 $(this).detach(); 851 }); 852 } 853} 854 855/**
856 * Ðбновление коÑÐ·Ð¸Ð½Ñ Ð² веÑÑ Ð½ÐµÐ¹ ÑаÑÑи 857 */ 858function update_basket_in_top() 859{ 860 $.ajax({ 861 url: root_path + 'basket/?action=top_basket', 862 type: 'POST', 863 async: false, 864 success: function (html) 865 { 866 $('.basket_block').html(html); 867 } 868 }); 869} 870 871function markKeywords() { 872 var kword = $("form.search #search").val(); 873 var context = $('.shop_grid_product_area'); 874// context.mark(kword); 875 876} 877 878 879// Price Range Active Code 880$('.slider-range-price').each(function () { 881 var min = jQuery(this).data('min'); 882 var max = jQuery(this).data('max'); 883 var unit = jQuery(this).data('unit'); 884 var value_min = jQuery(this).data('value-min'); 885 var value_max = jQuery(this).data('value-max'); 886 var label_result = jQuery(this).data('label-result'); 887 var t = $(this); 888 $(this).slider({ 889 range: true, 890 min: min, 891 max: max, 892 values: [value_min, value_max], 893 slide: function (event, ui) { 894 $('input#MinCost').val(ui.values[0]); 895 $('input#MaxCost').val(ui.values[1]); 896 var result = label_result + " " + unit + ui.values[0] + ' - ' + unit + ui.values[1]; 897 t.closest('.slider-range').find('.range-price').html(result); 898 }, 899 change: getFilteredData 900 }); 901}); 902 903$('.shop_sidebar_area').on('change', 'input.custom-control-input', getFilteredData) 904$('.shop_sidebar_area').on('click', 'a.js_size_link', function (e) { 905 e.preventDefault(); 906 907 var href = $(this).attr('href'); 908 if (!$(this).hasClass('active')) { 909 var input = $('.js_size_val_' + href).val(href); 910 } else { 911 var input = $('.js_size_val_' + href).val(''); 912 } 913 914 $(this).toggleClass('active'); 915 getFilteredData(); 916}); 917 918function getFilteredData() { 919 var data = getFiltersData(); 920 921 $.get(window.location.href, data, function (resp) { 922 $('#ajax_content').html(resp) 923 }) 924} 925 926function getFiltersData() { 927 var colors = getColors(); 928 var sizes = getSizes(); 929 return { 930 mincost: $('input#MinCost').val(), 931 maxcost: $('input#MaxCost').val(), 932 colors: colors, 933 sizes: sizes, 934 action: 'filter' 935 }; 936} 937 938function getColors() { 939 var result = []; 940 941 $('input.custom-control-input:checked').each(function (item) { 942 result.push($(this).val()) 943 }); 944 945 return result 946} 947function getSizes() { 948 var result = []; 949 950 $('input[name="sizes[]"]').each(function (item) { 951 var val = $(this).val() 952 if (val !== '') 953 result.push(val) 954 }); 955 956 return result 957} 958 959/** 960 * Ðбновление колиÑеÑÑва ÑоваÑов в коÑзине 961 */ 962function basket_update(gty_input) { 963 if (gty_input.length > 0) { 964 $.ajax({ 965 url: root_path + 'basket/?action=update', 966 type: 'post', 967 data: { 968 'goods_id': gty_input.attr('data-id'), 969 'price_type': gty_input.attr('price_type'), 970 'quantity': gty_input.find('input.basket-quantity').val(), 971 }, 972 success: function (html) { 973 $('#basket-insert').html(html); 974 975 update_head_basket(); 976 } 977 }); 978 } 979} 980 981function basket_meter_update(gty_input) { 982 if (gty_input.length > 0) { 983 $.ajax({ 984 url: root_path + 'basket/?action=update', 985 type: 'post', 986 data: { 987 'goods_id': gty_input.attr('data-id'), 988 'price_type': gty_input.attr('price_type'), 989 'meter_quantity': gty_input.closest('div.edit_meter_to_basket').find('input[name=meter_quantity]').val(), 990 'centimeter_quantity': gty_input.closest('div.edit_meter_to_basket').find('input[name=centimeter_quantity]').val(), 991 }, 992 success: function (html) { 993 $('#basket-insert').html(html); 994 } 995 }); 996 } 997} 998 999/** 1000 * Ðбновление ÑÑоимоÑÑи позиÑии 1001 */ 1002function result_cost_update(add_to_basket) { 1003 if (add_to_basket.length > 0) { 1004 var result_cost = add_to_basket.find('div.result_cost b'); 1005 var result = add_to_basket.attr('data-price') * add_to_basket.find('input[name=quantity]').val(); 1006 result_cost.html(result.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1 ")); 1007 } 1008} 1009 1010/** 1011 * Ðбновление ÑÑоимоÑÑи позиÑии в меÑÑÐ°Ñ 1012 */ 1013function result_meter_cost_update(add_to_basket) { 1014 if (add_to_basket.length > 0) { 1015 var result_cost = add_to_basket.find('div.result_cost b'); 1016 var result = add_to_basket.attr('data-price') * add_to_basket.find('input[name=meter_quantity]').val() + 1017 parseInt(add_to_basket.attr('data-price') * add_to_basket.find('input[name=centimeter_quantity]').val() / 100); 1018 1019 result_cost.html(result.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1 ")); 1020 } 1021} 1022 1023 1024function serv_hide() { 1025 /* 1026 * ÐÑли в ÑоÑме Ð½ÐµÑ Ð¾ÑмеÑеннÑÑ ÑекбокÑов - ÑÑкÑÑваем 1027 */ 1028 if ($('#serv li input[type="checkbox"]:checked').length == 0) 1029 { 1030 $('#serv').hide(); 1031 } 1032} 1033 1034function reload_page(data) 1035{ 1036 if (data.indexOf('success-block') > -1) 1037 { 1038 location.reload(); 1039 } 1040} 1041 1042function update_head_basket() 1043{ 1044 $.ajax({ 1045 type: 'POST', 1046 url: root_path + 'basket/?action=update_head_basket', 1047 success: function (html) { 1048 $('.active-basket-part').each(function () { 1049 $(this).html(html); 1050 }); 1051 }, 1052 }); 1053} 1054 1055function fract(n) { 1056 return Number(String(n).split('.')[1] || 0); 1057}
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.