PageSourceSearch

https://bondarspa.ru/local/templates/dresscodeV2/js/topMenu.js

js bondarspa.ru collected 2026-10-09 22:44:30 UTC 2,748 bytes, 111 lines download raw bytes

1$(function () {
2	var __menuSelector = "#topMenu";
3	var __menuBarClass = "bar";
4	var __menuSubClass = "sub";
5	var __menuActiveClass = "active";
6
7	var createMenu = function (event) {
8		// @event.data.reducedWidth
9		// @event.data.maxMenuWidth
10
11		var $_self = $(__menuSelector),
12			$_list = $_self.children("li:not(." + __menuBarClass + ")"),
13			$_bar = $_self.find("." + __menuBarClass),
14			$_sub = $_self.find("." + __menuSubClass),
15			_enableBar = $_bar.length > 0 ? 1 : 0,
16			_transElements = $_self.hasClass("transfered") ? 1 : 0;
17
18		var $fn_createBar = function () {
19			$_self.append(
20				$("<li/>")
21					.addClass(__menuBarClass)
22					.append($("<a/>").attr("href", "#").addClass("openEnder"))
23					.append($("<ul/>").addClass(__menuSubClass))
24			);
25
26			$_bar = $_self.find("." + __menuBarClass);
27			$_sub = $_bar.find("." + __menuSubClass);
28
29			return _enableBar++;
30		};
31
32		var $fn_elementsCopy = function (toggle) {
33			if (toggle === false) {
34				$_self
35					.addClass("transfered")
36					.children("li")
37					.each(function (i) {
38						var $_this = $(this);
39						if (!$_this.hasClass(__menuBarClass)) {
40							$_sub.append($_this.clone());
41							$_this.remove();
42						}
43					});
44
45				return _transElements++;
46			} else {
47				$_sub.children("li").each(function (i) {
48					var $_this = $(this);
49					if (!$_this.hasClass(__menuBarClass)) {
50						$_self.append($_this.clone());
51						$_this.remove();
52					}
53				});
54				$_self.removeClass("transfered");
55				$_bar.remove();
56
57				$_list = $_self.children("li:not(." + __menuBarClass + ")");
58
59				return _transElements-- - _enableBar--;
60			}
61		};
62
63		if (document.body.clientWidth <= event.data.reducedWidth) {
64			!_enableBar && $fn_createBar();
65			!_transElements && $fn_elementsCopy(false);
66		} else {
67			if (_transElements) {
68				$fn_elementsCopy(true);
69			}
70
71			if ($_self.outerWidth() > event.data.maxMenuWidth) {
72				for (var i = $_list.length - 1; i >= 0; i--) {
73					var $_this = $_list.eq(i);
74					if ($_self.outerWidth() <= event.data.maxMenuWidth) {
75						break;
76					} else {
77						!_enableBar && $fn_createBar();
78						$_sub.prepend($_this.clone());
79						$_this.remove();
80					}
81				}
82			}
83		}
84	};
85
86	var openMenu = function (event) {
87		$(this)
88			.closest("." + __menuBarClass)
89			.toggleClass(__menuActiveClass);
90		event.preventDefault();
91	};
92
93	var closeMenu = function (event) {
94		$("#topMenu ." + __menuBarClass).removeClass(__menuActiveClass);
95	};
96
97	$(window).on(
98		"ready resize",
99		{
100			reducedWidth: 1250,
101			maxMenuWidth: 800
102		},
103		createMenu
104	);
105
106	$(document).on("click", "#topMenu ." + __menuBarClass, function (event) {
107		event.stopImmediatePropagation();
108	});
109	$(document).on("click", "#topMenu .openEnder", openMenu);
110	$(document).on("click", "html", closeMenu);
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.