PageSourceSearch

https://767676.ru/bitrix/templates/aspro-premier/js/conditional/se…ch-title-handlers.desktop.js?17641432014365

js 767676.ru collected 2026-10-07 19:36:43 UTC 4,365 bytes, 199 lines download raw bytes

1BX.namespace("BX.Aspro.Search.Type");
2BX.Aspro.Search.Type = new (function () {
3  let obSearch = null;
4
5  const getSearchType = () => {
6    if (!obSearch) {
7      if (document.querySelector(".inline-search-block")) {
8        obSearch = new Fixed();
9      } else {
10        obSearch = new Inline();
11      }
12    }
13  };
14
15  this.open = function () {
16    getSearchType();
17
18    obSearch.open();
19  };
20
21  this.close = function () {
22    getSearchType();
23
24    obSearch.close();
25  };
26
27  this.toggle = function () {
28    getSearchType();
29
30    obSearch.toggle();
31  };
32
33  function Fixed() {
34    let nodeSearchBlock = null;
35    let nodeSearchBlockInput = null;
36    let nodeOverlay = null;
37
38    let isOpened = false;
39
40    this.open = function () {
41      if (isOpened) {
42        return;
43      }
44      isOpened = true;
45
46      if (!nodeSearchBlock) {
47        nodeSearchBlock = document.querySelector(".inline-search-block");
48
49        if (nodeSearchBlock) {
50          nodeSearchBlockInput = nodeSearchBlock.querySelector('input[name="q"]');
51        }
52      }
53
54      nodeSearchBlock.classList.add("show");
55      nodeSearchBlockInput.focus();
56      document.body.classList.add("jqm-initied");
57
58      addOverlay();
59    };
60
61    const addOverlay = () => {
62      nodeOverlay = BX.create("div", {
63        attrs: {
64          class: "overlay",
65        },
66        events: {
67          click: () => this.close(),
68        },
69      });
70
71      nodeSearchBlock.appendChild(nodeOverlay);
72    };
73
74    this.close = function () {
75      if (!isOpened) {
76        return;
77      }
78
79      isOpened = false;
80
81      nodeSearchBlock.classList.remove("show");
82      nodeSearchBlockInput.blur();
83      document.body.classList.remove("jqm-initied");
84      removeOverlay();
85    };
86
87    const removeOverlay = () => {
88      if (nodeOverlay) {
89        nodeOverlay.remove();
90        nodeOverlay = null;
91      }
92    };
93
94    this.toggle = function () {
95      if (isOpened) {
96        this.close();
97      } else {
98        this.open();
99      }
100    };
101  }
102
103  function Inline() {
104    let nodeHeader = null;
105    let nodeSearchBlockInput = null;
106    let nodeOverlay = null;
107
108    let isOpened = false;
109
110    const isMobile = window.matchMedia("(max-width: 991px)").matches;
111
112    const addOverlay = () => {
113      nodeOverlay = BX.create("div", {
114        attrs: {
115          class: "jqmOverlay mobp",
116        },
117        events: {
118          click: () => this.close(),
119        },
120      });
121
122      document.body.appendChild(nodeOverlay);
123    };
124
125    this.open = function () {
126      if (!isMobile) {
127        return;
128      }
129
130      if (isOpened) {
131        return;
132      }
133      isOpened = true;
134
135      if (!nodeHeader) {
136        nodeHeader = document.querySelector('[data-ajax-block="HEADER"]');
137        if (nodeHeader) {
138          nodeSearchBlockInput = nodeHeader.querySelector('input[name="q"]');
139        }
140      }
141
142      window.CloseMobilePhone?.();
143      window.CloseMobileMenu?.();
144
145      document.body.classList.add("header--mobile-search-active", "jqm-initied");
146      nodeHeader.classList.add("filter-none");
147      nodeSearchBlockInput.focus();
148      addOverlay();
149    };
150
151    const removeOverlay = () => {
152      if (nodeOverlay) {
153        nodeOverlay.remove();
154        nodeOverlay = null;
155      }
156    };
157
158    this.close = function () {
159      if (!isOpened) {
160        return;
161      }
162      isOpened = false;
163
164      document.body.classList.remove("header--mobile-search-active", "jqm-initied");
165      nodeHeader.classList.remove("filter-none");
166      nodeSearchBlockInput.blur();
167      removeOverlay();
168    };
169
170    this.toggle = function () {
171      if (isOpened) {
172        this.close();
173      } else {
174        this.open();
175      }
176    };
177  }
178
179  BX.addCustomEvent("onAsproEscapeButton", () => {
180    if (!document.querySelector("#popup_iframe_wrapper")?.style?.display) {
181      BX.Aspro.Search.Type.close();
182    }
183  });
184
185  BX.addCustomEvent("app.document.keyup", (eventdata) => {
186    const nodeCurrentSearchInput = eventdata.target.closest(".search-title__input");
187    if (!nodeCurrentSearchInput) {
188      return;
189    }
190
191    BX.onCustomEvent("onAsproSearchSync", [nodeCurrentSearchInput.value]);
192  });
193
194  BX.addCustomEvent("app.document.click", (eventdata) => {
195    if (eventdata.target.closest(".header-search, .header-search__mobile, .bottom-icons-panel__content-link--search")) {
196      BX.Aspro.Search.Type.open();
197    }
198  });
199})();

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.