PageSourceSearch

https://1224.pro/bitrix/templates/dresscode/components/bitrix/menu/leftMenu/script.js

js 1224.pro collected 2026-10-07 22:06:38 UTC 2,982 bytes, 160 lines download raw bytes

1//global vars
2var __menuTimeoutID;
3
4$(window).on("ready", function(event){
5
6	//jquery vars
7	var $menu = $("#leftMenu");
8	var $menuItems = $menu.children(".eChild");
9
10	//other
11	var viewport = 0;
12
13	//functions container
14	var events = {
15		click: {}
16	}
17	var tools = {};
18
19	//get browser viewport
20	tools.getViewport = function(){
21
22		//(mozilla/netscape/opera/IE7)
23		if(typeof window.innerWidth != "undefined"){
24			viewport = window.innerWidth;
25		}
26
27		//IE6
28		else if(typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0){
29			viewport = document.documentElement.clientWidth;
30		}
31
32		//older versions of IE
33		else{
34			viewport = document.getElementsByTagName("body")[0].clientWidth;
35		}
36
37		return viewport;
38
39	}
40
41	//events functions
42	events.click.open = function(event){
43
44		//check viewport
45		if(tools.getViewport() <= 1024){
46
47			//jquery vars
48			var $this = $(this);
49			var $container = $this.parents("li");
50
51			//other
52			var state = $this.data("state");
53
54			//check state
55			if(typeof state == "undefined" || state === false){
56
57				//open
58				$container.addClass("opened");
59
60				//set state
61				$this.data("state", true);
62
63				//block actions
64				return event.preventDefault();
65
66			}
67
68		}
69
70	}
71
72	events.click.close = function(event){
73
74		//check viewport
75		if(tools.getViewport() <= 1024){
76
77			//jquery vars
78			var $this = $(this);
79			var $container = $this.parents(".opened");
80
81			//close parent
82			$container.removeClass("opened");
83
84			//close by tree
85			$container.find(".opened").removeClass("opened");
86
87			//set state
88			$container.find(".menuLink").data("state", false);
89
90			//block actions
91			event.preventDefault();
92			event.stopimmediatepropagation();
93
94		}
95
96	}
97
98	events.mouseover = function(){
99
100		//check viewport
101		if(viewport > 1024){
102
103			//jquery vars
104			var $this = $(this);
105
106			//display drop menu
107			$menuItems.removeClass("activeDrop").find(".drop").hide();
108			$this.addClass("activeDrop").find(".drop").css("display", "table");
109
110			//
111			return clearTimeout(__menuTimeoutID);
112
113		}
114
115		//clear
116		else{
117			$menuItems.removeClass("activeDrop");
118			$menu.find(".drop").removeAttr("style");
119		}
120
121	}
122
123	events.mouseout = function(){
124
125		//check viewport
126		if(viewport > 1024){
127
128			//jquery vars
129			var $this = $(this);
130
131			//hide drop menu
132			__menuTimeoutID = setTimeout(function(){
133				$this.removeClass("activeDrop").find(".drop").hide();
134			}, 500);
135
136		}
137
138		//clear
139		else{
140			$menuItems.removeClass("activeDrop");
141			$menu.find(".drop").removeAttr("style");
142		}
143
144	}
145
146	//set start viewport
147	tools.getViewport();
148
149	//binds
150	$(document).on("click", "#leftMenu .nested .back", events.click.close);
151	$(document).on("click", "#leftMenu .nested > a", events.click.open);
152
153	//mouse
154	$(document).on("mouseover", "#leftMenu .eChild", events.mouseover);
155	$(document).on("mouseout", "#leftMenu .eChild", events.mouseout);
156
157	//resize control
158	$(window).on("resize", tools.getViewport);
159
160});

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.