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