PageSourceSearch

http://www.hanjin.com/resources/_Templet/Layout/layout_kor/Js/layout_sub.js

js hanjin.com collected 2026-09-24 17:58:26 UTC 11,637 bytes, 375 lines download raw bytes

1var _isLowBr_ = false,_isMobile_ = false;
2var _thisPage_cfg  = {};
3//레이아웃 셋팅(로딩완료된 후에만 1번만 처리)
4function initPageLayout(){
5	resetTabSize(); // 탭메뉴 사용시 주석제거
6	setContAutoWidth();
7	_setLayoutFooter();
8	resetImgZoom();
9}
10//레이아웃 리셋
11function resetPageLayout(){
12	mainNavi._reset();
13	resetTabSize();   // 탭메뉴 사용시 주석제거
14	resetImgZoom();
15	setContAutoWidth();
16	_resetFooterHeight();
17}
18
19
20//레이아웃 높이 리셋
21function resizePageLayoutHeight(){
22}
23////////////////////////////////////////////////////
24//윈도우 회전시 실행할 함수
25function setWindowRotation(){
26	if(typeof(thisPageRotation)=="function" && thisPageRotation!=undefined){  thisPageRotation(); }
27	else {
28		//기본 회전시 실행할 함수
29		//resetPageLayout();
30	}
31}
32//document.addEventListener('DOMContentLoaded', loaded, false);
33if('onorientationchange' in window){
34	window.addEventListener('onorientationchange', setWindowRotation, false);
35}
36////////////////////////////////////////////////////
37$(document).ready(function(){
38	console.log("1.Ready");
39
40	try{getWindowSize();	}catch(e){}
41	try{getPageSize();	}catch(e){}
42	if(_isMobile_) $alertLoading("Page Loading...");
43	try{setLowBrowser();	}catch(e){	}
44	try{setMediaObjectFunc();	}catch(e){	}
45	try{ _thisLayout_style = getPageStyle(); }catch(e){}
46	try{ resetTabSize(); }catch(e){}
47	initNavigation();
48	docLoading(function(){
49		console.log("3.docLoad");
50		initImgSizeInfo();
51		initPageLayout();
52		resetImgZoom();
53	});
54	subUtil.hideImg();
55	subUtil.tabIsFull();
56	subUtil.tabDetect();
57	sideMenu.init();
58	//subUtil.navArrSet();
59});
60$(window).load(function(){
61	console.log("2.Load");
62});
63$(window).resize(function(e){
64	//var resizeTimeGap = (_isLowBr_)?  250 : 10;
65	var resizeTimeGap = 10;
66	if(_isLowBr_) resizeTimeGap=100;
67	clearTimeout(window.resizeEvt);
68	window.resizeEvt = setTimeout(function()
69	{
70		//console.log("Resize" );
71		getWindowSize();getPageSize();
72		try{
73		if(old_wsize.win== undefined ||  wsize.win.w!=old_wsize.win.w){
74			resetPageLayout();
75		}else{
76			resizePageLayoutHeight();
77		}
78		}catch(e){
79			resetPageLayout();
80		}
81	}, resizeTimeGap);
82});
83$(window).scroll(function(){
84	clearTimeout(window.scrollEvt);
85	window.scrollEvt = setTimeout(function() {
86		////srolling
87	}, 250);
88});
89try {
90	$(window).scrollStopped(function(){
91		//end sroll
92	});
93} catch(e){}
94
95
96
97
98// ** sns 공유
99function snsToggle(){
100	if($(".cont-ctrl-btns .btn-share").hasClass("is-open")){
101		$(".sns-list").slideUp(300);
102		$(".cont-ctrl-btns .btn-share").removeClass("is-open");
103	} else {
104		$(".sns-list").slideDown(300);
105		$(".cont-ctrl-btns .btn-share").addClass("is-open");
106		
107		var pageurl = location.href;
108		if(pageurl =='https://www.hanjin.co.kr/kor/CMS/DeliveryMgr/WaybillResult.do'){
109			$('#kakaolink').css("display","none");
110		}
111	}
112}
113
114// ** URL 복사
115function urlClipCopy() {
116	var f = document.clipboard.url;
117	f.value = document.location.href;
118	f.select() ;
119	//alert("클립보드로 URL이 복사되었습니다.");
120}
121
122urlClipCopy();
123
124var clipboard = new ClipboardJS('.btn-link');
125clipboard.on('success', function(e) {
126	alert("현재 URL이 복사되었습니다.")
127});
128clipboard.on('error', function(e) {
129	alert("Ctrl + C 를 누르면 복사가 완료됩니다.")
130});
131
132// ** 서브페이지 공통
133var subUtil = {
134	hideImg : function() {	// ** 이미지 없을때
135		$("img").each(function(){
136			var $this = $(this);
137			var wImgObj = $this.attr("src");
138			if ( wImgObj == null || wImgObj == '' ){
139				$this.css("display","none");
140			}
141		});
142	},
143	tabIsFull : function() {
144		$cTabCore = $("body .c-tab01");
145		$cTabStdL = 5;
146		if ( $cTabCore.length > 0 ) {
147			$cTabLInum = $("> ul > li", $cTabCore ).length;
148			if ( $cTabLInum >= $cTabStdL ) {
149				$cTabCore.addClass( "has"+ $cTabLInum );
150			}
151		}
152		$("> ul > li", $cTabCore ).each(function() {
153			//$("span", $(this) ).wrap("<span></span>");
154		});
155	},
156	tabDetect : function() {
157		// ** 게시판페이지이고 게시판탭이 존재할때 #board-wrap 상단패딩 제거.
158		// https://www.hanjin.co.kr/kor/CMS/Board/Board.do?mCode=MN043
159		$boardWrap = $("#board-wrap");
160		$boardTab01 = $(".c-tab01", $boardWrap );
161		if ( $boardWrap.length >= 1 && $boardTab01.length >= 1 ) {
162			$("body").addClass("hasBbsTab");
163		}
164
165		// ** 마이페이지 중 c-tab02 가 있을경우 c-tab02의 상단 마진 추가
166		// https://www.hanjin.co.kr/kor/CMS/MemberMgr/Mypage/agreeModify.do?mCode=MN041
167		$memberWrap = $("#member-box");
168		$memberTab02 = $(".c-tab02");
169		if ( $memberWrap.length >= 1 && $memberTab02.length >= 1 ) {
170			$("body").addClass("hasMemberTab02");
171		}
172	}
173}
174
175//** 사이드메뉴
176var sideMenu = {
177	init : function() {
178		$sideM = $(".cont-side");
179		$sideM_caster = $(".cont-sideCaster", $sideM );
180		$sideMList = $(".cont-side-menu", $sideM);
181		$sideIsClick = false;
182		$sideNum = "";
183
184		$sideMM = $(".cont-side-M");
185		$sideMM_caster = $(".cont-sideCaster", $sideMM );
186		$sideMM_closer_Mflag = $(".cont-side-menu-closer", $sideMM );
187
188		$sideMTarget = $("#contents .cont-wr > h3.c-tit");
189		$pageTitNode = $("#contents .cont-top");
190		$mFlagState = "";
191
192		this.sideMenuSet();
193		this.sideMenuScroll();
194		this.sideOverScroll();
195		this.sideQuick();
196		this.mmPkg();
197	},
198	mmPkg : function() {
199		$(document).on("click", ".cont-side-M .cont-sideCaster", function() {
200			if ( $(this).hasClass("over") ) {
201				$(this).removeClass("over");
202				$(this).next().slideUp()
203			} else {
204				$(this).addClass("over #1");
205				$(this).next().slideDown()
206			}
207		});
208		$(document).on("click", ".cont-side-M li button.anchor", function() {
209			$selTxt = $("span", $(this) ).text();
210			$("span", $(this).closest("div").prev() ).text( $selTxt );
211			if ( $(".cont-side-M .cont-sideCaster").css("display") == "block" ) {
212				$(this).closest("div").prev().trigger("click");
213			} else {
214
215			}
216		});
217		$(document).on("click", ".cont-side-M .cont-side-menu-closer", function() {
218			$(this).parent().prev().trigger("click");
219		});
220
221		$(window).on("load", function() {
222			contWrReCtrl();
223		});
224		$(window).on("resize", function() {
225			contWrReCtrl();
226		});
227		function contWrReCtrl() {
228			$mFlag1 = $(".cont-side-menu-closer").css("display");
229			$mFlag2 = $(".cont-side-M .cont-side-menu").css("position");
230			$activeContLen = $("#cont .cont-wr.over");
231			if ( $activeContLen.length < 1 )	$activeCont = $("#cont .cont-wr#anchor1");
232			else								$activeCont = $("#cont .cont-wr.over");
233			if ( $mFlag1 == "none" ) {			// ** pc
234				$mFlagState = "P";
235				$activeCont.removeClass("mOver");
236
237			} else if ( $mFlag1 == "block" ) {	// ** mobile
238				$mFlagState = "M";
239				$activeCont.addClass("mOver");
240
241			}
242			if ( $mFlag2 == "static" ) {
243				$(".cont-side-M .cont-side-menu").show();
244			} else if ( $mFlag2 == "absolute" ) {
245				$(".cont-side-M .cont-side-menu").hide();
246			}
247		}
248	},
249	sideMenuSet : function() {
250		if ( $sideMTarget.length >= 1 ) {
251			$("body").addClass("hasntPageTitle hasSectionAnchor");
252			var sMenuTxt = "<button type='button' class='cont-sideCaster'><span></span></button>";
253			sMenuTxt += "<div class='cont-side-menu'>";
254			sMenuTxt += "<ul class=''>";
255			$sideMTarget.each(function(idx) {
256				var sideIdx = idx + 1;
257				if(idx == 0) {
258					sMenuTxt += "<li class='first over side-list" + sideIdx + "'>";
259				} else {
260					sMenuTxt += "<li class= side-list"+ sideIdx + ">";
261				}
262				sMenuTxt += "<button type='button' class='anchor'><span class='txt'>" + $(this).text() + "</span></button></li>";
263			});
264			sMenuTxt += "</ul>";
265			sMenuTxt += "<button type='button' class='cont-side-menu-closer'><em class='blind'>닫기</em></button>";
266			sMenuTxt += "</div>";
267			$sideM.prepend(sMenuTxt);
268			$sideMM.prepend(sMenuTxt);
269
270			$("#cont .cont-wr").each(function(a) {
271				var contA = a + 1;
272				$(this).attr('id', 'anchor'+ contA);
273			});
274		} else {
275			$pageTitNode.show();
276		}
277		$(window).on("load", function() {
278			$openingSelectedStr = $(".cont-side .cont-side-menu li.over button span").text();
279			$(".cont-sideCaster span" ).text( $openingSelectedStr );
280		});
281	},
282	sideMenuScroll : function() {
283		var prevSTop = $(window).scrollTop(),
284			nowSTop = $(window).scrollTop(),
285			prevDir = "down",
286			nowDir = "down",
287			sideMTop = parseInt($sideM.css("top"), 10),
288			ftMap= $("#footer-wrap").offset().top - $("#footer-wrap").outerHeight() - $("#header").outerHeight() - sideMTop;
289
290		$(window).on("scroll touchmove", function() {
291			var scrT = nowSTop = $(this).scrollTop();
292			if(nowSTop > prevSTop) {
293				nowDir = "down";
294			} else if (nowSTop < prevSTop) {
295				nowDir ="up";
296			}
297			prevDir = nowDir;
298			prevSTop = nowSTop;
299			var sideT = $sideM.offset().top;
300			var sideB = sideT - $(window).height()+ $sideM.outerHeight();
301			//console.log("sideT" + sideT + "sideB" + sideB + "ft" + ftMap+ "//" + scrT);
302			if(ftMap < scrT) {
303				var fixGap = ftMap - scrT + sideMTop;
304				$sideM.css({"top" : fixGap +"px"});
305			}
306		});
307	},
308	sideOverScroll : function() {
309		$scrollFnc = null;
310		$(window).on("scroll", function() {
311			clearTimeout( $scrollFnc );
312			$scrollFnc = setTimeout(
313				function() {
314					var scrT = $(this).scrollTop();
315					var contIdx  = 0;
316					$(".cont-wr").each(function(idx) {
317						var thisLiT = $(this).offset().top - $("#header-wrap").outerHeight();
318						var thisLiH = $(this).offset().top + $(this).outerHeight()- $("#header-wrap").outerHeight();
319						// ** console.log( thisLiT + " / " + scrT );
320						// ** console.log( idx + "idx" + thisLiT + "t // h"  + thisLiH + "// scrT " + scrT);
321						// ** if ( thisLiT <= scrT && scrT < thisLiH ) {
322						if ( Math.floor( thisLiT ) <= scrT && scrT < Math.floor( thisLiH ) ) {
323							contIdx = idx;
324						}
325					});
326					var $sideTxtLi = $("li", $sideM).eq(contIdx);
327					$("li", $sideM ).not( $sideTxtLi ).removeClass("over");
328					$sideTxtLi.addClass("over #2");
329					$("span", $sideTxtLi.closest("ul").prev() ).text( $("span", $sideTxtLi ).text() );
330
331					var $sideTxtLiM = $("li", $sideMM).eq(contIdx);
332					$("li", $sideMM ).not( $sideTxtLiM ).removeClass("over");
333					$sideTxtLiM.addClass("over #3");
334					$("span", $sideTxtLiM.closest("ul").prev() ).text( $("span", $sideTxtLiM ).text() );
335				}
336			, 200 );
337		});
338	},
339	sideQuick : function() {
340		var actList = false;
341		var contIdx = 0;
342		$(document).on("click", ".cont-side-menu > ul > li > button.anchor", function() {
343			if ( !actList ) {
344				actList = true;
345				var $thisLi = $(this).parent();
346
347				$thisLi.addClass("over #4");
348				$thisLi.siblings().removeClass("over");
349				//$("li", $sideM ).not( $thisLi ).removeClass("over");
350
351				contIdx = $thisLi.index();
352				var $contWr = $("#cont .cont-wr");
353				var $contBox = $contWr.eq(contIdx);
354				//var screenGap = ( $(window).height() - ($("#header-wrap").outerHeight() ) ) / 2;
355				//var contBoxGap = $contBox.outerHeight() / 2;
356
357				console.log( "$mFlagState : " + $mFlagState );
358
359				if ( $mFlagState == "P" ) {
360					$("html, body").stop().animate({
361						"scrollTop" : $contBox.offset().top - ($("#header-wrap").outerHeight()) // 한번더 check 필요
362					}, function() {
363						$contBox.addClass("over #5");
364						$contWr.not( $contBox ).removeClass("over");
365						actList = false;
366					});
367				} else if ( $mFlagState == "M" ) {
368					$contBox.addClass("mOver");
369					$contBox.siblings().removeClass("mOver");
370					actList = false;
371				}
372			}
373		});
374	}
375}

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.