PageSourceSearch

https://newseoul.ru/bitrix/templates/bs431v2/components/bitrix/menu/bootstrap_v4/script.js?16093697986246

js newseoul.ru collected 2026-09-26 04:42:36 UTC 6,246 bytes, 261 lines download raw bytes

1(function(window) {
2
3	if (!window.BX || BX.CatalogMenu)
4		return;
5
6	BX.CatalogMenu = {
7		items : {},
8		idCnt : 1,
9		currentItem : null,
10		overItem : null,
11		outItem : null,
12		timeoutOver : null,
13		timeoutOut : null,
14
15		getItem : function(item)
16		{
17			if (!BX.type.isDomNode(item))
18				return null;
19
20			var id = !item.id || !BX.type.isNotEmptyString(item.id) ? (item.id = "menu-item-" + this.idCnt++) : item.id;
21
22			if (!this.items[id])
23				this.items[id] = new CatalogMenuItem(item);
24
25			return this.items[id];
26		},
27
28		itemOver : function(item)
29		{
30			var menuItem = this.getItem(item);
31			if (!menuItem)
32				return;
33
34			if (this.outItem == menuItem)
35			{
36				clearTimeout(menuItem.timeoutOut);
37			}
38
39			this.overItem = menuItem;
40
41			if (menuItem.timeoutOver)
42			{
43				clearTimeout(menuItem.timeoutOver);
44			}
45
46			menuItem.timeoutOver = setTimeout(function() {
47				if (BX.CatalogMenu.overItem == menuItem)
48				{
49					menuItem.itemOver();
50				}
51
52			}, 100);
53		},
54
55		itemOut : function(item)
56		{
57			var menuItem = this.getItem(item);
58			if (!menuItem)
59				return;
60
61			this.outItem = menuItem;
62
63			if (menuItem.timeoutOut)
64			{
65				clearTimeout(menuItem.timeoutOut);
66			}
67
68			menuItem.timeoutOut = setTimeout(function() {
69
70				if (menuItem != BX.CatalogMenu.overItem)
71				{
72					menuItem.itemOut();
73				}
74				if (menuItem == BX.CatalogMenu.outItem)
75				{
76					menuItem.itemOut();
77				}
78
79			}, 100);
80		},
81
82		removeHover : function(curItem)
83		{
84			if (typeof curItem !== "object")
85				return false;
86
87			var items = curItem.parentNode.querySelectorAll('[data-role="bx-menu-item"]');
88			for (var i=0; i<items.length; i++)
89			{
90				if (curItem == items[i])
91					continue;
92
93				if (BX.hasClass(items[i], "bx-hover"))
94					BX.removeClass(items[i], "bx-hover")
95			}
96		}
97	};
98
99	var CatalogMenuItem = function(item)
100	{
101		this.element = item;
102		this.popup = BX.findChild(item, { className: "bx_children_container" }, false, false);
103		this.isLastItem = BX.lastChild(this.element.parentNode) == this.element;
104	};
105
106	CatalogMenuItem.prototype.itemOver = function()
107	{
108		if (!BX.hasClass(this.element, "bx-hover"))
109		{
110			BX.addClass(this.element, "bx-hover");
111
112			var popup = BX.findChild(this.element, {className:"bx-nav-2-lvl-container"}, true, false);
113			if (popup)
114			{
115				var popupRightEdge = popup.getBoundingClientRect().left + popup.offsetWidth;
116				if (popupRightEdge > document.body.clientWidth)
117					popup.style.right = 0;
118			}
119		}
120	};
121
122	CatalogMenuItem.prototype.itemOut = function()
123	{
124		BX.removeClass(this.element, "bx-hover");
125	};
126})(window);
127
128BX.namespace("BX.Main.Menu");
129BX.Main.Menu.CatalogHorizontal = (function()
130{
131	var CatalogHorizontal = function(menuBlockId, itemImgDesc)
132	{
133		this.menuBlockId = menuBlockId || "";
134		this.itemImgDesc = itemImgDesc || "";
135
136		this.resizeMenu();
137		BX.bind(window, "resize", BX.proxy(this.resizeMenu, this));
138	};
139
140	CatalogHorizontal.prototype.clickInMobile = function(element, event)
141	{
142		if (BX.findParent(element, {className: "bx-aside-nav"}, true))
143			return;
144
145		event.preventDefault();
146		element.onclick = '';
147		return false;
148	};
149
150	CatalogHorizontal.prototype.toggleInMobile = function(element)
151	{
152		var parentObj = BX.findParent(element, {className: "bx-nav-parent"});
153		var arrow = element.firstChild;
154		if (BX.hasClass(parentObj, "bx-opened"))
155		{
156			BX.removeClass(parentObj, "bx-opened");
157			BX.removeClass(arrow, "fa-angle-down");
158			BX.addClass(arrow, "fa-angle-left");
159		}
160		else
161		{
162			BX.addClass(parentObj, "bx-opened");
163			BX.addClass(arrow, "fa-angle-down");
164			BX.removeClass(arrow, "fa-angle-left");
165		}
166	};
167
168	CatalogHorizontal.prototype.resizeMenu = function()
169	{
170		var templateWrap = this.templateWrap;
171		var menuMobile = document.body.querySelector("[data-role='bx-menu-mobile']");
172		var menuMobileButton = document.body.querySelector("[data-role='bx-menu-button-mobile']");
173		//var menuMobilePosition = document.body.querySelector("[data-role='bx-menu-button-mobile-position']");
174
175		if (document.body.clientWidth <= 767) //mobile
176		{
177			if (!menuMobile)
178			{
179				menuMobile = BX.create("div", {
180					attrs: {
181						className: "bx-aside-nav",
182						"data-role" : "bx-menu-mobile"
183					},
184					children: [BX.clone(BX("ul_" + this.menuBlockId))]
185				});
186				document.body.insertBefore(menuMobile, document.body.firstChild);
187			}
188
189			if (!menuMobileButton)
190			{
191				menuMobileButton = BX.create("div", {
192					attrs: {className: "bx-aside-nav-control bx-closed", "data-role" : "bx-menu-button-mobile"},
193					children: [BX.create("i", {
194							attrs: {className: "fa fa-bars"}
195						})
196					],
197					events: {
198						"click" : function() {
199							if (BX.hasClass(this, "bx-opened"))
200							{
201								BX.removeClass(this, 'bx-opened');
202								BX.removeClass(menuMobile, 'bx-opened');
203								BX.addClass(this, 'bx-closed');
204								document.body.style.overflow = "";
205								BX.removeClass(document.body, 'bx-opened');
206							}
207							else
208							{
209
210								BX.addClass(this, 'bx-opened');
211								BX.addClass(menuMobile, 'bx-opened');
212								BX.removeClass(this, 'bx-closed');
213								document.body.style.overflow = "hidden";
214								BX.addClass(document.body, 'bx-opened');
215							}
216						}
217					}
218				});
219
220				document.body.insertBefore(menuMobileButton, document.body.firstChild);
221
222				//menuMobilePosition.appendChild(menuMobileButton);
223			}
224		}
225		else
226		{
227			BX.removeClass(menuMobile, 'bx-opened');
228			BX.removeClass(document.body, 'bx-opened');
229			document.body.style.overflow = "";
230
231			if (menuMobileButton)
232				BX.removeClass(menuMobileButton, 'bx-opened');
233		}
234	};
235
236	CatalogHorizontal.prototype.changeSectionPicure = function(element, itemId)
237	{
238		var curLi = BX.findParent(element, {className: "bx-nav-1-lvl"});
239		if (!curLi)
240			return;
241
242		var imgDescObj = curLi.querySelector("[data-role='desc-img-block']");
243		if (!imgDescObj)
244			return;
245
246		var imgObj = BX.findChild(imgDescObj, {tagName: "img"}, true, false);
247		if (imgObj)
248			imgObj.src = this.itemImgDesc[itemId]["PICTURE"];
249
250		var linkObj = BX.findChild(imgDescObj, {tagName: "a"}, true, false);
251		if (linkObj)
252			linkObj.href = element.href;
253
254		var descObj = BX.findChild(imgDescObj, {tagName: "p"}, true, false);
255		if (descObj)
256			descObj.innerHTML = this.itemImgDesc[itemId]["DESC"];
257
258	};
259
260	return CatalogHorizontal;
261})();

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.