1BX.Aspro.Utils.readyDOM(function () { 2 // --- Bind mobile menu --- 3 let $mobileMenu = $("#mobilemenu"); 4 let $mobileMenuNlo; 5 if ($mobileMenu.length) { 6 $mobileMenu.isOpen = $mobileMenu.hasClass("show"); 7 $mobileMenu.isLeftSide = $("body").hasClass("mmenu_leftside"); 8 $mobileMenuNlo = $mobileMenu.find("[data-nlo]"); 9 10 BX.bindDelegate(document, 'click', {class: 'js-burger'}, function () { 11 SwipeMobileMenu(); 12 CloseMobilePhone(); 13 }); 14 15 BX.bindDelegate(document, 'click', {class: 'mobilemenu__close'}, function() { 16 CloseMobileMenu(); 17 $(".mobilemenu__menu-item").removeClass("mobilemenu__menu-item--expanded"); 18 }); 19 20 $(document).on("click", ".mobilemenu__menu .toggle_block", function (e) { 21 e.stopPropagation(); 22 23 var $this = $(this); 24 var $item = $this.closest(".mobilemenu__menu-item"); 25 26 if ($item.hasClass("mobilemenu__menu-item--parent")) { 27 e.preventDefault(); 28 29 $item.addClass("mobilemenu__menu-item--expanded"); 30 MoveMobileMenuWrapNext(); 31 } 32 }); 33 34 BX.bindDelegate(document, 'click', {class: 'mobilemenu__menu-item-back'}, function() { 35 const nodeItemExpanded = this.closest('.mobilemenu__menu-item--expanded'); 36 MoveMobileMenuWrapPrev(); 37 38 if (nodeItemExpanded) { 39 setTimeout(function () { 40 nodeItemExpanded.classList.remove("mobilemenu__menu-item--expanded"); 41 }, 400); 42 } 43 }); 44 45 $(document).on("click", ".mobilemenu__menu a", function (e) { 46 var $this = $(this); 47 var $item = $this.closest(".mobilemenu__menu-item"); 48 49 const href = $this.attr("href"); 50 if (typeof href !== "undefined") { 51 if (href.length) { 52 window.location.href = href; 53 return; 54 } 55 56 if ($item.hasClass("mobilemenu__menu-item--parent")) { 57 e.preventDefault(); 58 59 $item.addClass("mobilemenu__menu-item--expanded"); 60 MoveMobileMenuWrapNext(); 61 62 return; 63 } 64 65 if ($item.hasClass("mobilemenu__menu-item--title")) { 66 e.preventDefault(); 67 68 return; 69 } 70 } 71 72 CloseMobileMenu(); 73 }); 74 75 if ($mobileMenu.isLeftSide) { 76 $mobileMenu.parent().append('<div class="mobilemenu__overlay"></div>'); 77 var $mobileMenuOverlay = $(".mobilemenu__overlay"); 78 79 $mobileMenuOverlay.click(function () { 80 if ($mobileMenu.isOpen) { 81 CloseMobileMenu(); 82 } 83 }); 84 } else { 85 $(document).on("click", "#mobileheader", function (e) { 86 if ( 87 !$(e.target).closest("#mobilemenu").length && 88 !$(e.target).closest(".burger").length && 89 $mobileMenu.isOpen 90 ) { 91 CloseMobileMenu(); 92 } 93 }); 94 } 95 96 $(document).on('click', '.mobilemenu__menu--regions .menu_autocomplete .clean_icon', function (e) { 97 $(this).closest('.wrapper').find('input[type=text]').val('').trigger('change'); 98 $(this).hide(); 99 }); 100 101 $(document).on('keyup change paste', '.mobilemenu__menu--regions .menu_autocomplete input[type=text]', function (e) { 102 let $btn = $(this).closest('.wrapper').find('.clean_icon'); 103 104 if ($(this).val().length) { 105 $btn.show(); 106 } 107 else { 108 $btn.hide(); 109 110 // hide finded cities 111 $(this).closest('.dropdown').find('.mobile-cities').show().siblings().hide().empty(); 112 } 113 }); 114 115 $(document).on('click', '.mobilemenu__menu-item--city a', function(e) { 116 e.preventDefault(); 117 118 var _this = $(this); 119 120 let regionId = _this.data('id'); 121 if (regionId) { 122 setCookieOnDomains('current_region', regionId); 123 124 let locationId = _this.data('locid'); 125 if (locationId) { 126 setCookieOnDomains('current_location', locationId); 127 } 128 else { 129 setCookieOnDomains('current_location', '', {expires: -1}); 130 } 131 } 132 133 location.href = _this.attr("href"); 134 }); 135 136 OpenMobileMenu = function () { 137 if (!$mobileMenu.isOpen) { 138 // hide styleswitcher 139 if ($(".style-switcher").hasClass("active")) { 140 $(".style-switcher .switch").trigger("click"); 141 } 142 $(".style-switcher .switch").hide(); 143 $(".style-switcher .switch_presets").hide(); 144 145 if ($mobileMenu.isLeftSide) { 146 setTimeout(function () { 147 // hide body scroll 148 $("body").addClass("overflow-block"); 149 150 // blur body 151 $("#mobileheader").addClass("filter-none"); 152 $("#mobilemenu").addClass("filter-none"); 153 $("body").addClass("jqm-initied"); 154 155 // show overlay 156 $mobileMenuOverlay.fadeIn("fast"); 157 }, 100); 158 } else { 159 // hide body scroll 160 $("body").addClass("overflow-block"); 161 162 // set menu top = bottom of header 163 $mobileMenu.css({ 164 top: +($("#mobileheader")[0].getBoundingClientRect().top + $("#mobileheader").height()) + "px", 165 }); 166 167 // change burger icon 168 // $('#mobileheader .burger').addClass('c'); 169 } 170 171 // show menu 172 $mobileMenu.addClass("show"); 173 $mobileMenu.isOpen = true; 174 175 var $inner = $mobileMenu.find(".mobilemenu__inner"); 176 var params = $inner.data("params"); 177 if (typeof params === "undefined") { 178 params = { 179 depth: 0, 180 scroll: {}, 181 height: {}, 182 }; 183 } 184 $inner.data("params", params); 185 186 if ($mobileMenuNlo.length) { 187 if (!$mobileMenuNlo.hasClass("nlo-loadings")) { 188 $mobileMenuNlo.addClass("nlo-loadings"); 189 setTimeout(function () { 190 $.ajax({ 191 data: { nlo: $mobileMenuNlo.attr("data-nlo") }, 192 error: function () { 193 $mobileMenuNlo.removeClass("nlo-loadings"); 194 }, 195 complete: function (jqXHR, textStatus) { 196 if (textStatus === "success" || jqXHR.status == 404) { 197 var ob = BX.processHTML($.trim(jqXHR.responseText)); 198 BX.ajax.processScripts(ob.SCRIPT); 199 $mobileMenuNlo.replaceWith(ob.HTML); 200 } 201 }, 202 }); 203 }, 300); 204 } 205 } 206 } 207 }; 208 209 CloseMobileMenu = function () { 210 if ($mobileMenu.isOpen) { 211 // hide menu 212 $mobileMenu.removeClass("show"); 213 $mobileMenu.isOpen = false;
214 215 $mobileMenu.find(".mobilemenu__menu-item--expanded").removeClass("mobilemenu__menu-item--expanded"); 216 217 // show styleswitcher 218 $(".style-switcher .switch").show(); 219 $(".style-switcher .switch_presets").show(); 220 221 if ($mobileMenu.isLeftSide) { 222 setTimeout(function () { 223 // hide overlay 224 $mobileMenuOverlay.fadeOut("fast"); 225 226 // show body scroll 227 $("body").removeClass("overflow-block"); 228 229 // unblur body 230 $("body").removeClass("jqm-initied"); 231 $("#mobilemenu").removeClass("filter-none"); 232 $("#mobileheader").removeClass("filter-none"); 233 }, 100); 234 } else { 235 // change burger icon 236 // $('#mobileheader .burger').removeClass('c'); 237 238 // show body scroll 239 $("body").removeClass("overflow-block"); 240 } 241 242 setTimeout(function () { 243 var $scroller = $mobileMenu.find(".mobilemenu"); 244 var $inner = $mobileMenu.find(".mobilemenu__inner"); 245 var params = $inner.data("params"); 246 params.depth = 0; 247 $inner.data("params", params).attr("style", ""); 248 $mobileMenu.scrollTop(0); 249 $scroller.css("height", ""); 250 }, 400); 251 } 252 }; 253 254 SwipeMobileMenu = function () { 255 if ($mobileMenu.isOpen) { 256 CloseMobileMenu(); 257 } else { 258 OpenMobileMenu(); 259 } 260 }; 261 262 CheckMobileMenu = function () { 263 CloseMobileMenu(); 264 }; 265 266 function MoveMobileMenuWrapNext() { 267 var $scroller = $mobileMenu.find(".mobilemenu"); 268 var $inner = $mobileMenu.find(".mobilemenu__inner"); 269 if ($inner.length) { 270 var params = $inner.data("params"); 271 var $dropdownNext = $mobileMenu 272 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 273 .eq(params.depth); 274 if ($dropdownNext.length) { 275 var bMobileRegions = $dropdownNext.closest('.mobilemenu__menu--regions').length; 276 if (bMobileRegions) { 277 var $fixedCities = $dropdownNext.find('.menu-item-fixed'); 278 } 279 280 // save scroll position 281 params.scroll[params.depth] = parseInt($mobileMenu.scrollTop()); 282 283 // height while move animating 284 params.height[params.depth + 1] = Math.max( 285 $dropdownNext.height(), 286 !params.depth 287 ? $inner.height() 288 : $mobileMenu 289 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 290 .eq(params.depth - 1) 291 .height() 292 ); 293 $scroller.css("height", params.height[params.depth + 1] + "px"); 294 295 // inc depth 296 ++params.depth; 297 298 // translateX for move 299 $inner.css("transform", "translateX(" + -100 * params.depth + "%)"); 300 301 // scroll to top 302 setTimeout(function () { 303 $mobileMenu.animate({ scrollTop: 0 }, 200); 304 }, 100); 305 306 if (bMobileRegions) { 307 $fixedCities.css('height', ($mobileMenu.height() - $fixedCities.position().top) + 'px'); 308 } 309 310 // height on enimating end 311 var h = $dropdownNext.outerHeight(); 312 setTimeout(function () { 313 if (h) { 314 $scroller.css("height", h + "px"); 315 } else { 316 $scroller.css("height", ""); 317 } 318 319 if (bMobileRegions) { 320 setTimeout(function () { 321 // show cities scroll 322 $fixedCities.css('overflow', ''); 323 }, 200); 324 325 initMobileRegions(); 326 } 327 }, 200); 328 } 329 330 $inner.data("params", params); 331 } 332 } 333 334 function MoveMobileMenuWrapPrev() { 335 var $scroller = $mobileMenu.find(".mobilemenu"); 336 var $inner = $mobileMenu.find(".mobilemenu__inner"); 337 if ($inner.length) { 338 var params = $inner.data("params"); 339 if (params.depth > 0) { 340 var $dropdown = $mobileMenu 341 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 342 .eq(params.depth - 1); 343 if ($dropdown.length) { 344 // height while move animating 345 $scroller.css("height", params.height[params.depth] + "px"); 346 347 // dec depth 348 --params.depth; 349 350 // translateX for move
351 $inner.css("transform", "translateX(" + -100 * params.depth + "%)"); 352 353 // restore scroll position 354 setTimeout(function () { 355 $mobileMenu.animate({ scrollTop: params.scroll[params.depth] }, 200); 356 }, 100); 357 358 if ($dropdown.closest('.mobilemenu__menu--regions').length) { 359 // hide cities scroll 360 $dropdown.find('.menu-item-fixed').css('overflow', 'hidden'); 361 362 // scroll cities to top 363 setTimeout(function () { 364 $dropdown.find('.menu-item-fixed').animate({ scrollTop: 0 }, 200); 365 }, 100); 366 } 367 368 // height on enimating end 369 var h = !params.depth 370 ? false 371 : $mobileMenu 372 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 373 .eq(params.depth - 1) 374 .outerHeight(); 375 setTimeout(function () { 376 if (h) { 377 $scroller.css("height", h + "px"); 378 } else { 379 $scroller.css("height", ""); 380 } 381 }, 200); 382 } 383 } 384 385 $inner.data("params", params); 386 } 387 } 388 389 function initMobileRegions() { 390 if (!initMobileRegions.inited) { 391 initMobileRegions.inited = true; 392 393 BX.loadExt( 394 [ 395 'aspro_set_cookie_on_domains', 396 'aspro_ui' 397 ] 398 ).then( 399 () => { 400 function getMainCities() { 401 let componentAction = 'getMainCities'; 402 let componentName = 'aspro:regionality.list.premier'; 403 let sessid = BX.message('bitrix_sessid'); 404 let lang = BX.message('LANGUAGE_ID'); 405 let siteId = BX.message('SITE_ID'); 406 let url = location.pathname + location.search; 407 let lastId = getMainCities.lastId; 408 let $loadings = $('.mobilemenu__menu--regions .dropdown .loadings').closest('li'); 409 410 BX.ajax({ 411 url: '/bitrix/services/main/ajax.php?mode=ajax&c=' + encodeURIComponent(componentName) +'&action=' + componentAction + '&sessid=' + sessid + '&SITE_ID=' + siteId + '&siteId=' + siteId + '&url=' + encodeURIComponent(url) + '&lastId=' + lastId + '&lang=' + lang, 412 method: 'POST', 413 async: true, 414 processData: true, 415 scriptsRunFirst: true, 416 emulateOnload: true, 417 start: true, 418 cache: false, 419 dataType: 'json', 420 onsuccess: function(response){ 421 if ( 422 typeof response === 'object' && 423 response && 424 typeof response.data === 'object' && 425 response.data 426 ) { 427 if (typeof response.data.lastId !== 'undefined') { 428 getMainCities.lastId = response.data.lastId; 429 } 430 431 if ( 432 response.data.cities && 433 Object.values(response.data.cities).length 434 ) { 435 let itemsHtml = ''; 436 437 for (let i in response.data.cities) { 438 let item = response.data.cities[i]; 439 let bCurrent = item.CURRENT == 1; 440 441 itemsHtml += ` 442 <li class="mobilemenu__menu-item mobilemenu__menu-item--city main-city` + (bCurrent ? ' mobilemenu__menu-item--selected stroke-dark-light-block stroke-dark-parent-all' : '') + `"> 443 <div class="link-wrapper bg-opacity-theme-parent-hover fill-theme-parent-all"> 444 <a href="${item.URL}" rel="nofollow" data-id="${item.ID}" data-locid="${(item.LOCATION_ID ? item.LOCATION_ID : '')}" class="dark_link"> 445 <span class="line-block line-block--gap line-block--justify-between line-block--align-flex-start"> 446 <span class="line-block__item">
447 <span class="font_15">${item.NAME}</span> 448 ${(item.PATH ? `<div class="secondary-color font_13">${item.PATH}</div>` : '')} 449 </span> 450 ${ 451 bCurrent 452 ? `<span class="line-block__item"> 453 <i class="svg inline icon-block__icon icon-block__icon--sm stroke-dark-target inline mt mt--6" aria-hidden="true"> 454 <svg width="10" height="7"> 455 <use xlink:href="${arAsproOptions.SITE_TEMPLATE_PATH}/images/svg/form_icons.svg#checkmark"></use> 456 </svg> 457 </i> 458 </span>` 459 : '' 460 } 461 </span> 462 </a> 463 </div> 464 </li> 465 `; 466 } 467 468 $(itemsHtml).insertBefore($loadings); 469 470 if (response.data.more) { 471 getMainCities.observer.observe($loadings[0]); 472 } 473 else { 474 $loadings.remove(); 475 } 476 } 477 } 478 }, 479 onfailure: function(){ 480 $loadings.remove(); 481 } 482 }); 483 } 484 485 $("#mobile-region-search").autocomplete({ 486 minLength: 2, 487 appendTo : $('.mobilemenu__menu--regions .dropdown .mobile-cities').closest('.menu-item-fixed'), 488 source: function(request, callback){ 489 let componentAction = 'searchCities'; 490 let componentName = 'aspro:regionality.list.premier'; 491 let sessid = BX.message('bitrix_sessid'); 492 let lang = BX.message('LANGUAGE_ID'); 493 let siteId = BX.message('SITE_ID'); 494 let url = location.pathname + location.search; 495 496 BX.ajax({ 497 url: '/bitrix/services/main/ajax.php?mode=ajax&c=' + encodeURIComponent(componentName) +'&action=' + componentAction + '&sessid=' + sessid + '&SITE_ID=' + siteId + '&siteId=' + siteId + '&url=' + encodeURIComponent(url) + '&term=' + encodeURIComponent(request.term) + '&lang=' + lang, 498 method: 'POST', 499 async: true, 500 processData: true, 501 scriptsRunFirst: true, 502 emulateOnload: true, 503 start: true, 504 cache: false, 505 dataType: 'json', 506 onsuccess: function(response){ 507 if ( 508 typeof response === 'object' && 509 response && 510 typeof response.data === 'object' && 511 response.data 512 ) { 513 let cities = Object.values(response.data.cities); 514 $("#mobile-region-search").data('cities', cities); 515 516 if (cities.length) { 517 callback(response.data.cities); 518 } 519 else { 520 $('.mobilemenu__menu--regions .dropdown .mobile-cities').hide().siblings().empty().show(); 521 } 522 } 523 }, 524 onfailure: function(){ 525 } 526 }); 527 }, 528 select: function(event, ui) { 529 let regionId = ui.item.ID; 530 if (regionId) { 531 setCookieOnDomains('current_region', regionId); 532 533 let locationId = ui.item.LOCATION_ID; 534 if (locationId) { 535 setCookieOnDomains('current_location', locationId); 536 } 537 else {
538 setCookieOnDomains('current_location', '', {expires: -1}); 539 } 540 } 541 542 $('#mobile-region-search').val(ui.item.label); 543 544 return false; 545 }, 546 focus: function(event, ui) { 547 // !!!hack do not remove 548 setTimeout(function() { 549 $("#mobile-region-search").val(ui.item.NAME); 550 551 // highlight 552 let cities = $("#mobile-region-search").data('cities'); 553 if (typeof cities === 'object' && cities) { 554 cities.every((item, i) => { 555 if (item.NAME == ui.item.NAME) { 556 $('.mobilemenu__menu--regions .ui-autocomplete .mobilemenu__menu-item').eq(i).addClass('selected').siblings().removeClass('selected'); 557 558 return false; 559 } 560 561 return true; 562 }); 563 } 564 }, 0); 565 }, 566 open: function(event, ui) { 567 $('.mobilemenu__menu--regions .dropdown .mobile-cities').hide().siblings().show(); 568 }, 569 close: function(event, ui) { 570 // do not hide finded citties! Hide it only on empty phrase! 571 $('.mobilemenu__menu--regions .dropdown .mobile-cities').siblings().show(); 572 } 573 }).data('ui-autocomplete')._renderItem = function(ul, item){ 574 let html = ` 575 <li class="mobilemenu__menu-item mobilemenu__menu-item--city"> 576 <div class="link-wrapper bg-opacity-theme-parent-hover fill-theme-parent-all"> 577 <a href="` + item.URL + `" rel="nofollow" data-id="` + item.ID + `" data-locid="` + (item.LOCATION_ID ? item.LOCATION_ID : '') + `" class="dark_link"><span class="font_15">` + item.NAME + `</span>` + (item.PATH ? '<div class="secondary-color font_13">' + item.PATH + '</div>' : '') + `</a> 578 </div> 579 </li> 580 `; 581 582 return $(html).appendTo(ul); 583 } 584 585 if ($('.mobilemenu__menu--regions .dropdown .loadings').length) { 586 getMainCities.lastId = 0; 587 getMainCities.observer = new IntersectionObserver((entries, observer) => { 588 entries.forEach(entry => { 589 if (entry.isIntersecting) { 590 getMainCities.observer.unobserve(entry.target); 591 getMainCities(); 592 } 593 }) 594 }, { 595 root: null, 596 rootMargin: '0px', 597 threshold: 0.5, 598 }); 599 600 getMainCities(); 601 } 602 } 603 ); 604 } 605 } 606 } 607 // --- END Bind mobile menu --- 608 609 // --- Bind mobile phone --- 610 if ($("#mobilephones").length) { 611 $(document).on("click", ".mobileheader .phones__inner .icon-block__only-icon", function (e) { 612 e.stopPropagation(); 613 SwipeMobilePhone(); 614 }); 615 616 $(document).on("click", ".mobilephones__menu-item a,.mobilephones__close", function (e) { 617 e.stopPropagation(); 618 CloseMobilePhone(); 619 }); 620 } 621 622 SwipeMobilePhone = function () { 623 if ($("#mobilephones.show").length) { 624 CloseMobilePhone(); 625 } else { 626 OpenMobilePhone(); 627 } 628 }; 629 630 OpenMobilePhone = function () { 631 if (!$("#mobilephones.show").length) { 632 CloseMobileMenu(); 633 634 // show overlay 635 $('<div class="jqmOverlay mobp"></div>').appendTo("body"); 636 637 // blur body 638 $("#mobileheader").addClass("filter-none"); 639 $("body").addClass("jqm-initied"); 640 641 // toggle phones 642 setTimeout(function () { 643 $("#mobilephones").slideDown("fast", function () { 644 $("#mobilephones").addClass("show"); 645 }); 646 }, 100); 647 } 648 }; 649 650 CloseMobilePhone = function () { 651 if ($("#mobilephones.show").length) { 652 // toggle phones 653 setTimeout(function () { 654 $("#mobilephones").slideUp("fast", function () { 655 $("#mobilephones").removeClass("show"); 656 657 // unblur body 658 $("body").removeClass("jqm-initied"); 659 $("#mobileheader").removeClass("filter-none"); 660 661 // hide overlay 662 $(".jqmOverlay.mobp").remove(); 663 }); 664 }, 100); 665 } 666 }; 667 668 checkMobilePhone = function () { 669 CloseMobilePhone(); 670 }; 671 // --- END Bind mobile phone --- 672 673 /* --- Bind mobile filter --- */ 674 var $mobilefilter = $("#mobilefilter"); 675 var $mobiledMenu = $("#mobilemenu"); 676 if ($mobilefilter.length) { 677 $mobilefilter.isOpen = $mobiledMenu.hasClass("show"); 678 $mobilefilter.isAppendLeft = false;
679 $mobilefilter.isWrapFilter = false; 680 $mobilefilter.isHorizontalOrCompact = $(".filter_horizontal").length || $(".bx_filter_vertical.compact").length; 681 $mobilefilter.close = '<i class="svg svg-close close-icons"></i>'; 682 683 $(document).on("click", ".bx-filter-title", function () { 684 OpenMobileFilter(); 685 }); 686 687 $(document).on("click", "#mobilefilter .svg-close.close-icons", function () { 688 CloseMobileFilter(); 689 }); 690 691 $(document).on("click", ".bx_filter_select_block", function (e) { 692 var bx_filter_select_container = $(e.target).parents(".bx_filter_select_container"); 693 if (bx_filter_select_container.length) { 694 var prop_id = bx_filter_select_container.closest(".bx_filter_parameters_box").attr("data-property_id"); 695 if ($("#smartFilterDropDown" + prop_id).length) { 696 $("#smartFilterDropDown" + prop_id).css({ 697 "max-width": bx_filter_select_container.width(), 698 "z-index": "3020", 699 }); 700 } 701 } 702 }); 703 704 $(document).on("click", ".bx_filter_search_button", function (e) { 705 // if ($(e.target).hasClass("bx_filter_search_button")) { 706 CloseMobileFilter(); 707 // } 708 }); 709 710 $(document).on("mouseup", ".bx_filter_parameters_box_title", function (e) { 711 $("[id^='smartFilterDropDown']").hide(); 712 if ($(e.target).hasClass("close-icons")) { 713 CloseMobileFilter(); 714 } 715 }); 716 717 $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>'); 718 var $mobilefilterOverlay = $("#mobilefilter-overlay"); 719 720 $mobilefilterOverlay.click(function () { 721 if ($mobilefilter.isOpen) { 722 CloseMobileFilter(); 723 //e.stopPropagation(); 724 } 725 }); 726 727 mobileFilterNum = function (num, def) { 728 if (def) { 729 $(".bx_filter_search_button").val(num); 730 } else { 731 var str = ""; 732 var $prosLeng = $(".bx_filter_parameters_box > span"); 733 734 str += 735 $prosLeng.data("f") + 736 " " + 737 num 738 // " " + 739 // declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm")]); 740 $(".bx_filter_search_button").val(str); 741 } 742 }; 743 744 declOfNumFilter = function (number, titles) { 745 cases = [2, 0, 1, 1, 1, 2]; 746 return titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[number % 10 < 5 ? number % 10 : 5]]; 747 }; 748 749 OpenMobileFilter = function () { 750 if (!$mobilefilter.isOpen) { 751 $("body").addClass("jqm-initied wf"); 752 753 $(".bx_filter_vertical .slide-block__head.filter_title").removeClass("closed"); 754 755 $(".bx_filter_vertical .slide-block__head.filter_title + .slide-block__body").show(); 756 757 if (!$mobilefilter.isAppendLeft) { 758 if (!$mobilefilter.isWrapFilter) { 759 $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>"); 760 $mobilefilter.isWrapFilter = true; 761 } 762 $(".bx_filter").appendTo($("#mobilefilter")); 763 var helper = $("#filter-helper"); 764 if (helper.length) { 765 helper.prependTo($("#mobilefilter .bx_filter_parameters")); 766 } 767 $mobilefilter.isAppendLeft = true; 768 } 769 if (typeof checkFilterLandgings === "function") { 770 checkFilterLandgings(); 771 } 772 773 $("#mobilefilter .bx_filter_parameters").addClass("mobile-scroll scrollbar"); 774 775 $(".bx_filter_button_box.ajax-btns").addClass("colored_theme_bg"); 776 $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass("hidden"); 777 778 // show overlay 779 setTimeout(function () { 780 $mobilefilterOverlay.fadeIn("fast"); 781 }, 100); 782 783 // fix body 784 $("body").css({ overflow: "hidden", height: "100vh" }); 785 786 // show mobile filter 787 $mobilefilter.addClass("show"); 788 $mobilefilter.find(".bx_filter").css({ display: "block" }); 789 $mobilefilter.isOpen = true; 790 791 $("#mobilefilter .bx_filter_button_box.btns.ajax-btns").removeClass("hidden"); 792 793 var init = $mobilefilter.data("init"); 794 if (typeof init === "undefined") { 795 $mobilefilter.scroll(function () { 796 $(".bx_filter_section .bx_filter_select_container").each(function () { 797 var prop_id = $(this).closest(".bx_filter_parameters_box").attr("data-property_id"); 798 if ($("#smartFilterDropDown" + prop_id).length) { 799 $("#smartFilterDropDown" + prop_id).hide(); 800 } 801 }); 802 }); 803 804 $mobilefilter.data("init", "Y"); 805 } 806 BX.onCustomEvent('showVisibleProps'); 807 } 808 }; 809 810 CloseMobileFilter = function (append) { 811 $mobilefilter.find(".bx_filter_parameters").removeClass("scrollbar"); 812 813 $("body").removeClass("jqm-initied wf"); 814 815 $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass("hidden"); 816 817 if ($mobilefilter.isOpen) { 818 // scroll to top 819 $mobilefilter.find(".bx_filter_parameters").scrollTop(0); 820 821 // unfix body 822 $("body").css({ overflow: "", height: "" }); 823 824 // hide overlay 825 setTimeout(function () { 826 $mobilefilterOverlay.fadeOut("fast"); 827 }, 100); 828 829 // hide mobile filter 830 $mobilefilter.removeClass("show"); 831 $mobilefilter.isOpen = false;
832 } 833 834 if (append && $mobilefilter.isAppendLeft) { 835 $mobilefilter.find('.bx_filter_parameters_box_title:not(.no-html-close)').removeClass("opened"); 836 $mobilefilter.find('.bx_filter_block.dropdown-menu-wrapper').hide(); 837 838 $(".bx_filter").appendTo($("#wrapInlineFilter")).show(); 839 var helper = $("#filter-helper"); 840 if (helper.length) { 841 helper.appendTo($("#filter-helper-wrapper")); 842 } 843 $mobilefilter.isAppendLeft = false; 844 $mobilefilter.removeData("init"); 845 } 846 }; 847 848 checkMobileFilter = function () { 849 if ( 850 (!window.matchMedia("(max-width: 991px)").matches && !$mobilefilter.isHorizontalOrCompact) || 851 (!window.matchMedia("(max-width: 767px)").matches && $mobilefilter.isHorizontalOrCompact) 852 ) { 853 CloseMobileFilter(true); 854 } 855 }; 856 } 857 /* --- END Bind mobile filter --- */ 858});
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.