1(function guardExternalCacheHistoryNavigation() { 2 var hostname = String(window.location.hostname || '').toLowerCase().replace(/\.$/, ''); 3 var isProjectHostname = hostname === 'mledy.ru' 4 || hostname === 'mledy.kz' 5 || hostname.endsWith('.mledy.ru') 6 || hostname.endsWith('.mledy.kz'); 7 8 if (isProjectHostname || !window.history || typeof window.history.replaceState !== 'function') { 9 return; 10 } 11 12 var nativeReplaceState = window.history.replaceState; 13 window.history.replaceState = function (state, title, url) { 14 if (typeof url === 'string' && url !== '') { 15 try { 16 var targetUrl = new URL(url, document.baseURI); 17 var targetHostname = String(targetUrl.hostname || '').toLowerCase().replace(/\.$/, ''); 18 var targetsProject = targetHostname === 'mledy.ru' 19 || targetHostname === 'mledy.kz' 20 || targetHostname.endsWith('.mledy.ru') 21 || targetHostname.endsWith('.mledy.kz'); 22 23 // An external cache/proxy may inject <base> for the original page. 24 // Do not let History API resolve its local endpoint onto the project origin. 25 if (targetsProject && targetUrl.origin !== window.location.origin) { 26 return; 27 } 28 } catch (error) { 29 // Preserve the browser's native behaviour for malformed or unsupported URLs. 30 } 31 } 32 33 return nativeReplaceState.apply(this, arguments); 34 }; 35})(); 36 37/*$('[rel="popover"]').popover({ 38 container: 'body', 39 html: true, 40 content: function () { 41 var clone = $($(this).data('popover-content')).clone(true).removeClass('hidden'); 42 return clone; 43 } 44});*/ 45 46 47// Modal 48$('.modal[data-backdrop-visible="true"]').on('show.bs.modal', function (e) { 49 $('body').addClass('modal-backdrop-visible'); 50}); 51 52$('.modal[data-backdrop-visible="true"]').on('hidden.bs.modal', function (e) { 53 $('body').removeClass('modal-backdrop-visible'); 54}); 55 56 57//Custom script for search 58 59var Search = (function() { 60 var searchLink = $('#search'); 61 //var searchBlock = $('#search-block'); 62 var searchClose = $('#search-close'); 63 64 return { 65 initToggle : function() { 66 searchLink.on('click', function () { 67 $("#search-block").load("/ajax/search.php", function() { 68 $('#search-block').toggle(); 69 }); 70 }); 71 }, 72 73 initClickOutside : function() { 74 $(document).on('click', function (event) { 75 var searchBlock = $('#search-block'); 76 var target = event.toElement || event.relatedTarget; 77 if (target && searchBlock.get(0) && (target.id == searchBlock.get(0).id)) 78 return; 79 80 if ($.contains(searchBlock.get(0), target)) 81 return; 82 83 searchBlock.hide(); 84 //$('.title-search-result').css("visibility", "hidden"); 85 }) 86 }, 87 88 initClickClose : function() { 89 $('#search-close').on('click', function () { 90 $('#search-block').hide(); 91 $('.title-search-result').css("display", "none"); 92 }); 93 } 94 } 95}()); 96 97$(function() { 98 //Search.initToggle(); 99 $('#search').on('click', function () { 100 $("#search-block").load("/ajax/search.php", function() {}); 101 $('#search-block').css("display", "block"); 102 }); 103 //Search.initClickOutside(); 104 //Search.initClickClose(); 105}); 106 107//main template 108 109$("input[name='ELEMENT[NAME]']").on('keyup', function(){ 110 $(".btn.btn-review").removeAttr("disabled").removeClass("btn-disabled"); 111}); 112$("textarea[name='ELEMENT[PREVIEW_TEXT]']").on('keyup', function(){ 113 $(".btn.btn-review").removeAttr("disabled").removeClass("btn-disabled"); 114}); 115$(".btn.btn-review").on('click', function(){ 116 //all inputs (without files) 117 var data = $(this).parents('form').serialize(); 118 119 //files input 120 var formElement = document.getElementById("card-review-form"); 121 var formData = new FormData(formElement); 122 123 //save review 124 $.ajax({
125 url: "/ajax/review.php", 126 type: 'POST', 127 data: formData, 128 processData: false, 129 contentType: false, 130 success: function(res) { 131 $("#result_review").html(res); 132 if (res.indexOf("green") == '-1') {$(".btn.btn-review").attr("disabled", "disabled").addClass("btn-disabled");} 133 } 134 }); 135}); 136$(".icons.icon-close, .modal-content button.btn").on('click', function(){ 137 $('.ys-geoip-mask').css("display", "none"); 138}); 139$("h4.toggle").on('click', function(){ 140 var ul = $(this).next("ul"); 141 if (ul.css("display") == 'none') {ul.removeClass("hidden"); $(this).addClass('active');} else {ul.addClass("hidden"); $(this).removeClass('active');} 142 return false; 143}); 144$("a.btn_favorite, a.btn_st_favorite, div.block_product_t2__favorite").on('click', function(){ 145 var item = $(this).attr("item"); 146 var action = $(this).attr("action"); 147 $.ajax({ 148 url: "/ajax/bookmarks.php", 149 data: "add_bookmark="+item+"&action="+action 150 }).done(function(res) { 151 var arRes = res.split(';'); 152 $(".block_icon_count.favorite .d_count").html(arRes[0]+' <span>ÑÑ</span>'); 153 if($("a.btn_favorite").length) 154 { 155 $("a.btn_favorite[item='"+item+"']").attr("action", arRes[1]); 156 $("a.btn_favorite[item='"+item+"'] span.action-txt").html(arRes[2]); 157 } 158 else 159 { 160 $("a.btn_st_favorite[item='"+item+"']").attr("action", arRes[1]); 161 $("a.btn_st_favorite[item='"+item+"'] span.action-txt").html(arRes[2]); 162 } 163 164 }); 165 return false; 166}); 167 168 169 170$("a.btn_st_favorite_bookmarks").on('click', function(){ 171 var item = $(this).attr("item"); 172 var action = $(this).attr("action"); 173 var $button = $(this); 174 $.ajax({ 175 url: "/ajax/bookmarks.php", 176 data: "add_bookmark="+item+"&action="+action 177 }).done(function(res) { 178 var arRes = res.split(';'); 179 $(".block_icon_count.favorite .d_count").html(arRes[0]+' <span>ÑÑ</span>'); 180 $(".profile_order__header .d_title span").html(arRes[0]); 181 if($("a.btn_favorite").length) 182 { 183 $("a.btn_favorite[item='"+item+"']").attr("action", arRes[1]); 184 $("a.btn_favorite[item='"+item+"'] span.action-txt").html(arRes[2]); 185 } 186 else 187 { 188 $("a.btn_st_favorite[item='"+item+"']").attr("action", arRes[1]); 189 $("a.btn_st_favorite[item='"+item+"'] span.action-txt").html(arRes[2]); 190 } 191 192 var $productCard = $button.closest('.cart_item_bay__info').parent(); 193 194 // If we can't find it that way, try finding by the specific structure 195 if ($productCard.length === 0) { 196 // Try to find the main cart item container 197 $productCard = $button.closest('[data-entity="item"]'); 198 } 199 200 // If still not found, try a more general approach - go up 3-4 levels 201 if ($productCard.length === 0) { 202 $productCard = $button.closest('.cart_item_bay__control').parent(); 203 } 204 $productCard.remove(); 205 206 }); 207 return false; 208}); 209 210 211// СамÑй пÑоÑÑой ваÑÐ¸Ð°Ð½Ñ - еÑли даÑÑ ÐºÐ½Ð¾Ð¿ÐºÐµ клаÑÑ 212$('.d_btn_remove').on('click', function(){ 213 $("a.btn_st_favorite_bookmarks").each(function() { 214 var $button = $(this); 215 216 $.ajax({ 217 url: "/ajax/bookmarks.php", 218 data: "add_bookmark=" + $button.attr("item") + "&action=" + $button.attr("action") 219 }).done(function(res) { 220 var arRes = res.split(';'); 221 $(".block_icon_count.favorite .d_count").html(arRes[0]+' <span>ÑÑ</span>'); 222 $(".profile_order__header .d_title span").html(arRes[0]); 223 var $productCard = $button.closest('.cart_item_bay__info').parent(); 224 225 // If we can't find it that way, try finding by the specific structure 226 if ($productCard.length === 0) { 227 // Try to find the main cart item container 228 $productCard = $button.closest('[data-entity="item"]'); 229 } 230 231 // If still not found, try a more general approach - go up 3-4 levels 232 if ($productCard.length === 0) { 233 $productCard = $button.closest('.cart_item_bay__control').parent(); 234 } 235 $productCard.remove(); 236 }); 237 }); 238 239 return false;
240}); 241 242function delayBasketProduct(element) { 243 let item = $(element).attr("item"); 244 let action = $(element).attr("action"); 245 let modalDelayProduct = document.querySelector('.modal-delay__product'); 246 modalDelayProduct.textContent = ''; 247 modalDelayProduct.insertAdjacentHTML('afterbegin', 248 $(element).attr("first-name") + 249 ' / ' + 250 '<a href="'+$(element).attr("product")+'">' + 251 $(element).attr("code") + 252 '</a>'); 253 $.ajax({ 254 url: "/ajax/bookmarks.php", 255 data: "add_bookmark="+item+"&action="+action 256 }).done(function(res) { 257 element.closest('tr').remove(); 258 let arRes = res.split(';'); 259 let drop = $(element).attr("drop"); 260 if (arRes[2] && drop) { 261 $.ajax({url: drop}) 262 $(".js-header-bookmarks-count").html(arRes[0]); 263 } 264 if (basketPoolQuantity.isProcessing()) 265 { 266 return false; 267 } 268 269 BX.showWait(); 270 271 var property_values = {}, 272 action_var = BX('action_var').value, 273 items = BX('basket_items'), 274 delayedItems = BX('delayed_items'), 275 postData, 276 i; 277 278 postData = { 279 'sessid': BX.bitrix_sessid(), 280 'site_id': BX.message('SITE_ID'), 281 'props': property_values, 282 'action_var': action_var, 283 'select_props': BX('column_headers').value, 284 'offers_props': BX('offers_props').value, 285 'quantity_float': BX('quantity_float').value, 286 'price_vat_show_value': BX('price_vat_show_value').value, 287 'hide_coupon': BX('hide_coupon').value, 288 'use_prepayment': BX('use_prepayment').value 289 }; 290 postData[action_var] = 'recalculate'; 291 292 if (!!items && items.rows.length > 0) 293 { 294 for (i = 1; items.rows.length > i; i++) 295 postData['QUANTITY_' + items.rows[i].id] = BX('QUANTITY_' + items.rows[i].id).value; 296 } 297 298 if (!!delayedItems && delayedItems.rows.length > 0) 299 { 300 for (i = 1; delayedItems.rows.length > i; i++) 301 postData['DELAY_' + delayedItems.rows[i].id] = 'Y'; 302 } 303 304 basketPoolQuantity.setProcessing(true); 305 basketPoolQuantity.clearPool(); 306 307 BX.ajax({ 308 url: '/personal/cart/ajax.php', 309 method: 'POST', 310 data: postData, 311 dataType: 'json', 312 onsuccess: function(result) 313 { 314 BX.closeWait(); 315 basketPoolQuantity.setProcessing(false); 316 317 if (basketPoolQuantity.isPoolEmpty()) 318 { 319 updateBasketTable(null, result); 320 basketPoolQuantity.updateQuantity(); 321 } 322 else 323 { 324 basketPoolQuantity.enableTimer(true); 325 } 326 let itemsQty = document.querySelectorAll('.table.table-basket tr[data-item-name]'); 327 if (itemsQty) { 328 document.querySelector('#normalCount b').textContent = document.querySelector('#normalCount2 b').textContent = itemsQty.length 329 } else { 330 document.querySelector('#normalCount b').textContent = document.querySelector('#normalCount2 b').textContent = 0 331 } 332 } 333 }); 334 }); 335 return false; 336} 337 338if ($.isFunction($.fn.fancybox)) { 339 $("a.fancybox").fancybox({ 340 transitionIn: 'elastic', 341 transitionOut: 'elastic', 342 fitToView : true, 343 autoSize : true, 344 closeClick : false, 345 openEffect : 'none', 346 closeEffect : 'none' 347 }); 348 $("a.fancybox-ajax").fancybox({ 349 width : 817, 350 height : 427, 351 fitToView : true, 352 autoSize : true, 353 type: 'ajax', 354 }); 355 $("a.fancybox-ajax-right").fancybox({ 356 'width' : '400', 357 'maxWidth': '100%', 358 'height' : '80', 359 'autoDimensions': false, 360 'fitToView' : false, 361 'autoSize' : false, 362 'type': 'ajax', 363 'afterLoad': function() { 364 $(".fancybox-wrap").addClass('fancyright'); 365 } 366 }); 367} 368 369 370 371$(".link-up-bord").on('click', function(){ 372 var yet = $(".row.yet"); 373 if (yet.css("display") == 'none') 374 { 375 yet.removeClass('hidden'); 376 //$(this).remove(); 377 return false;
378 } 379 else 380 { 381 yet.addClass('hidden'); 382 //$(this).remove(); 383 return false; 384 } 385}); 386 387/*$(document).ready(function(){ 388 var lazyLoadInstance = new LazyLoad({ 389 elements_selector: ".lazyload" 390 }); 391});*/ 392 393$(document).on("click.bs.dropdown.data-api", ".noclose li a", function (e) { e.stopPropagation() }); 394 395 396 397 398 399 400 401 402 403 404//catalog.section template 405function sectcolor(id) { 406 var element = $("li#"+id); 407 var src = element.attr("img"); 408 var color = element.attr("color"); 409 var href = element.parents(".sect-item").children("a").attr("href"); 410 var arHref = href.split("?"); 411 href = arHref[0] + "?color=" + color; 412 element.parents(".sect-item").children("a").attr("href", href); 413 element.parents(".sect-item").find("div.item-link a").attr("href", href); 414 element.parents(".sect-item").children("a").children("span").attr("color", color); 415 var sizes = $(this).attr("size"); 416 element.parents(".sect-item").find(".product-item-image-original").css("background-image","url("+src+")"); 417 element.parents(".sect-item").find(".product-item-image-original").children("span").html(sizes); 418} 419 420function sectcolor2(id) { 421 var element = $("li#"+id); 422 var src = element.attr("data-first-img"); 423 var secSrc = element.attr('data-second-img'); 424 element.parents(".sect-item").find(".product-item-image-original .first-image").attr('src', src); 425 element.parents(".sect-item").find(".product-item-image-original .second-image").attr('src', secSrc); 426 var color = element.attr("color"); 427 element.parents(".sect-item").find(".product-item-image-original").children("span").attr("color", color); 428} 429 430// Filter 431$(document).ready(function() { 432 433 if ($('.block_promocode').length) { 434 $('.block_promocode .field_set__input').on('input', function(e){ 435 if ($(this).val().length > 0) { 436 $(this).closest('.field_set').find('.btn').addClass('active'); 437 } else { 438 $(this).closest('.field_set').find('.btn').removeClass('active'); 439 } 440 }); 441 } 442 443 $("body").bind("click", function(e) { 444 var div1 = $(".itemfilter"); // ÑÑÑ ÑказÑваем ID ÑлеменÑа 445 var div2 = $(".workfilter"); // ÑÑÑ ÑказÑваем ID ÑлеменÑа 446 if (!div1.is(e.target) & div1.has(e.target).length === 0 & !div2.is(e.target) & div2.has(e.target).length === 0) { // еÑли клик бÑл не по наÑÐµÐ¼Ñ Ð±Ð»Ð¾ÐºÑ Ð¸ не по его поÑомкам 447 $(".popup-ftr").css("display", "none"); // ÑкÑÑваем его 448 } 449 }); 450 451 //$("input[type=checkbox]").prop('checked', false); 452 453 $(window).scroll(function(){ 454 var liopenlen = $("ul.navbar-nav.main-menu.main-menu-card").children("li.open").length; 455 if ($(this).scrollTop() > 500 & liopenlen == 0){ 456 $("div.filter").addClass("navbar-fixed-top"); 457 } 458 else { 459 $("div.filter").removeClass("navbar-fixed-top"); 460 } 461 }); 462 463 464 465 $(".sect-filter>li>div>a").on("click", function(){ 466 var display = $(this).next().next().css("display"); 467 $(".popup-ftr").hide(); 468 $(".itemfilter").find("span").removeClass("icon-down-blue"); 469 if (display == 'none') {$(this).next().next().toggle(); $(this).next().toggleClass("icon-down-blue");} 470 }); 471 472 $(".popup-ftr label").on("click", function(){ 473 $(this).parent().toggleClass('act'); 474 }); 475 476 $(".filter_checked input").unbind("click").on("change", function(){ 477 478 setTimeout(function(){ 479 $('div.apply > a.btn').trigger('click'); 480 }, 2000); 481 }); 482 483 484 $(".filter_button_add.sort").unbind("click").on("click", function(){ 485 486 var sort = $('input[name="filter_sort"]:checked').attr("sort"); 487 var sort_name = $('input[name="filter_sort"]:checked').attr("sort_name"); 488 //var sortval = $(this).text(); 489 //$(".sort").removeClass("active"); 490 // $(this).addClass("active"); 491 // $("#dropdownColor").html(sortval); 492 /*ajax start*/ 493 //$(this).parents(".custom-select-field").removeClass("open"); 494 //$(this).parents(".filter_item").children().hide(); 495 $("#d_label_active_sm").html(sort_name); 496 $("#section").addClass("yes-opacity"); 497 var href = $(".bx-filter-popup-result a").attr("href"); 498 //location.href = href; 499 href = href + '&ajaxcat=1' + '&sort='+sort; 500 //history.pushState('', '', href); 501 var arHref = href.split('?'); 502 503 $.ajax({ 504 url: arHref[0], 505 data: arHref[1] 506 }).done(function(res) { 507 508 var section = $("#section"); 509 // var scroll = section.offset(); 510 // $("body,html").scrollTop(486); 511 section.removeClass("yes-opacity"); 512 section.html(res); 513 styler_section(); 514 515 }); 516 /*ajax end*/ 517 return false;
518 }); 519 $(".btn.w-100").unbind("click").on("click", function(){ 520 var url = $(this).attr("url"); 521 var active = $(this).attr("active"); 522 if (active == 'Y') 523 { 524 //url = url.replace('amp;',''); 525 var sort = $('input[name="filter_sort"]:checked').attr("sort"); 526 527 var favorite = []; 528 var code = $(this).parents("div.filter_item__toggler").find("input").attr("code"); 529 //$.each($("input[name='check']:checked"), function() { 530 //favorite.push($(this).val()); 531 //}); 532 var ch = $(this).parents("li"); 533 ch.children(".filter_item").children(".filter_item__toggler").children("label").children("input[code='"+code+"']:checked").each(function(){ 534 var val = $(this).next("label").find(".d_text").attr("title"); 535 favorite.push(val); 536 }); 537 538 $(this).parents(".filter_item").children().hide(); 539 540 var podpis = ch.children(".filter_item").children("div").html(); 541 ch.children(".workfilter").children(".block-wh").html(podpis+", вÑбÑано: "+favorite.length); 542 ch.children(".workfilter").show(); 543 544 /*ajax start*/ 545 $("#section").addClass("yes-opacity"); 546 //var href = $(".bx-filter-popup-result a").attr("href"); 547 var href = url; 548 if (href.indexOf('?') == '-1') {href = href + '?ajaxcat=1&sort='+sort;} 549 else {href = href + '&ajaxcat=1&sort='+sort;} 550 history.pushState('', '', href.replace('ajaxcat=1&','')); 551 var arHref = href.split('?'); 552 553 $.ajax({ 554 url: arHref[0], 555 data: arHref[1] 556 }).done(function(res) { 557 var section = $("#section"); 558 //var scroll = section.offset(); 559 // $("body,html").scrollTop(486); 560 section.removeClass("yes-opacity"); 561 section.html(res); 562 styler_section(); 563 initGallerySwiper(); 564 }); 565 /*ajax end*/ 566 } 567 }); 568 569 function styler_section() 570 { 571 const sort_select = $('.js-filter-col-product'); 572 const catalog_wrap = $('.catalog_page__content'); 573 const mediaQuerySort = window.matchMedia('(min-width: 1280px)') 574 575 if (sort_select) { 576 let check_val =+ sort_select.find('input:checked').val(); 577 catalog_wrap.addClass(`col${check_val}`); 578 if (mediaQuerySort.matches) { 579 sort_select.find('.d_label span').text(check_val + 1); 580 } else { 581 sort_select.find('.d_label span').text(check_val); 582 } 583 584 585 sort_select.find('input').on('change', function(e){ 586 if (mediaQuerySort.matches) { 587 sort_select.find('.d_label span').text(Number($(this).val()) + 1); 588 } else { 589 sort_select.find('.d_label span').text(Number($(this).val())); 590 } 591 592 593 if($(this).prop('checked')) { 594 check_val =+ $(this).val(); 595 catalog_wrap.removeClass(`col1 col2 col3`); 596 catalog_wrap.addClass(`col${check_val}`); 597 } 598 $(this).closest('.filter_item__toggler').slideUp(); 599 }); 600 } 601 $('.swiper-product-gallery').each(function (i, e) { 602 new Swiper(e, { 603 // loop: true, 604 slidesPerView: 1, 605 spaceBetween: 0, 606 607 pagination: { 608 el: e.querySelector('.swiper-bullet-gallery'), 609 type: 'bullets', 610 clickable: true, 611 }, 612 breakpoints: { 613 0: { 614 allowTouchMove: false 615 }, 616 1280: { 617 allowTouchMove: true 618 } 619 } 620 }); 621 }); 622 } 623 624 $(".shut").on("click", function(){ 625 var ch = $(this).parents("li"); 626 ch.children(".workfilter").hide(); 627 ch.children(".itemfilter").children().show(); 628 ch.children(".itemfilter").children("span").removeClass("icon-down-blue"); 629 ch.children(".itemfilter").children(".popup-ftr").hide(); 630 ch.children(".itemfilter").children(".popup-ftr").children("ul").children("li").removeClass('act'); 631 ch.children(".itemfilter").find("input[type=checkbox]").prop('checked', false); 632 //ch.children(".itemfilter").show(); 633 /*ajax start*/ 634 $("#section").addClass("yes-opacity"); 635 var sort = $("a.sort.active").attr("sort"); 636 var href = $("form.smartfilter").serialize(); 637 href = href + '&set_filter=y&ajaxcat=1&sort=' + sort; 638 //history.pushState('', '', href); 639 $.ajax({ 640 url: window.location.pathname, 641 data: href 642 }).done(function(res) { 643 var section = $("#section"); 644 var scroll = section.offset(); 645 $("body,html").scrollTop(486); 646 section.removeClass("yes-opacity"); 647 section.html(res); 648 }); 649 /*ajax end*/ 650 }); 651 652 $(".workfilter .block-wh").on("click", function(){ 653 $(this).parents(".workfilter").prev(".itemfilter").children(".popup-ftr").toggle(); 654 }); 655}); 656 657// Mob filter 658$(document).ready(function() { 659 $(".mob-filter>a").on("click", function(){ 660 $(this).parent().next(".filter").toggle(); 661 }); 662}); 663 664//Card 665$(".btns-card__line__box a").on('click', function () { 666 var span = $(".bx_size .dropdown-menu li.bx_active span"); 667 var title = span.html(); 668 $(".setsize").html(title); 669}); 670 671 672 673$(document).ready(function() { 674 $(document).on('click', '.bx_slider_conteiner .product-image-list li', function(){ 675 }); 676 setDopPhoto($('.bx_bigimages .bx_slider_conteiner:visible .product-image-list li').eq(0)); 677 setAccessories($('.custom-select-field.bx_scu li.bx_active')); 678 $(document).on('click', '.custom-select-field.bx_scu li', function(){ 679 setDopPhoto($('.bx_bigimages .bx_slider_conteiner:visible .product-image-list li').eq(0)); 680 setAccessories($(this)); 681 }); 682 let a_width = 0; 683 $.each($('#carousel-product-one .owl-item.active'), function(){ 684 a_width += $(this).width(); 685 }); 686 if(a_width <= 155*4) { 687 $('#carousel-product-one').parent().find('.arrow-right').hide(); 688 } 689 690}); 691function setDopPhoto(__this){ 692 $(".owl-pagination").children(".owl-page").eq(0).trigger('click'); 693 694 let n = __this.index() + 1; 695 let src = __this.find("img").attr("src"); 696 if (!src) { 697 return; 698 } 699 let arSrc = src.split('/'); 700 let dopphoto = arSrc[4]; 701 $(".inmodel").each(function(){ 702 703 }); 704 $('#carousel-product-one').parent().find('.arrow-right').show(); 705 let a_width = 0; 706 setTimeout(function(){ 707 $.each($('#carousel-product-one .owl-item.active'), function(){ 708 a_width += $(this).width(); 709 }); 710 if($('#carousel-product-one .owl-item.active').length <= 4) { 711 $('#carousel-product-one').parent().find('.arrow-right').hide(); 712 $('#carousel-product-one').parent().find('.arrow-left').hide(); 713 } 714 if(a_width == 0) { 715 $('#carousel-product-one').parent().find('.arrow-left').hide(); 716 } 717 }, 500); 718 719 720} 721 722function setAccessories(__this){ 723 var obj = __this.find("span"); 724 if (obj.length > 0) 725 { 726 var rgb = __this.find("span").attr("color_rgb"); 727 $("img.dopaccessories.noobraz").parents(".owl-item").css("display", "none").removeClass('active'); 728 $("img.dopaccessories.noobraz.available[rgb='"+rgb+"']").parents(".owl-item").css("display", "block").addClass('active'); 729 730 $("img.dopaccessories.noobraz").css("display", "none"); 731 $(".inmodel").each(function(){ 732 $(this).find("img.dopaccessories.noobraz.available[rgb='"+rgb+"']").eq(0).css("display", "block"); 733 }); 734 735 $('#carousel-product-one').parent().find('.arrow-right').show(); 736 let a_width = 0; 737 $.each($('#carousel-product-one .owl-item.active'), function(){ 738 a_width += $(this).width(); 739 }); 740 if(a_width <= 155*4) { 741 $('#carousel-product-one').parent().find('.arrow-right').hide(); 742 } 743 } 744} 745 746/*const windowWidthLaptop = 1280; 747const windowWidthTablet = 767; 748 749function fixBodyPopup() { 750 if(window.innerWidth > windowWidthLaptop) { 751 $('body').css({ 752 'overflow': 'hidden', 753 'margin-right': window.innerWidth - $('body').innerWidth() + 'px', 754 }); 755 } else { 756 let scrollPosition = window.pageYOffset || document.documentElement.scrollTop; 757 $('html').css('overflow', 'hidden'); 758 document.body.setAttribute('data-body-scroll-fix', scrollPosition); 759 document.body.style.top = '-' + scrollPosition + 'px'; 760 } 761} 762 763function unfixBodyPopup() { 764 if(window.innerWidth > windowWidthLaptop) { 765 $('body').css({ 766 'overflow': '', 767 'margin-right': '' 768 }); 769 } else { 770 let scrollPosition = document.body.getAttribute('data-body-scroll-fix'); 771 $('html').css('overflow', ''); 772 document.body.style.top = ''; 773 window.scroll(0, scrollPosition); 774 } 775} 776*/ 777const ReserveBasketController = { 778 sendRequest: function(data, callback) { 779 const that = this; 780 $.ajax({ 781 url: '/ajax/reserve.php', 782 data: data, 783 success: function (response) { 784 if (response.PRODUCTS_COUNT) { 785 that.refreshCounter(response.PRODUCTS_COUNT); 786 } 787 if (callback) { 788 callback(response); 789 } 790 } 791 }); 792 }, 793 refreshCounter: function (counterValue) { 794 $('.block_icon_count.reserve .d_left .d_count').html(counterValue+ ' <span>ÑÑ</span>'); 795 }, 796 addProduct: function (productID, store, callback) { 797 const that = this; 798 that.sendRequest({ 799 type: 'add', 800 product: productID, 801 store: store, 802 }, callback); 803 }, 804 changeProduct: function (productID, quantity, store, callback) { 805 const that = this; 806 that.sendRequest({ 807 type: 'change', 808 product: productID, 809 quantity: quantity, 810 store: store, 811 }, callback); 812 }, 813 deleteProduct: function (productID, callback) { 814 const that = this; 815 that.sendRequest({ 816 type: 'delete', 817 product: productID, 818 }, callback); 819 }, 820 moveToOneStore: function (store, callback) { 821 const that = this; 822 that.sendRequest({ 823 type: 'moveToOneStore', 824 store: store, 825 }, callback); 826 },
827 restoreProduct: function (productID, store, quantity, callback) { 828 const that = this; 829 that.sendRequest({ 830 type: 'add', 831 product: productID, 832 store: store, 833 quantity: quantity, 834 }, callback); 835 }, 836 deleteByStore: function (store, callback) { 837 const that = this; 838 that.sendRequest({ 839 type: 'deleteByStore', 840 store: store, 841 }, callback); 842 }, 843 showMainAddButtonError: function (message) { 844 $('.js-reserve-button-error-message').html(message); 845 $('.js-reserve-button-error-message').show(); 846 }, 847 hideMainAddButtonError: function () { 848 $('.js-reserve-button-error-message').hide(); 849 }, 850 showOtherAddButtonError: function (message) { 851 $('.js-reserve-other-button-error-message').html(message); 852 $('.js-reserve-other-button-error-message').show(); 853 }, 854 hideOtherAddButtonError: function () { 855 $('.js-reserve-other-button-error-message').hide(); 856 }, 857 initOnPageLoad: function () { 858 859 } 860}; 861 862 863 864$('.js-popup-close').on('click', function(e) { 865 e.preventDefault(); 866 $.magnificPopup.close(); 867}); 868$('body').on('click', '.js-open-modal-reserve', function (event) { 869 870 event.preventDefault(); 871 ReserveBasketController.hideOtherAddButtonError(); 872 ReserveBasketController.hideMainAddButtonError(); 873 const shop = $(this); 874 if (!shop.length) { 875 let cityCode = $('.js-shop-city-filter.active').data('city-filter'); 876 let shopsCount = $('.js-shop-table__item[data-shop-city=' + cityCode + ']').length; 877 if (shopsCount <= 0) { 878 ReserveBasketController.showMainAddButtonError($(this).data('error-message-no-shop-in-city')); 879 } 880 return false; 881 } 882 const shopID = shop.data('product-store'); 883 const productID = shop.data('product-id'); 884 ReserveBasketController.addProduct(productID, shopID, function (response) { 885 if (!response.ok) { 886 ReserveBasketController.showMainAddButtonError(response.message); 887 return; 888 } 889 if (response.productData) { 890 891 $('#added-to-reserve-cart').find('.js-reserve-window-shop-name').html('Ð¢Ð¾Ð²Ð°Ñ Ð·Ð°Ð±ÑониÑован в '+response.productData.shopName); 892 $('#added-to-reserve-cart').find('.js-reserve-window-product-image img').attr("src", response.productData.imageSrc); 893 $('#added-to-reserve-cart').find('.js-reserve-window-product-name').html(response.productData.name); 894 $('#added-to-reserve-cart').find('.js-reserve-window-product-color').html(response.productData.color); 895 $('#added-to-reserve-cart').find('.js-reserve-window-product-size').html(response.productData.size); 896 $('#added-to-reserve-cart').find('.js-reserve-window-product-quantity').html(response.productData.artnumber); 897 $('#added-to-reserve-cart').find('.js-reserve-window-product-price-base').html(response.productData.priceBase); 898 if(parseInt(response.productData.pricediscountpercent)>0) 899 { 900 $('#added-to-reserve-cart').find('.js-reserve-window-product-price-full').html(response.productData.priceFull+'<b>-'+response.productData.pricediscountpercent+'%</b>'); 901 } 902 else 903 { 904 $('#added-to-reserve-cart').find('.js-reserve-window-product-price-full').html(response.productData.priceFull); 905 } 906 907 //$('#added-to-reserve-cart').find('.js-reserve-window-product-price-percent').html(response.productData.pricediscountpercent); 908 909 $('.js-reserve-window-other-product').hide(); 910 $('.js-reserve-window-other-product-add-button').html( 911 $('.js-reserve-window-other-product-add-button').data('state-word-add') 912 ); 913 if (response.productData.otherOffers && response.productData.otherOffers.length) { 914 $('.js-reserve-window-other-product-block').show(); 915 response.productData.otherOffers.forEach(function (otherProduct, index) { 916 const otherProductBlock = $('.js-reserve-window-other-product[data-other-product-number=' + index + ']'); 917 if (!otherProductBlock) { 918 return; 919 } 920 otherProductBlock.find('.js-reserve-window-other-product-name').html(response.productData.productName); 921 otherProductBlock.find('.js-reserve-window-other-product-size').html(otherProduct.SIZES_CLOTHES); 922 otherProductBlock.find('.js-reserve-window-other-product-add-button').data('product-id', otherProduct.ID); 923 otherProductBlock.find('.js-reserve-window-other-product-add-button').data('product-store', otherProduct.STORE_ID); 924 otherProductBlock.show(); 925 }); 926 } else { 927 $('.js-reserve-window-other-product-block').hide(); 928 } 929 } 930 /*$.magnificPopup.open({ 931 items: { 932 src: '#added-to-reserve-cart' 933 }, 934 type: 'inline', 935 mainClass: 'mfp-fade', 936 preloader: false,
937 fixedContentPos: false, 938 callbacks: { 939 open: function () { 940 fixBodyPopup(); 941 }, 942 close: function () { 943 unfixBodyPopup(); 944 } 945 }, 946 }); 947 setTimeout(function () { 948 $('body > div.mfp-wrap.mfp-close-btn-in.mfp-auto-cursor.mfp-fade.mfp-ready') 949 .css('overflow', 'hidden auto'); 950 }, 10);*/ 951 952 }); 953}); 954$('body').on('click', '.js-reserve-window-other-product-add-button', function (event) { 955 event.preventDefault(); 956 ReserveBasketController.hideOtherAddButtonError(); 957 ReserveBasketController.hideMainAddButtonError(); 958 const that = this; 959 const product = $(that).data('product-id'); 960 const store = $(that).data('product-store'); 961 if (!product || !store) { 962 return; 963 } 964 ReserveBasketController.addProduct(product, store, function (response) { 965 if (!response.ok) { 966 ReserveBasketController.showOtherAddButtonError(response.message); 967 return; 968 } 969 $(that).html($(that).data('state-word-added')); 970 }); 971}); 972/*$(document).ready(function () { 973 $('.select-custom').selectric({ 974 disableOnMobile: false, 975 nativeOnMobile: false 976 }); 977 978 $('.select-custom-light').selectric({ 979 disableOnMobile: false, 980 nativeOnMobile: false 981 }); 982 983 $('.js-menu-toggle').on('click', function(e) { 984 e.preventDefault(); 985 $(this).toggleClass('open'); 986 $('.js-header-menu').toggleClass('open'); 987 988 if($(this).hasClass('open')) { 989 fixBodyPopup(); 990 } else { 991 unfixBodyPopup(); 992 } 993 }); 994 995});*/ 996/*const YandexMapController = { 997 createStorePlaceMark: function (storeData) { 998 const placemark = new ymaps.Placemark( 999 [storeData.GPS_X, storeData.GPS_Y], 1000 { 1001 balloonContentBody: [ 1002 "<b>" + storeData.NAME + "</b>", 1003 'ФиÑменнÑй магазин', 1004 storeData.ADDRESS, 1005 storeData.PHONE, 1006 '', 1007 storeData.SCHEDULE 1008 ].join('<br>'), 1009 }, 1010 { 1011 iconColor: '#f371d1', 1012 } 1013 ); 1014 placemark.storeID = storeData.ID; 1015 placemark.events.add('click', function (event) { 1016 $('[id^=map_reserve-shop]').prop('checked', ''); 1017 $('#map_reserve-shop-' + placemark.storeID).prop('checked', 'checked'); 1018 }); 1019 return placemark; 1020 }, 1021 clearAllPlacemarks: function (map) { 1022 map.geoObjects.removeAll(); 1023 }, 1024 addPlacemarkOnMap: function(map, placemark) { 1025 map.geoObjects.add(placemark); 1026 }, 1027}*/ 1028 1029//ncheremisin 1030$(document).on('click', '.btn-digift', function(e) { 1031 e.preventDefault(); 1032 $.ajax({ 1033 type: "POST", 1034 url: '/js/digift.php', 1035 data: {'code': '8291451149098137', 'pin': '6122', 'price': $('.basket-price').text(), 'payment': '1'}, 1036 success: function(data){ 1037 $('.data-digift').html(data); 1038 } 1039 }); 1040}); 1041$(document).ready(function() { 1042 1043$(document).on('click', '.js-btn-auth-default-open-reg', function(e){ 1044 e.preventDefault(); 1045 //показÑваем окно ÑоÑÐ¼Ñ 1046 $('#reg_modal_first').fadeIn(100); 1047 $('#auth_modal_first').fadeOut(200); 1048 1049/* 1050 //console.log($(this).attr('href')); 1051 //ÐТкÑÑваем ajax ÑÑÑаниÑÑ 1052 $.ajax( 1053 { 1054 url: $(this).attr('href') 1055 } 1056 ).done(function(response) { 1057 // ÐаÑÑим. Ðам нÑжна ÑолÑко конÑенÑÐ½Ð°Ñ ÑаÑÑÑ ÑÑÑаниÑÑ 1058 var result = $(response).find('.content'); 1059 //добавлÑем во нÑÑÑÑ Ð¾ÐºÐ½Ð°. 1060 $('#reg_modal_first').fadeIn(100); 1061 $('#dform-content').html(result).promise().done(function(){ 1062 // оживлÑем ÑоÑмÑ, ÑÑÐ¾Ð±Ñ ÑабоÑали ÑеÑез Ajax. 1063 // инаÑе пÑи нажаÑии кнопок бÑÐ´ÐµÑ Ð¿ÐµÑекидÑваÑÑ Ð½Ð° ÑÑÑаниÑÑ. 1064 aliveFomrs(); 1065 }); 1066 });*/ 1067 1068}); 1069 1070 1071});
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.