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