1let globalPopup; 2$(document).ready(function () { 3 globalPopup = new Popup(); 4 5 CheckButtonBuyInit(); 6 /* ########################################################### */ 7 $("body").on("click", ".js-cookie_block-confirm", function () { 8 9 $.cookie("K_COOKIE_CONFIRM", "Y", { expires: 30, path: "/" }); 10 $('.js-cookie_block').remove(); 11 }); 12 /* ########################################################### */ 13 function ClientID() { 14 var match = document.cookie.match('(?:^|;)\\s*_ym_uid=([^;]*)'); 15 return (match) ? decodeURIComponent(match[1]) : false; 16 } 17 18 setTimeout(() => { 19 20 if(!$.cookie('YM_CLIENT_ID')) { 21 22 var clientID = ClientID(); 23 if(clientID) { 24 $.cookie('YM_CLIENT_ID', clientID, { expires: 7, path: '/' }); 25 } 26 } 27 28 }, 1000); 29 /* ########################################################### */ 30 31 // $('.js-phone_mask').inputmask("+7 (999) 999-9999"); 32 globalThis.ret.initPhoneMask(); 33 function FilterValueCheckReset() { 34 $(".js-input_value").each(function () { 35 if ($(this).val() != "") $(this).next().show(); 36 else $(this).next().hide(); 37 }); 38 } 39 40 FilterValueCheckReset(); 41 42 /* ##################################################################################### */ 43 44 $(".js-input_value").on("input", function (event) { 45 //this.value = this.value.replace(/[^0-9]/g, ''); 46 /* 47 console.log('####################################################'); 48 console.log(this.value); 49 */ 50 51 if (this.value != "") $(this).next().show(); 52 else $(this).next().hide(); 53 }); 54 55 document.querySelectorAll(".js-input_value-reset").forEach(function (el) { 56 el.addEventListener("click", (event) => { 57 let _clear = event.target; 58 let _input = _clear.previousElementSibling; 59 60 _clear.style.display = "none"; 61 _input.value = ""; 62 /* 63 console.log('####################################################'); 64 console.log(_input); 65 console.log('####################################################'); 66 */ 67 if(document.querySelectorAll(".bx-filter").length) smartFilter.keyup(_input); 68 69 //console.log(event.target.previousElementSibling); 70 }); 71 }); 72 73 /* ######################################################### */ 74 75 function BasketInputsRemember() { 76 $(".js-remember_input").each(function () { 77 let _input = $(this); 78 let _name = _input.attr("name"); 79 let _val = _input.val(); 80 let _lift = _input.hasClass("js-basket_change-lift"); 81 82 if (_val === "" || _lift) { 83 if (localStorage.getItem(_name)) { 84 //console.log('#############################################################################') 85 //console.log(_name+': '+localStorage.getItem(_name)); 86 //_input2.value = localStorage.getItem(_name); 87 _input.val(localStorage.getItem(_name)); 88 89 /* 90 if (_lift) { 91 if (_input.val() == "NO") { 92 $(".js-basket_floor").addClass("hide"); 93 } else { 94 $(".js-basket_floor").removeClass("hide"); 95 } 96 } 97 */ 98 } 99 } 100 }); 101 } 102 if ($(".js-remember_input").length) { 103 BasketInputsRemember(); 104 105 $("body").on("change", ".js-remember_input", function (event) { 106 let _input = $(this); 107 let _name = _input.attr("name"); 108 let _val = _input.val(); 109 110 //console.log('#################################### CHANGE #########################################') 111 //console.log(_name+': '+_val); 112 113 localStorage.setItem(_name, _val); 114 }); 115 } 116 117 /* ######################################################### */ 118 119 //DatePickerInit(); 120 121 //setHeight_My('.js-catalog', '.js-catalog_item', '.js-catalog_item-name'); 122 123 $(".js-input_number").on("input", function (event) { 124 this.value = this.value.replace(/[^0-9]/g, ""); 125 }); 126 127 $(".js-change_no").on("keypress", function (e) { 128 e.preventDefault(); 129 }); 130 $(".js-href_false").on("click", function () { 131 return false;
132 }); 133 134 //$('.js-fancybox').fancybox(); 135 136 $("body").on("click", ".js-filter_go", function () { 137 $(".js-filter_form").submit(); 138 return false; 139 }); 140 141 $("body").on("click", ".js-compare", function () { 142 CompareChange($(this)); 143 144 return false; 145 }); 146 147 $("body").on("click", ".js-tags_add", function () { 148 let _this = $(this); 149 let _block_tags = $(".js-tags_block"); 150 let _b_data = $(".js-tags_data"); 151 let _block_url = _b_data.find('input[name="BLOCK_URL"]').val(); 152 let _block_id = _b_data.find('input[name="BLOCK_ID"]').val(); 153 154 let btnView = $(".js-tags_block"); 155 156 /* 157 console.log('++++++++++++++++++++++'); 158 console.log(_this.html()); 159 console.log('++++++++++++++++++++++'); 160 */ 161 162 if (_this.html() == "СвеÑнÑÑÑ") { 163 let str2 = 164 "action=tagsListNew&BLOCK_URL=" + 165 _block_url + 166 "&BLOCK_ID=" + 167 _block_id + 168 "&COUNT=7"; 169 $.post("/ajax/front.php", str2, function (returns2) { 170 _block_tags.html(returns2); 171 }); 172 } else { 173 let str2 = 174 "action=tagsListNew&BLOCK_URL=" + 175 _block_url + 176 "&BLOCK_ID=" + 177 _block_id + 178 "&COUNT=ALL"; 179 $.post("/ajax/front.php", str2, function (returns2) { 180 _block_tags.html(returns2); 181 }); 182 } 183 184 return false; 185 }); 186 187 /* 188 $('body').on('click','.js-tags_add', function () { 189 190 191 let _this = $(this); 192 let _block_tags = $('.js-tags_block'); 193 let _b_data = $('.js-tags_data'); 194 let _block_url = _b_data.find('input[name="BLOCK_URL"]').val(); 195 let _block_id = _b_data.find('input[name="BLOCK_ID"]').val(); 196 let _pagen = parseInt(_b_data.find('input[name="PAGEN"]').val()); 197 let _count_all = parseInt(_b_data.find('input[name="COUNT_ALL"]').val()); 198 let _count_current = _pagen*7; 199 200 201 _b_data.hide(); 202 203 if(_count_current < _count_all) { 204 let str2 = 'action=tagsList&BLOCK_URL='+_block_url+'&BLOCK_ID='+_block_id+'&PAGEN='+_pagen; 205 $.post('/ajax/front.php', str2, function (returns2) { 206 207 _block_tags.append(returns2); 208 $('input[name="PAGEN"]').val((_pagen+1)); 209 210 //console.log(parseInt($('input[name="PAGEN"]').val())*7+' < '+_count_all); 211 212 if(parseInt($('input[name="PAGEN"]').val())*7 < _count_all) { 213 _b_data.show(); 214 } 215 }); 216 } 217 218 219 return false; 220 }); 221 */ 222 223 $("body").on("click", ".js-compare_all", function () { 224 let _this = $(this); 225 let _ids = _this.data("products"); 226 227 let data = "action=ADD_COMPARE_ALL&IDS=" + _ids; 228 $.ajax({ 229 type: "POST", 230 dataType: "json", 231 url: "/ajax/back.php", 232 data: data, 233 success: function (returns) { 234 $(".js-GoodsInCompare").data("count", returns.COUNT).html(returns.COUNT); 235 CheckActive($(".js-GoodsInCompare")); 236 237 location.href = "/compare/"; 238 239 /* 240 globalPopup.options({ 241 closeButtons: '.js-close' 242 }).html(returns.HTML).show(); 243 */ 244 }, 245 }); 246 247 return false; 248 }); 249 250 $("body").on("click", ".js-viewed_remove", function () { 251 let _this = $(this); 252 let _block = _this.parents(".js-catalog_item"); 253 let _id = _block.data("id"); 254 255 let _block_all = _this.parents(".js-catalog_viewed"); 256 257 let data = "action=VIEWED_REMOVE&ID=" + _id; 258 259 $.ajax({ 260 type: "POST", 261 dataType: "json", 262 url: "/ajax/back.php", 263 data: data, 264 success: function (returns) { 265 _block.remove(); 266 267 if (returns.VIEWED_REMOVE_ALL) { 268 _block_all.html(""); 269 } 270 }, 271 }); 272 273 return false; 274 }); 275 276 $("body").on("click", ".js-viewed_remove-all", function () { 277 let _this = $(this); 278 let _block = _this.parents(".js-catalog_viewed"); 279 280 let data = "action=VIEWED_REMOVE_ALL"; 281 282 $.ajax({ 283 type: "POST", 284 dataType: "json", 285 url: "/ajax/back.php", 286 data: data, 287 success: function (returns) { 288 _block.html(""); 289 }, 290 }); 291 292 return false;
293 }); 294 295 $("body").on("click", ".js-favorite_category-remove", function () { 296 let _this = $(this); 297 let data = "action=FAVORITE_CATEGORY_REMOVE&ID=" + _this.data("id"); 298 299 if(_this.parents(".js-form").find('input[name="FILTER_NAME"]').length) { 300 let filterName = _this.parents(".js-form").find('input[name="FILTER_NAME"]').val(); 301 data = data + '&FILTER_NAME='+filterName; 302 } 303 304 $.ajax({ 305 type: "POST", 306 dataType: "json", 307 url: "/ajax/back.php", 308 data: data, 309 success: function (returns) { 310 location.reload(); 311 }, 312 }); 313 314 return false; 315 }); 316 317 $("body").on("click", ".js-favorite_remove-all", function () { 318 let _this = $(this); 319 320 $.cookie("FAVORITE_LIST", "", { expires: 7, path: "/" }); 321 322 location.reload(); 323 324 /* 325 $(".js-favorite_list").html( 326 '<div class="text-default">СпиÑок избÑаннÑÑ ÑоваÑов пÑÑÑ.</div>', 327 ); 328 $(".js-favorite_filter").html(""); 329 330 $(".js-GoodsInFavorites").data("count", 0); 331 $(".js-GoodsInFavorites").html("0"); 332 CheckActive($(".js-GoodsInFavorites")); 333 */ 334 335 return false; 336 }); 337 338 $("body").on("click", ".js-add2favorite", function () { 339 let _this = $(this); 340 341 let _id = $(this).data("id"); 342 343 if (_id) { 344 let _arr = ""; 345 if ($.cookie("FAVORITE_LIST")) _arr = $.cookie("FAVORITE_LIST"); 346 347 _arr = _arr.split("|"); 348 let _find = false; 349 350 if (_arr.length > 0) { 351 $.each(_arr, function (key, value) { 352 if (!value) { 353 _arr.splice(key, 1); 354 } else { 355 if (value == _id) { 356 _find = true; 357 _arr.splice(key, 1); 358 359 //console.log('УдалÑем 3'); 360 /* 361 _this.removeClass('active'); 362 if(_this.children().length) _this.children().html('ÐÑложиÑÑ'); 363 if(_this.data('tippy-content')) _this.attr('data-tippy-content', 'ÐобавиÑÑ Ð² избÑанное'); 364 */ 365 } 366 } 367 }); 368 369 if (!_find) { 370 //console.log('ÐобавлÑем 1'); 371 _arr[_arr.length] = _id; 372 /* 373 _this.addClass('active'); 374 if(_this.children().length) _this.children().html('ÐÑложено'); 375 if(_this.data('tippy-content')) _this.attr('data-tippy-content', 'УбÑаÑÑ Ð¸Ð· избÑанного'); 376 */ 377 } 378 } else { 379 //console.log('ÐобавлÑем 2'); 380 381 _arr.splice(0, 0, _id); 382 /* 383 _this.addClass('active'); 384 if(_this.children().length) _this.children().html('ÐÑложено'); 385 if(_this.data('tippy-content')) _this.attr('data-tippy-content', 'УбÑаÑÑ Ð¸Ð· избÑанного'); 386 */ 387 } 388 389 let _count = _arr.length; 390 //$('.js-GoodsInLiked').html(_count); 391 392 let _arr_text = ["ÑоваÑ", "ÑоваÑа", "ÑоваÑов"]; 393 394 //console.log(_count); 395 396 $(".js-GoodsInFavorites").data("count", _count); 397 $(".js-GoodsInFavorites").html(_count); 398 399 CheckActive($(".js-GoodsInFavorites")); 400 401 $.cookie("FAVORITE_LIST", _arr.join("|"), { expires: 7, path: "/" }); 402 403 FavoriteChange(_id, _find); 404 } 405 406 return false; 407 }); 408 409 /* 410 $('body').on('click', '.js-compare_block-change', function() { 411 412 let _section = $(this).data('id'); 413 let data = 'action=CHANGE_COMPARE_SECTION&SECTION_ID='+_section; 414 $.ajax({ 415 type: "POST", 416 dataType: "json", 417 url: "/ajax/back.php", 418 data: data, 419 success: function(returns) { 420 421 location.href = '/compare/'; 422 } 423 }); 424 425 return false; 426 }); 427 */ 428/* 429 $("body").on("click", ".js-compare_block-change", function () { 430 let _block = $(this).data("id"); 431 let data = "action=CHANGE_COMPARE_BLOCK&BLOCK_ID=" + _block; 432 $.ajax({ 433 type: "POST", 434 dataType: "json", 435 url: "/ajax/back.php", 436 data: data, 437 success: function (returns) { 438 location.href = '/compare/'; 439 }, 440 }); 441 442 return false;
443 }); 444*/ 445 446$("body").on("click", ".js-compare_block-change_link", function () { 447 let _block = $(this).data("id"); 448 let data = "action=CHANGE_COMPARE_BLOCK&BLOCK_ID=" + _block; 449 $.ajax({ 450 type: "POST", 451 dataType: "json", 452 url: "/ajax/back.php", 453 data: data, 454 success: function (returns) { 455 location.href = '/compare/'; 456 }, 457 }); 458 459 return false; 460}); 461 462 $("body").on("change", ".js-compare_block-change", function () { 463 let _block = $(this).val(); 464 let data = "action=CHANGE_COMPARE_BLOCK&BLOCK_ID=" + _block; 465 $.ajax({ 466 type: "POST", 467 dataType: "json", 468 url: "/ajax/back.php", 469 data: data, 470 success: function (returns) { 471 location.href = '/compare/'; 472 }, 473 }); 474 475 return false; 476 }); 477 478 $("body").on("click", ".js-compare_block-clear", function () { 479 let _block = $(this).data("id"); 480 let data = "action=CLEAR_COMPARE_BLOCK&BLOCK_ID=" + _block; 481 $.ajax({ 482 type: "POST", 483 dataType: "json", 484 url: "/ajax/back.php", 485 data: data, 486 success: function (returns) { 487 location.href = '/compare/'; 488 }, 489 }); 490 491 return false; 492 }); 493 494 $("body").on("click", ".js-compare_remove", function () { 495 //winaclose(); 496 497 CompareChange($(this)); 498 499 return false; 500 }); 501 502 $("body").on("click", ".js-art_type-change_all", function () { 503 $(".js-art_type-change").attr("checked", false); 504 505 let c_form = $(this).parents(".js-form"); 506 let data = c_form.serialize(); 507 //console.log(data); 508 509 $.ajax({ 510 type: "POST", 511 dataType: "json", 512 url: "/ajax/back.php", 513 data: data, 514 success: function (returns) { 515 location.reload(); 516 }, 517 }); 518 }); 519 520 $("body").on("click", ".js-art_type-change", function () { 521 let c_form = $(this).parents(".js-form"); 522 let data = c_form.serialize(); 523 //console.log(data); 524 525 $.ajax({ 526 type: "POST", 527 dataType: "json", 528 url: "/ajax/back.php", 529 data: data, 530 success: function (returns) { 531 location.reload(); 532 }, 533 }); 534 535 //return false; 536 }); 537 538 $("body").on("click", ".js-sort_change", function () { 539 let data = 540 "action=changeSort&K_SORT=" + 541 $(this).data("sort") + 542 "&K_ORDER=" + 543 $(this).data("order"); 544 $.ajax({ 545 type: "POST", 546 dataType: "json", 547 url: "/ajax/back.php", 548 data: data, 549 success: function (returns) { 550 location.reload(); 551 }, 552 }); 553 554 return false; 555 }); 556 557 $("body").on("change", ".js-sort_change-select", function () { 558 559 let K_ORDER = $('.js-sort_change-select option:selected').data("order"); 560 561 let data = "action=changeSort&K_SORT=" + $(this).val() + "&K_ORDER="+K_ORDER; 562 $.ajax({ 563 type: "POST", 564 dataType: "json", 565 url: "/ajax/back.php", 566 data: data, 567 success: function (returns) { 568 location.reload(); 569 }, 570 }); 571 572 return false; 573 }); 574 575 $(".js-page_kol").on("change", function () { 576 console.log("change"); 577 578 let data = "action=changePage&PAGE_KOL=" + $(this).val(); 579 $.ajax({ 580 type: "POST", 581 dataType: "json", 582 url: "/ajax/back.php", 583 data: data, 584 success: function (returns) { 585 location.reload(); 586 }, 587 }); 588 589 return false; 590 }); 591 592 $("body").on("click", ".js-view_change", function () { 593 let _this = $(this); 594 let _val = _this.data("val"); 595 596 if (_val == "list") $(".js-catalog_products").addClass("horizontal"); 597 else $(".js-catalog_products").removeClass("horizontal"); 598 599 $(".js-view_change").removeClass("active"); 600 _this.addClass("active"); 601 602 globalThis.ret.updateHoverSliders(); 603 604 let data = "action=changeView&val=" + $(this).data("val"); 605 $.ajax({ 606 type: "POST", 607 dataType: "json", 608 url: "/ajax/back.php", 609 data: data, 610 success: function (returns) { 611 //location.reload(); 612 }, 613 }); 614 615 return false;
616 }); 617 618 619 $("body").on("click", ".js-add2basket_service-radiobox", function (e) { 620 621 e.preventDefault(); 622 }); 623 624 $("body").on("click", ".js-add2basket_service", function (e) { 625 626 e.preventDefault(); 627 628 let _button = $(this); 629 630 _button.fadeToggle(100); 631 632 let c_form = $(this).parents(".js-form"); 633 c_form.find(".js-error").fadeOut(); 634 635 let _actionInput = c_form.find('input[name="action"]'); 636 let _actionVal = _actionInput.val(); 637 638 let _actionInputAll = $('.js-form.installation-services__form input[name="action"]'); 639 let _buttonAll = $('.js-add2basket_service'); 640 641 642 let data = c_form.serialize(); 643 $.ajax({ 644 type: "POST", 645 dataType: "json", 646 url: "/ajax/back.php", 647 data: data, 648 success: function (returns) { 649 650 if(returns.SUCCESS == 'Y') { 651 652 if(_actionVal == 'ADD2BASKET_SERVICE') { 653 _buttonAll.html(_button.html().replace('ÐобавиÑÑ Ðº заказÑ','УбÑаÑÑ Ð¸Ð· заказа')); 654 _actionInputAll.val('REMOVE2BASKET_SERVICE'); 655 } 656 657 if(_actionVal == 'REMOVE2BASKET_SERVICE') { 658 _buttonAll.html(_button.html().replace('УбÑаÑÑ Ð¸Ð· заказа', 'ÐобавиÑÑ Ðº заказÑ')); 659 _actionInputAll.val('ADD2BASKET_SERVICE'); 660 } 661 662 if($('.js-add2basket_service-radiobox').length) { 663 664 submitForm(); 665 globalPopup.close(); 666 } 667 668 } 669 670 _button.fadeToggle(100); 671 672 } 673 }); 674 675 }); 676 677 678 $("body").on("click", ".js-add2basket", function () { 679 let _this = $(this); 680 let TOV_ID = _this.data("id"); 681 let data = "action=ADD2BASKET&TOV_ID=" + TOV_ID; 682 //console.log(data); 683 684 ECOM_AddToBasket(TOV_ID, 1); 685 686 $.ajax({ 687 type: "POST", 688 dataType: "json", 689 url: "/ajax/back.php", 690 data: data, 691 success: function (returns) { 692 if ($(".js-GoodsInBasket").length) $(".js-GoodsInBasket").html(returns.COUNT); 693 if ($(".js-GoodsInBasket_text").length) 694 $(".js-GoodsInBasket_text").html(returns.COUNT_TEXT); 695 if ($(".js-PricesInBasket").length) $(".js-PricesInBasket").html(returns.SUM); 696 697 CheckActive($(".js-GoodsInBasket")); 698 699 CheckButtonBuy(_this, TOV_ID, returns.BASKET_TOVS_ID); 700 701 if ($(".js-ecom_basket-stepone").length) { 702 submitForm(); 703 } 704 705 // ÐÑводим плаÑÐºÑ 706 let str2 = 707 "action=ADD2BASKET_AFTER&TOV_ID=" + TOV_ID + "&BASKET_ID=" + returns.BASKET_ID; 708 $.post("/ajax/front.php", str2, function (returns2) { 709 globalPopup 710 .options({ 711 closeButtons: ".js-close", 712 }) 713 .html(returns2) 714 .show(); 715 }); 716 }, 717 }); 718 719 return false; 720 }); 721 722 $("body").on("click", ".js-captcha_change", function () { 723 let _this = $(this); 724 let _input = $(".js-captcha_code"); 725 726 let data = "action=change_captcha"; 727 $.ajax({ 728 type: "POST", 729 dataType: "json", 730 url: "/ajax/back.php", 731 data: data, 732 success: function (returns) { 733 _this.attr("src", returns.CAPTCHA_IMG); 734 _input.val(returns.CAPTCHA_CODE); 735 }, 736 }); 737 }); 738 739 740 741 /* ############################################################################## */ 742 743 $("body").on("input", ".js-wantcheap_input", function () { 744 745 746 this.value = this.value.replace(/[^0-9]/g, ""); 747 748 let cheapPriceUser = parseInt($(this).val()); 749 let cheapPriceProduct = parseInt($('.js-wantcheap_price-product').val()); 750 751 if(cheapPriceUser < cheapPriceProduct) { 752 let cheapPriceDiff = cheapPriceProduct-cheapPriceUser;
753 $(".js-wantcheap_discount").html(sdf_FTS(cheapPriceDiff,0,' ')+' ÑÑб.'); 754 } 755 else { 756 $(".js-wantcheap_discount").html('0 ÑÑб.'); 757 } 758 759 }); 760 761 762 763 $("body").on("click", ".js-wantcheap_offer", function (e) { 764 765 e.preventDefault(); 766 767 let _button = $(this); 768 _button.fadeToggle(100); 769 770 let c_form = _button.parents(".js-form"); 771 let error = CheckPols(c_form); 772 773 774 const stepCheckForm = new Promise(function (resolve, reject) { 775 CheckPols(c_form, resolve); 776 }); 777 stepCheckForm.then((error) => { 778 779 780 error = ConfirmCheckboxCheck(c_form, error); 781 782 783 if (error != "1") { 784 let data = c_form.serialize(); 785 786 $.post("/ajax/front.php", data, function (_html) { 787 788 globalPopup.html(_html, function () { 789 globalThis.ret.popupNormalizeScroll; 790 globalThis.ret.initPhoneMask(); 791 globalThis.ret.initOfferTimer(); 792 }).show(); 793 794 _button.fadeToggle(100); 795 796 }); 797 } 798 else { 799 _button.fadeToggle(100); 800 } 801 802 }); 803 804 }); 805 806 807 /* ############################################################################## */ 808 809 810 $("body").on("click", ".js-viewChat", function () { 811 //console.log('Open !!!!'); 812 813 res = jivo_api.open(); 814 //console.log(res); 815 816 return false; 817 }); 818 819 $("body").on("click", ".js-viewForm_block", function () { 820 821 //console.log($(this).data('block')); 822 823 if ($($(this).data("block")).length) { 824 let _html = $($(this).data("block")).html(); 825 826 globalPopup.html(_html, function () { 827/* 828 if($(".js-popap-accordion").length) { 829 globalThis.ret.initPopapAccordion(); 830 } 831*/ 832 }).show(); 833 } 834 835 return false; 836 }); 837 838 839 $("body").on("click", ".js-viewForm", function () { 840 //console.log('33333'); 841 842 843 let _action = $(this).data("action"); 844 let str = "action=" + _action; 845 if ($(this).data("type")) { 846 str = str + "&TYPE=" + $(this).data("type"); 847 } 848 if ($(this).data("id")) { 849 let _id = $(this).data("id"); 850 str = str + "&ID=" + _id; 851 } 852 if ($(this).data("block")) { 853 var _block_id = $(this).data("block"); 854 str = str + "&BLOCK_ID=" + _block_id; 855 } 856 if ($(this).data("product_id")) { 857 var _product_id = $(this).data("product_id"); 858 str = str + "&PRODUCT_ID=" + _product_id; 859 } 860 861 $.post("/ajax/front.php", str, function (_html) { 862 globalPopup 863 .html(_html, function () { 864 globalThis.ret.popupNormalizeScroll; 865 866 if ($(".js-form_page").length) { 867 $(".js-form_page").val(document.location.href); 868 } 869 870 if (_action == "reviewsAdd") { 871 /* 872 new Ratings({ 873 element: document.querySelector('.js-ratings__section'), // пеÑедаем ÑÐ»ÐµÐ¼ÐµÐ½Ñ 874 countRate: 5, // кол-во оÑенок 875 clickFn: function (index) { 876 console.log('val = '+index); 877 $(".js-review_rating").val(index); 878 } 879 }); 880 */ 881 } 882 883 // $('.js-phone_mask').inputmask("+7 (999) 999-9999"); 884 globalThis.ret.initPhoneMask(); 885 if (_action == "BuyOneClick") { 886 //ECOM_InitBasket('2', _id); 887 } 888 }) 889 .show(); 890 }); 891 892 return false; 893 }); 894 895 $("body").on("click", ".js-form .js-go", function (e) { 896 e.preventDefault(); 897 898 let _button = $(this); 899 900 _button.fadeToggle(100); 901 902 let c_form = $(this).parents(".js-form"); 903 c_form.find(".js-error").fadeOut(); 904 905 const stepCheckForm = new Promise(function (resolve, reject) { 906 CheckPols(c_form, resolve); 907 }); 908 stepCheckForm.then((error) => { 909 910 911 error = ConfirmCheckboxCheck(c_form, error); 912 913 914 if (error != "1") { 915 let data = c_form.serialize(); 916 $.ajax({ 917 type: "POST", 918 dataType: "json", 919 url: "/ajax/back.php", 920 data: data, 921 success: function (returns) { 922 _button.fadeToggle(100); 923 924 if (returns.CAPTCHA == "N") { 925 $(".js-captcha_inp").addClass("BadPols"); 926 $(".js-captcha_change").trigger("click"); 927 } else { 928 $(".js-captcha_inp").removeClass("BadPols"); 929 } 930 931 if (returns.MESSAGE && returns.ERROR == "Y") { 932 c_form.find(".js-error").fadeIn().html(returns.MESSAGE); 933 } 934 935 if (returns.RELOAD == "Y") { 936 /*location.reload();*/ 937 window.location = returns.LOCATION; 938 } 939 if (returns.SUCCESS == "Y") { 940 if (returns.CLEARPOLS == "Y") { 941 ClearPols(c_form); 942 } 943 944 if (returns.HTML) { 945 globalPopup 946 .options({ 947 //closeButtons: '.js-close, .js-popup-close', 948 closeShow: true, 949 }) 950 .html(returns.HTML) 951 .show(); 952 } 953 } 954 }, 955 }); 956 } else { 957 _button.fadeToggle(100); 958 } 959 }); 960 961 return false;
962 }); 963 964 965 966 $("body").on("click", ".js-form_doc-all .js-go", function () { 967 968 let _button = $(this); 969 970 _button.fadeToggle(100); 971 972 let c_form = $(this).parents(".js-form_doc-all"); 973 var form = $(this).parents('.js-form_doc-all')[0]; 974 c_form.find(".js-error").fadeOut(); 975 976 const stepCheckForm = new Promise(function (resolve, reject) { 977 CheckPols(c_form, resolve); 978 }); 979 stepCheckForm.then((error) => { 980 981 982 error = ConfirmCheckboxCheck(c_form, error); 983 984 985 if (error != "1") { 986 987 988 var data = new FormData(form); 989 //data.append("docs", $('.fileinput')[0].files[0]); 990 991 $.ajax({ 992 url: "/ajax/back.php", 993 type: "POST", 994 contentType: false, // важно - ÑбиÑаем ÑоÑмаÑиÑование даннÑÑ Ð¿Ð¾ ÑмолÑÐ°Ð½Ð¸Ñ 995 processData: false, // важно - ÑбиÑаем пÑеобÑазование ÑÑÑок по ÑмолÑÐ°Ð½Ð¸Ñ 996 data: data, 997 dataType: "json", 998 success: function(returns) { 999 1000 1001 _button.fadeToggle(100); 1002 1003 if (returns.CAPTCHA == "N") { 1004 $(".js-captcha_inp").addClass("BadPols"); 1005 $(".js-captcha_change").trigger("click"); 1006 } else { 1007 $(".js-captcha_inp").removeClass("BadPols"); 1008 } 1009 1010 if (returns.MESSAGE && returns.ERROR == "Y") { 1011 c_form.find(".js-error").fadeIn().html(returns.MESSAGE); 1012 } 1013 1014 if (returns.RELOAD == "Y") { 1015 /*location.reload();*/ 1016 window.location = returns.LOCATION; 1017 } 1018 1019 1020 if (returns.SUCCESS == "Y") { 1021 if (returns.CLEARPOLS == "Y") { 1022 ClearPols(c_form); 1023 } 1024 1025 1026 1027 if (returns.HTML) { 1028 1029 globalPopup.options({ 1030 //closeButtons: '.js-close, .js-popup-close', 1031 closeShow: true, 1032 }) 1033 .html(returns.HTML) 1034 .show(); 1035 } 1036 } 1037 1038 1039 1040 } 1041 1042 }); 1043 1044 1045 1046 1047 } else { 1048 _button.fadeToggle(100); 1049 } 1050 1051 }); 1052 1053 return false; 1054 }); 1055 1056 /* ################################### ÐоÑзина #################################### */ 1057 1058 BasketAddrAutocompleteInit(); 1059 CheckParamsByDataInit(); 1060 1061 $("body").on("blur", ".js-input_autocheck", function () { 1062 CheckParamsByData($(this)); 1063 }); 1064 1065 if ($(".js-basket_city").length) { 1066 $(".js-basket_city").autocomplete({ 1067 source: function (request, response) { 1068 $.ajax({ 1069 url: "/ajax/back.php", 1070 dataType: "json", 1071 data: { 1072 action: "autocomplete_CITY", 1073 str: request.term, 1074 }, 1075 success: function (data) { 1076 response( 1077 $.map(data.AUTO_LIST, function (item) { 1078 return { 1079 label: item, 1080 value: item, 1081 }; 1082 }), 1083 ); 1084 }, 1085 }); 1086 }, 1087 minLength: 2, 1088 }); 1089 } 1090 1091 if ($(".js-basket_metro").length) { 1092 $(".js-basket_metro").autocomplete({ 1093 source: function (request, response) { 1094 $.ajax({ 1095 url: "/ajax/back.php", 1096 dataType: "json", 1097 data: { 1098 action: "autocomplete_METRO", 1099 str: request.term, 1100 }, 1101 success: function (data) { 1102 response( 1103 $.map(data.AUTO_LIST, function (item) { 1104 return { 1105 label: item, 1106 value: item, 1107 }; 1108 }), 1109 ); 1110 }, 1111 }); 1112 }, 1113 minLength: 2, 1114 }); 1115 } 1116 /* 1117 $("body").on("change", ".js-basket_change-lift", function () { 1118 console.log($(this).val()); 1119 if ($(this).val() == "NO") { 1120 $(".js-basket_floor").addClass("hide"); 1121 } else { 1122 $(".js-basket_floor").removeClass("hide"); 1123 } 1124 }); 1125 */ 1126 1127 $("body").on("change", ".js-basket_change-city", function () { 1128 //console.log($(this).val()); 1129 if ($(this).val() == "MSK") { 1130 $(".js-basket_metro").removeClass("hide"); 1131 $(".js-basket_city").addClass("hide"); 1132 } else { 1133 $(".js-basket_metro").addClass("hide"); 1134 $(".js-basket_city").removeClass("hide"); 1135 } 1136 }); 1137 1138 $("body").on("click", ".js-basket__go", function () { 1139 let c_form = $(this).parents(".js-form"); 1140 1141 const stepCheckForm = new Promise(function (resolve1, reject1) { 1142 CheckPols(c_form, resolve1); 1143 }); 1144 stepCheckForm.then((error) => { 1145 //let error = CheckPols(c_form); 1146 1147 1148 1149 1150 1151 error = ConfirmCheckboxCheck(c_form, error); 1152 1153 1154 if (error != "1") { 1155 // внаÑале вÑполнÑем ÑÐ¾Ñ Ñанение даннÑÑ Ð¸ ÑолÑко поÑом ÑÐ°Ð±Ð¼Ð¸Ñ Ð¾ÑпÑÐ°Ð²ÐºÑ ÑоÑÐ¼Ñ 1156 const stepCheck2 = new Promise(function (resolve2, reject2) { 1157 1158 if ($(".js-basket_addr").length) { 1159 ChangeBasketParamsByDaData($(".js-basket_addr").val(), resolve2); 1160 } else { 1161 resolve2("go"); 1162 } 1163 }); 1164 1165 stepCheck2.then((statusData) => { 1166 1167 const stepCheck3 = new Promise(function (resolve3, reject3) { 1168 1169 if ($(".installation-service-block").length) { 1170 ClickerConnectionBasketSave(resolve3); 1171 } else { 1172 resolve3("go"); 1173 } 1174 }); 1175 1176 stepCheck3.then((statusData) => { 1177 submitForm("Y"); 1178 }); 1179 1180 }); 1181 } else { 1182 if ($(".BadPols").length) { 1183 $("html, body").animate({ scrollTop: $(".BadPols").offset().top - 200 }, 1000); 1184 } 1185 } 1186 }); 1187 1188 return false;
1189 }); 1190 1191 1192/* 1193 $("body").on("click", ".js-basket__go", function () { 1194 let c_form = $(this).parents(".js-form"); 1195 1196 const stepCheckForm = new Promise(function (resolve1, reject1) { 1197 CheckPols(c_form, resolve1); 1198 }); 1199 stepCheckForm.then((error) => { 1200 //let error = CheckPols(c_form); 1201 1202 1203 1204 error = ConfirmCheckboxCheck(c_form, error); 1205 1206 1207 if (error != "1") { 1208 // внаÑале вÑполнÑем ÑÐ¾Ñ Ñанение даннÑÑ Ð¸ ÑолÑко поÑом ÑÐ°Ð±Ð¼Ð¸Ñ Ð¾ÑпÑÐ°Ð²ÐºÑ ÑоÑÐ¼Ñ 1209 const stepCheck1 = new Promise(function (resolve2, reject2) { 1210 if ($(".js-basket_addr").length) { 1211 ChangeBasketParamsByDaData($(".js-basket_addr").val(), resolve2); 1212 } else { 1213 resolve2("go"); 1214 } 1215 }); 1216 1217 stepCheck1.then((statusData) => { 1218 1219 1220 submitForm("Y"); 1221 }); 1222 } else { 1223 if ($(".BadPols").length) { 1224 $("html, body").animate({ scrollTop: $(".BadPols").offset().top - 200 }, 1000); 1225 } 1226 } 1227 }); 1228 1229 return false; 1230 }); 1231 */ 1232 1233 $("body").on("click", ".js-product_confirm-view", function (e) { 1234 let _this = $(this); 1235 let _product = _this.parents(".js-product__row"); 1236 let _confirm = _product.find(".js-product_confirm"); 1237 1238 _this.addClass("active"); 1239 1240 _confirm.show(); 1241 1242 return false; 1243 }); 1244 1245 $("body").on("click", ".js-product_confirm-close", function (e) { 1246 let _this = $(this); 1247 let _product = _this.parents(".js-product__row"); 1248 let _confirm = _this.parents(".js-product_confirm"); 1249 let _confirmView = _product.find(".js-product_confirm-view"); 1250 1251 _confirmView.removeClass("active"); 1252 1253 _confirm.hide(); 1254 1255 return false; 1256 }); 1257 1258 $("body").on("click", ".js-product__del", function (e) { 1259 if (e) e.preventDefault(); 1260 let _this = $(this); 1261 1262 ECOM_DeleteToBasket($(this).data('prodid')); 1263 let str = "action=DELETE2BASKET&ID=" + $(this).data("id"); 1264 $.ajax({ 1265 type: "POST", 1266 dataType: "json", 1267 url: "/ajax/back.php", 1268 data: str, 1269 success: function (returns) { 1270 if ($(".js-GoodsInBasket").length) $(".js-GoodsInBasket").html(returns.COUNT); 1271 if ($(".js-GoodsInBasket_text").length) 1272 $(".js-GoodsInBasket_text").html(returns.COUNT_TEXT); 1273 if ($(".js-PricesInBasket").length) $(".js-PricesInBasket").html(returns.SUM); 1274 1275 CheckActive($(".js-GoodsInBasket")); 1276 1277 _this.closest(".js-product__row").remove(); 1278 if ($(".js-product__row").length > 0) { 1279 submitForm(); 1280 //ChangeItog(); 1281 1282 if (returns.MIND_JS) { 1283 //$('.js-mindbox_cart').append(returns.MIND_JS); 1284 } 1285 } else { 1286 location.reload(); 1287 } 1288 }, 1289 }); 1290 1291 // Ñдаление 1292 return false; 1293 }); 1294 1295 $("body").on("change", ".js-change input", function () { 1296 let _item = $(this).parents(".js-change").find("input"); 1297 let _kol = parseInt(_item.val()); 1298 let _baskID = parseInt(_item.data("basketid")); 1299 1300 if (isInt(_kol)) { 1301 if (_kol < 1) _kol = 1; 1302 } else { 1303 let _kol = 1; 1304 } 1305 1306 $(this).parents(".js-change").find("input").val(_kol); 1307 //ChangeItog(); 1308 1309 let str = "action=CHANGE2BASKET&TOV_ID=" + _baskID + "&KOL=" + _kol; 1310 $.ajax({ 1311 type: "POST", 1312 dataType: "json", 1313 url: "/ajax/back.php", 1314 data: str, 1315 success: function (returns) { 1316 if ($(".js-GoodsInBasket").length) $(".js-GoodsInBasket").html(returns.COUNT); 1317 if ($(".js-GoodsInBasket_text").length) 1318 $(".js-GoodsInBasket_text").html(returns.COUNT_TEXT); 1319 if ($(".js-PricesInBasket").length) $(".js-PricesInBasket").html(returns.SUM); 1320 1321 CheckActive($(".js-GoodsInBasket")); 1322 1323 if (returns.MIND_JS) { 1324 $(".js-mindbox_cart").append(returns.MIND_JS); 1325 } 1326
1327 submitForm(); 1328 }, 1329 }); 1330 }); 1331 1332 $("body").on("click", ".js-change button", function () { 1333 let _item = $(this).parents(".js-change").find("input"); 1334 let _kol = parseInt(_item.val()); 1335 let _baskID = parseInt(_item.data("basketid")); 1336 let _NewKol = 1; 1337 1338 if (isInt(_kol)) { 1339 if ($(this).hasClass("js-plus")) { 1340 _NewKol = _kol + 1; 1341 } 1342 if ($(this).hasClass("js-minus")) { 1343 _NewKol = _kol - 1; 1344 } 1345 } 1346 1347 if (_NewKol < 1) _NewKol = 1; 1348 $(this).parents(".js-change").find("input").val(_NewKol); 1349 //ChangeItog(); 1350 1351 let str = "action=CHANGE2BASKET&TOV_ID=" + _baskID + "&KOL=" + _NewKol; 1352 $.ajax({ 1353 type: "POST", 1354 dataType: "json", 1355 url: "/ajax/back.php", 1356 data: str, 1357 success: function (returns) { 1358 if ($(".js-GoodsInBasket").length) $(".js-GoodsInBasket").html(returns.COUNT); 1359 if ($(".js-GoodsInBasket_text").length) 1360 $(".js-GoodsInBasket_text").html(returns.COUNT_TEXT); 1361 if ($(".js-PricesInBasket").length) $(".js-PricesInBasket").html(returns.SUM); 1362 1363 CheckActive($(".js-GoodsInBasket")); 1364 1365 if (returns.MIND_JS) { 1366 $(".js-mindbox_cart").append(returns.MIND_JS); 1367 } 1368 1369 submitForm(); 1370 }, 1371 }); 1372 1373 return false; 1374 }); 1375 1376 function ChangeItog() { 1377 let _sum_all = 0; 1378 $(".js-product__row").each(function () { 1379 let _tov = $(this); 1380 let _kol = _tov.find(".js-change input").val(); 1381 1382 let _price = _tov.find(".js-change input").data("price"); 1383 let _sum = parseInt(_kol) * parseInt(_price); 1384 1385 _sum_all = parseInt(_sum_all) + parseInt(_sum); 1386 _tov.find(".js-sum").html(sdf_FTS(_sum, 0, " ") + " ÑÑб."); 1387 }); 1388 1389 $(".js-sum_all").html(sdf_FTS(_sum_all, 0, " ") + " ÑÑб."); 1390 } 1391 1392 1393 1394 1395 $('body').on('click','.js-cupon__go', function() { 1396 1397 let data = 'action=CUPON_SET&PROMO_CODE='+$('.js-cupon_code').val(); 1398 $.ajax({ 1399 type: "POST", 1400 dataType: "json", 1401 url: "/ajax/back.php", 1402 data: data, 1403 success: function(returns) { 1404 1405 if(returns.HTML) { 1406 globalPopup.options({ 1407 closeButtons: '.js-close, .js-popup-close', 1408 closeShow: true, 1409 }).html(returns.HTML).show(); 1410 } 1411 1412 if(returns.SUCCESS == 'Y') { 1413 //console.log('refresh after'); 1414 submitForm(); 1415 } 1416 1417 } 1418 }); 1419 1420 return false; 1421 }); 1422 1423 /* #################################### ÐоÑзина End ################################### */ 1424});
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.