PageSourceSearch

https://felizhouse.ru/bitrix/templates/aspro-premier/components/bitrix/menu/header/script.js

js felizhouse.ru collected 2026-10-07 04:19:06 UTC 3,972 bytes, 111 lines download raw bytes

1BX.Aspro.Utils.readyDOM(() => {
2  $(document).on("click", ".header-menu__wide-submenu-item-inner .toggle_block", function (e) {
3    e.preventDefault();
4
5    var _this = $(this),
6      menu = _this.closest(".header-menu__wide-submenu-item-inner").find("> .submenu-wrapper");
7
8    if (!_this.hasClass("clicked")) {
9      _this.addClass("clicked");
10
11      menu.slideToggle(150, function () {
12        _this.removeClass("clicked");
13      });
14
15      _this.closest(".header-menu__wide-submenu-item-inner").toggleClass("opened");
16    }
17  });
18
19  BX.bindDelegate(document, 'click', {class: 'header-menu__link--only-catalog'}, function (e) { 
20    e.preventDefault();
21
22    const catalogButton = this;
23    const nodeSvgUse = catalogButton.querySelector('use');
24    const svgLink = nodeSvgUse.getAttribute('xlink:href');
25    
26    if (catalogButton.classList.contains('opened')) {
27      catalogButton.classList.remove('opened');
28      nodeSvgUse.setAttribute('xlink:href', svgLink.replace('#close', '#burger'));
29    } else {
30      catalogButton.classList.add('opened');
31      nodeSvgUse.setAttribute('xlink:href', svgLink.replace('#burger', '#close'));
32      
33      onlyCatalogMenuOpen($(catalogButton));
34    }
35
36    onlyCatalogMenuClose(catalogButton);
37  });
38
39  BX.bindDelegate(document, "click", {tag: 'body'}, function (e) {
40    const catalogButton = document.querySelector('.header-menu__link--only-catalog.opened');
41    const isMenu = e.target.closest('.header-menu__wrapper');
42
43    if (catalogButton && !isMenu) {
44      onlyCatalogMenuClose();
45    }
46  });
47
48  onlyCatalogMenuClose = function (currentButton = null) { 
49    let nodeListCatalogButton = document.querySelectorAll('.header-menu__link--only-catalog.opened');
50    if (
51      !nodeListCatalogButton.length
52      || (nodeListCatalogButton.length === 1 && nodeListCatalogButton[0] === currentButton)
53    ) return;
54
55    nodeListCatalogButton.forEach(nodeCatalogButton => {
56      if (nodeCatalogButton !== currentButton) {
57        const currentSvg = nodeCatalogButton.querySelector('use');
58        const currentSvgLink = currentSvg.getAttribute('xlink:href');
59        nodeCatalogButton.classList.remove('opened');
60        currentSvg.setAttribute('xlink:href', currentSvgLink.replace('#close', '#burger'));
61      }
62    })
63  }
64
65  onlyCatalogMenuOpen = function (catalogButton) {
66    var menuNLO = catalogButton.siblings("[data-nlo]");
67
68    if (menuNLO.length) {
69      if (!menuNLO.hasClass("nlo-loadings")) {
70        menuNLO.addClass("nlo-loadings");
71        var menuCatalog = $(".header-menu__link--only-catalog ~ .header-menu__dropdown-menu");
72        if(menuCatalog.length){
73          menuNLO.replaceWith(menuCatalog.clone());        
74          catalogButton.parent().find('.aim-init').removeClass('aim-init');
75          if (BX.Aspro.Utils.isFunction("InitMenuNavigationAim")) {
76            InitMenuNavigationAim();
77          }
78        } else {
79          var buttonTitle = catalogButton.find(".header-menu__title");
80          buttonTitle.addClass("loadings");
81          $.ajax({
82            data: { nlo: menuNLO.attr("data-nlo") },
83            error: function () {
84              menuNLO.removeClass("nlo-loadings");
85            },
86            complete: function (jqXHR, textStatus) {
87              if (textStatus === "success" || jqXHR.status == 404) {
88                var ob = BX.processHTML($.trim(jqXHR.responseText));
89                BX.ajax.processScripts(ob.SCRIPT);
90                menuNLO.replaceWith(ob.HTML);
91                if (BX.Aspro.Utils.isFunction("InitMenuNavigationAim")) {
92                  InitMenuNavigationAim();
93                }
94              }
95              buttonTitle.removeClass("loadings");
96            },
97          });
98        }
99      }
100    }
101  };
102
103  BX.addCustomEvent("onAjaxChangeWidgetValue", function (eventdata) {
104    if (eventdata && eventdata["NAME"] === "PAGE_WIDTH") {
105      if (BX.Aspro.Utils.isFunction("CheckTopMenuDotted")) {
106        CheckTopMenuDotted();
107      }
108    }
109  });
110  
111});

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.