PageSourceSearch

https://cdn.healthcoredaily.co.kr/script/menubar.js

js healthcoredaily.co.kr collected 2026-10-02 19:30:38 UTC 6,307 bytes, 187 lines download raw bytes

1/******************************************************************
2* [css class 설명]
3* .active	 			: 1차메뉴 색상(gl-menu-item과 같은 위치)
4* .show	 				: 2차메뉴 노출(gl-menu-item과 같은 위치)
5* .is-current 			: 해당페이지 2차메뉴 색상((gl-menu-sub-item과 같은 위치))
6
7* [스크립트 변수]
8* DESIGN_INDEX 			: index 페이지 일 떄 메뉴 첫번째메뉴 선택 여부 (true / false)
9* DESIGN_OVER			: hover시 메뉴 active 고정 (true / false) 
10* DESIGN_DIR			: 2차메뉴 펼침 형태 (horizon / vertical)
11* DESIGN_SIZE			: 크기설정 (basic / full)
12* DESIGN_HOLD			: 2차메뉴 노출 고정 (true / false)
13* DESIGN_POSI			: 2차메뉴 위치 (left / center / right)
14* DESIGN_EFFECT			: 2차메뉴 에니메이션 (true: slide / false: fade)
15* DESIGN_SPEED			: 2차메뉴 에니메이션 속도(기본: 300)
16******************************************************************/
17
18$(function() {
19	const USER_HEADER			= $(".user-header");
20	const USER_WIDTH 			= USER_HEADER.find(".index-width, .mode-inner").outerWidth();
21	const GLOBAL_NAV 			= $(".gl-nav");
22	const GLOBAL_MENU 			= $(".gl-menu");
23	const GLOBAL_MENU_ITEM 		= $(".gl-menu-item");
24	const GLOBAL_SUBMENU 		= $(".gl-menu-sub");
25	const GLOBAL_SUBMENU_ITEM 	= $(".gl-menu-sub-item");
26	const GLOBAL_MENU_BTN 		= $(".gl-menu-btn");
27	const GLOBAL_MENU_BTN_WIDTH	= GLOBAL_MENU_BTN.outerWidth();
28
29	// section codes for this page
30	const CODE_SECTION 			= GLOBAL_MENU.data("main-code");			// 1ì°¨
31	const CODE_SECTION_SUB 		= GLOBAL_MENU.data("sub-code");				// 2ì°¨
32	// const CODE_SECTION_SRN 		= GLOBAL_MENU.data("serial-code");			// 연재
33	const CODE_SECTION_MULTI 	= GLOBAL_MENU.data("multi-code");			// 다중섹션
34
35	// data attr for design options
36	const DESIGN_INDEX 			= GLOBAL_MENU.data("menu-index");
37	const DESIGN_OVER 			= GLOBAL_MENU.data("menu-over");
38	const DESIGN_HOLD 			= GLOBAL_MENU.data("menu-holder");
39	const DESIGN_DIR 			= GLOBAL_MENU.data("menu-direction");
40	const DESIGN_SIZE 			= GLOBAL_MENU.data("menu-size");
41	const DESIGN_POSI 			= GLOBAL_MENU.data("menu-position");
42	const DESIGN_EFFECT 		= GLOBAL_MENU.data("menu-effect");
43	const DESIGN_SPEED 			= GLOBAL_MENU.data("menu-speed");
44
45	// 디자인 형태
46	if(DESIGN_DIR == "vertical") {
47		GLOBAL_SUBMENU.each(function() {
48			GLOBAL_SUBMENU.addClass("gl-menu-vert");
49		});
50	}
51
52	// 사이즈
53	if(DESIGN_SIZE) {
54		USER_HEADER.addClass(DESIGN_SIZE);
55	}
56
57	// 2차메뉴 에니메이션(효과)
58	if(DESIGN_EFFECT) {
59		GLOBAL_MENU.addClass("gl-menu-animate");
60	}
61
62	// 첫 페이지 고정일 경우
63	function _indexholder(boolean) {
64		if(boolean) {
65			if((CODE_SECTION.indexOf("index") == 1 || CODE_SECTION == "/" || CODE_SECTION == "/news/articleList.html" || CODE_SECTION == "/edit/webPublishing.php") && CODE_SECTION_MULTI == "") {
66				GLOBAL_MENU_ITEM.removeClass("active show").first().attr("aria-current", "page").addClass("active");
67
68				if(DESIGN_HOLD) {
69					GLOBAL_MENU_ITEM.filter("[aria-current=page]").addClass("show");
70				}
71			}
72		}
73	}
74	_indexholder(DESIGN_INDEX);
75
76	// 1차메뉴가 선택된 페이지와 같을 경우
77	GLOBAL_MENU_ITEM.each(function(i, e){
78		const _this 		= $(e);
79		const _datacode 	= _this.data("menu-code");
80		const _menuwidth 	= (USER_WIDTH - GLOBAL_MENU_BTN_WIDTH);
81		const _offsetx 		= _this.position().left;
82		const _subwidth 	= _this.find(".gl-menu-sub").outerWidth();	
83
84		// position
85		if(DESIGN_DIR == "horizon") {
86			if(DESIGN_POSI == "center") {
87				const _thissubwidth = (_menuwidth - _offsetx);
88				if(_subwidth > _offsetx || _subwidth > _thissubwidth) {
89					_this.find(".gl-menu-sub")
90					.attr("style", "--nd-menu-sub-offset-x:" + Math.ceil(_offsetx * -1) + "px;")
91					.css({
92						"max-width": _menuwidth,
93						"transform": "none"
94					});
95				}
96			} else if(DESIGN_POSI == "right") {
97				if(_subwidth > _offsetx) {
98					_this.find(".gl-menu-sub")
99					.attr("style", "--nd-menu-sub-offset-x:" + Math.ceil(_offsetx * -1) + "px;")
100					.css({
101						"max-width": _menuwidth,
102						"right": "auto"
103					});
104				}
105			} else {
106				const _thissubwidth = (_subwidth + _offsetx);
107				if(_thissubwidth > _menuwidth) {
108					_this.find(".gl-menu-sub")
109					.attr("style", "--nd-menu-sub-offset-x:" + Math.ceil(_offsetx * -1) + "px;")
110					.css("max-width", _menuwidth);
111				}
112			}
113		}
114
115		if(DESIGN_OVER) {
116			if(CODE_SECTION == _datacode) {
117				_this.attr("aria-current", "page").addClass("active");
118				
119				if(DESIGN_HOLD) {
120					_this.addClass("active show");
121				}
122			} else {
123				_indexholder(DESIGN_INDEX);
124			}		
125		}
126	});
127
128	// 2차섹션
129	GLOBAL_SUBMENU_ITEM.each(function(i, e) {
130		const _this 	= $(e);
131		const _datacode = _this.data("menu-code");
132
133		if(DESIGN_EFFECT) {
134			_this.closest(".gl-menu-sub").css("transition-duration", (DESIGN_SPEED * 0.001) + "s");
135		}
136
137		// [menuOverHold]이 [false]일때 작동 안함.
138		if(!DESIGN_OVER) return true;
139
140		if(CODE_SECTION_SUB == _datacode) {
141			_this.addClass("is-current");
142		} else {
143			_this.removeClass("is-current");
144		}
145	});
146
147	// hover options
148	GLOBAL_MENU_ITEM.on({
149		"mouseenter focus": function(e) {
150			const _this 	= $(e.currentTarget);			
151		
152			e.preventDefault();
153			GLOBAL_MENU_ITEM.removeClass("active show");
154			_this.addClass("active show");
155
156			if(DESIGN_DIR == "horizon") {
157				GLOBAL_NAV.addClass("active");
158			}
159		},
160		"mouseleave focusout": function(e) {
161			e.preventDefault();
162			GLOBAL_MENU_ITEM.removeClass("active show");
163
164			if((CODE_SECTION.indexOf("index") == 1 || CODE_SECTION == "/" || CODE_SECTION == "/news/articleList.html" || CODE_SECTION == "/edit/webPublishing.php") && CODE_SECTION_MULTI == "") {
165				if(DESIGN_INDEX) {
166					GLOBAL_MENU_ITEM.filter("[aria-current=page]").addClass("active");
167	
168					if(DESIGN_HOLD) {
169						GLOBAL_MENU_ITEM.filter("[aria-current=page]").addClass("show");
170					}
171				}
172			} else {
173				if(DESIGN_OVER) {
174					GLOBAL_MENU_ITEM.filter("[aria-current=page]").addClass("active");
175	
176					if(DESIGN_HOLD) {
177						GLOBAL_MENU_ITEM.filter("[aria-current=page]").addClass("show");
178					}
179				}
180			}
181
182			if(DESIGN_DIR == "horizon") {
183				GLOBAL_NAV.removeClass("active");
184			}
185		}
186	});
187});

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.