PageSourceSearch

https://www.douzone.com/html/js/ui.js

js douzone.com collected 2026-10-02 03:31:41 UTC 14,699 bytes, 500 lines download raw bytes

1var Init = {
2	defaults : function(){
3		var bodyHeight = 0;
4		var bodyWidth = 0;
5		var breakpoint; 
6		this.scrollDirection();
7		this.resize();
8		window.addEventListener("resize", this.resize);
9	},
10	scrollDirection : function(){
11		window.__scrollPosition = document.documentElement.scrollTop || 0;
12		window.__scrollPosition = $(window).scrollTop() || 0;
13
14		document.addEventListener('scroll', function() {
15			var _documentY = document.documentElement.scrollTop;
16			var _direction = _documentY - window.__scrollPosition >= 0 ? 1 : -1;
17/*
18			if(_direction === 1){
19				$('html').removeClass('is-scroll-up');
20				$('html').addClass('is-scroll-down');
21			}else if(_direction === -1){
22				$('html').removeClass('is-scroll-down');
23				$('html').addClass('is-scroll-up');
24			}
25*/
26			if(_documentY - window.__scrollPosition > 0) {
27				$('html').removeClass('is-scroll-up');
28				$('html').addClass('is-scroll-down');
29			} else if(_documentY - window.__scrollPosition < 0) {
30				$('html').removeClass('is-scroll-down');
31				$('html').addClass('is-scroll-up');
32			}
33//			console.log(_direction);
34//			console.log(_documentY + "/" + window.__scrollPosition);
35
36			window.__scrollPosition = _documentY; // Update scrollY
37		});
38	},
39	resize : function(){
40		Init.getBrowserSize();
41		Init.drawBreakPoint();
42
43		Init.breakpoint = window.matchMedia('(min-width:992px)').matches;
44		if(!Init.breakpoint){
45			$('html').removeClass('is-desktop');
46			$('html').addClass('is-mobile');
47		}else{
48			$('html').removeClass('is-mobile');
49			$('html').addClass('is-desktop');
50		}
51	},
52	getBrowserSize : function(){
53		this.bodyHeight = Math.max(
54			document.body.scrollHeight,
55			document.body.offsetHeight,
56			document.documentElement.clientHeight,
57			document.documentElement.scrollHeight,
58			document.documentElement.offsetHeight
59		);
60		this.bodyWidth = Math.max(
61			document.body.scrollWidth,
62			document.body.offsetWidth,
63			document.documentElement.clientWidth,
64			document.documentElement.scrollWidth,
65			document.documentElement.offsetWidth
66		);
67	},
68	drawBreakPoint : function(){
69		$('html').attr('data-width',this.bodyWidth);
70		$('html').attr('data-height',this.bodyHeight);
71	},
72};
73
74var Header = {
75	init : function(){
76		/* 201116 수정 */
77		this.gnb();
78		this.lang();
79		this.sitemap();
80        this.scrolling();
81		window.addEventListener('mousewheel', Header.scrolling);
82		window.addEventListener('touchmove', Header.scrolling);
83
84		$(window).scroll(function(){
85			Header.scrolling();
86		});
87
88
89	},
90	scrolling : function(e){
91		var scrollTop = $(window).scrollTop();
92
93		if(scrollTop > 0){
94			$('html').addClass('is-scrolled');
95		}else{
96			$('html').removeClass('is-scrolled');
97		}
98
99		if(scrollTop > 85){
100			$('html').addClass('header-hidden');
101		}else{
102			$('html').removeClass('header-hidden');
103		}
104
105		if($('.tab').length > 0){
106			if(scrollTop > $('.tab').offset().top + 70){
107				$('html').addClass('depth2-show');
108			}else{
109				$('html').removeClass('depth2-show');
110			}
111		}
112	},
113	/* 201116 추가 */
114	gnb : function(e){
115
116		var bodyHeight = $(document).height();
117		var bodyWidth = $(document).width();
118		$(".gnb_dim").css({"width":bodyWidth,"height":bodyHeight});
119		//$(".gnb-sub").css({"width":bodyWidth}); 2023-02-03
120		$(".m_gnb_dim").css({"width":bodyWidth,"height":bodyHeight});
121
122
123			$(".gnb ul li a").on("mouseenter focus", function () {
124				$(".gnb_dim").css({"width":$(document).width(),"height":$(document).height()});
125				//$(".gnb_sub").css({"width":$(document).width()}); 2023-02-03
126				$(".m_gnb_dim").css({"width":$(document).width(),"height":$(document).height()});
127				$(".gnb_dim").addClass("on");
128			});
129			$(".gnb").on("mouseleave", function () {
130				$(".gnb_dim").removeClass("on");
131			});
132
133		//메인 미디어룸, 지속가능경영
134		if($(".body-main").length>0){
135			$(document).ready(function(){
136				var se1 = $("#sec1").offset().top;
137				var se2 = $("#sec2").offset().top; //색변
138				var se3 = $("#sec3").offset().top;
139				var se4 = $("#sec4").offset().top; //색변
140
141				$(document).scroll(function(){
142					if($(window).scrollTop() >= se1 && $(window).scrollTop() <= se2){
143						$("header").removeClass("h_ch");
144					}else if($(window).scrollTop() >= se2 && $(window).scrollTop() <= se3){
145						$("header").addClass("h_ch");
146					}else if($(window).scrollTop() >= se3 && $(window).scrollTop() <= se4){
147						$("header").removeClass("h_ch");
148					}else if($(window).scrollTop() >= se4){
149						$("header").addClass("h_ch");
150					}else{
151						$("header").removeClass("h_ch");
152					}
153				});
154			});
155		}
156	
157
158		//메인 gnb hover 변경*/
159		/*$(".body-main").find(".gnb ul li a").on('mouseenter focus',function(){
160			$(this).parents(".gnb").css("background","#fff");
161			$(".body-main .gnb").find("ul li a").css("color","#000");
162			$(this).parents().find(".logo a").css({"background-image":"url(../html/images/lg-douzone-color.svg)"});
163			$(this).parents().find(".btn-solution button").css("background","#00aaf0").css("color","#fff").addClass("hover");
164			$(this).parents().find(".util .btn-lang button").css("border-color","#000").css("color","#000").addClass("hover");	
165			
166			
167		});
168		$(".body-main").find(".gnb").on('mouseleave',function(){
169			$(this).css("background","transparent");
170			$(this).parents().find(".btn-solution button").css("background","#fff").css("color","#000").removeClass("hover");
171			$(this).parents().find(".logo a").css({"background-image":"url(../html/images/lg-douzone-white.svg)"});
172			$(this).parents().find(".util .btn-lang button").css("border-color","#fff").css("color","#fff");		
173			$(".body-main .gnb").find("ul li a").css("color","#fff");
174			$(this).parents().find(".util .btn-lang button").removeClass("hover");	
175
176		});*/
177
178		$('.gnb > ul > li > a').on('mouseenter focus',function(){
179			$(this).closest('li').siblings().find('.gnb-sub-group').hide();
180			$(this).next('.gnb-sub').fadeIn(0);
181			$(this).next('.gnb-sub').find('.gnb-sub-group').fadeIn(150);
182			
183		});
184
185		$('.gnb').on('mouseleave',function(){
186			$(this).find('.gnb-sub').fadeOut(150);
187			$(this).find('.gnb-sub-group').fadeOut(150);
188			
189		
190		});
191		$('.gnb > ul > li:last-child .depth2 li:last-child').on('focusout',function(){
192			$(this).find('.gnb-sub').fadeOut(150);
193			$(this).find('.gnb-sub-group').fadeOut(150);
194		});
195	},
196
197	lang: function(e){
198		$('.btn-lang button').on('mouseenter focus',function(){
199			$('.btn-lang').addClass('active');
200		});
201		$('.btn-lang').on('mouseleave',function(){
202			$('.btn-lang').removeClass('active');
203		});
204		$('.lang li:last-child').on('focusout',function(){
205			$('.btn-lang').removeClass('active');
206		});
207		$('.btn-solution button').on('mouseenter focus',function(){
208			$('.btn-solution').addClass('active');
209		});
210		$('.btn-solution').on('mouseleave',function(){
211			$('.btn-solution').removeClass('active');
212		});
213		$('.lang li:first-child').on('focusout',function(){
214			$('.btn-solution').removeClass('active');
215		});
216	},
217	sitemap: function(e){
218		$('.gnb .gnb-sub').each(function(){
219			$('.sitemap-body').append($(this).html());
220		});
221		$('.all').on('click',function(e){
222			e.preventDefault();
223			$('html').addClass('sitemap-open');
224		});
225		$('.sitemap .close').on('click',function(){
226			$('.sitemap-body').scrollTop(0);
227			$('html').removeClass('sitemap-open');
228		});
229	}
230	/* //201116 수정 */
231};
232
233var Common = {
234	init : function(){
235        this.revealed();
236
237        //select
238		if ($.fn.selectmenu) $('select').selectmenu();
239	},
240	revealed : function(){
241		$('[data-event="revealed"]').each(function (i) {
242			if ($(window).scrollTop() + $(window).height() > $(this).offset().top + $(this).outerHeight()) {
243				$(this).removeClass('in');
244			}
245		});
246		$(window).scroll(function () {
247			$('[data-event="revealed"]').each(function (i) {
248				if (($(window).scrollTop() + $(window).height()) - ($(window).height() / 3) > $(this).offset().top) {
249					$(this).removeClass('in');
250				}
251			});
252		});
253		//counter animation
254		var countFlag = false;
255		$(window).scroll(function () {
256			$('.count').not('.finish').each(function() {
257				if (($(window).scrollTop() + $(window).height()) - ($(window).height() / 4) > $(this).offset().top) {
258					var $this = $(this),
259						countTo = $this.attr('data-count');
260					$this.addClass('finish');
261					$({
262						countNum: $this.text()
263					}).stop().animate({
264							countNum: countTo
265						},
266						{
267							duration: 500,
268							easing: 'linear',
269							step: function() {
270								$this.text(commaSeparateNumber(Math.floor(this.countNum)));
271							},
272							complete: function() {
273								$this.text(commaSeparateNumber(this.countNum));
274								//$this.addClass('finish');
275							}
276						}
277					);
278				};
279				function commaSeparateNumber(val) {
280					while (/(\d+)(\d{3})/.test(val.toString())) {
281						val = val.toString().replace(/(\d+)(\d{3})/, '$1' + ',' + '$2');
282					}
283					return val;
284				}
285			});
286		});
287    },
288};
289
290$('#header-block').load('../_include/header.html');
291$('#footer-block').load('../_include/footer.html');
292
293$(function() {
294
295	Init.defaults();
296
297	
298		Common.init();
299		Header.init();
300
301		if ($.fn.selectmenu) $('select').selectmenu({
302		  change: function( event, ui ) {
303			  if(this.name == "s_year") {
304				  document.forms['form1'].submit();
305			  }
306			  if(this.name == "s_month") {
307				  document.forms['form1'].submit();
308			  }
309			  if(this.name == "s_category_id") {
310				  document.forms['form1'].submit();
311			  }
312			  if(this.name == "s_product_type") {
313				  document.forms['form1'].submit();
314			  }
315			  if(this.name == "s_module_type") {
316				  document.forms['form1'].submit();
317			  }
318			  if(this.name == "s_client_type") {
319				  document.forms['form1'].submit();
320			  }
321
322
323			  if(this.name == "golocation") {
324				  window.open(this.value);
325			  }
326
327			  if(this.name == "email3") {
328				  document.forms['form1']['email2'].value = this.value;
329				  document.forms['form1']['email2'].focus();
330			  }
331			  if(this.name == "s_cyear") {
332				 document.forms['form1'].submit();
333			  }
334		  }
335		});
336
337
338
339	$(".page_box ul li").each(function() {
340
341		if($(this).children("div").hasClass("page_first_btn")) {
342			$(this).css("display", "none");
343		}
344		if($(this).children("div").hasClass("page_p_btn")) {
345			$(this).css("display", "none");
346		}
347		if($(this).children("div").hasClass("page_n_btn")) {
348			$(this).css("display", "none");
349		}
350		if($(this).children("div").hasClass("page_last_btn")) {
351			$(this).css("display", "none");
352		}
353	});
354
355});
356
357
358
359	 //모바일 메뉴
360	$(document).ready(function(){
361		var bodyHeight = $(document).height();
362		var bodyWidth = $(document).width();
363		var clickEvent = (function() {
364		
365		$(".m_gnb_dim").css({"width":bodyWidth,"height":bodyHeight});
366			if ('ontouchstart' in document.documentElement === true) {
367			return 'touchstart';
368			} else {
369			return 'click';
370			}
371		})();
372
373		$(document).on("click", ".m_btn_gnb", function() {
374			$(this).toggleClass("open")
375			$("body.body-main").css("overflow","hidden");
376			$(".m_gnb_wrap").addClass("on");
377			$(".m_gnb_dim").addClass("on");
378			$(".header .logo").addClass("on");
379			$(".m_btn_clse").addClass("on");
380		});
381		$(document).on("click", ".m_btn_clse", function() {
382			$(".m_gnb_wrap").removeClass("on");
383			$(".m_gnb_dim").removeClass("on");
384			$(".header .logo").removeClass("on");
385			$(".m_btn_clse").removeClass("on");
386		});
387
388		$(document).on("click", ".m_depth1 > li", function() {
389			$(this).children(".m_depth2").stop().slideToggle();
390			$(this).toggleClass("active");
391			$(this).siblings("li").children(".m_depth2").stop().slideUp();
392		});
393
394		$(document).on("click", ".m_depth2 >li", function(e) {
395			 e.stopPropagation();
396			$(this).children(".m_depth3").stop().slideToggle();
397			$(this).siblings("li").children(".m_depth3").stop().slideUp();
398		});
399
400		$(document).mouseup(function (e){
401		  var closeWrap = $(".m_gnb_wrap");
402		  if(closeWrap.has(e.target).length === 0){
403			closeWrap.removeClass("on");
404			$(".m_gnb_dim").removeClass("on");
405			$(".header .logo").removeClass("on");
406			$(".m_btn_clse").removeClass("on");
407		  }
408		});
409	});
410
411	//m_lang
412	$(document).on('click', '.m_lang', function() {
413		$(this).toggleClass("on");
414	});
415
416	//m_solution
417	$(document).on('click', '.m_solution', function() {
418		$(this).toggleClass("on");
419	});
420	 
421
422	$(document).ready(function(){
423
424		//footer family 버튼
425		$(".family_btn").on("click", function() {
426			$(this).toggleClass("on");
427			$(this).parents("dt").siblings("dd").toggleClass("on");
428		});
429		//top 버튼
430		$(".go-top").click(function () {
431			  $("body,html").animate({
432				  scrollTop: 0
433			  }, 800); 
434			  return false;
435		  });
436
437	});
438	
439	$(function(){
440		var tabObj = $('.tab li');
441		var tabObj2 = $('.sub-tab li');
442		if (tabObj.length){
443			//모바일 depth2 tab 스크롤
444			var m_depth2 = 0; 
445			$(".tab li").each(function(index){
446				if($(this).hasClass("active")) m_depth2 = index; 
447			});
448			var tab_left1 = $(".tab li").eq(m_depth2).offset().left; 
449			$(".depth2_box").scrollLeft(tab_left1); 
450		}
451		if (tabObj2.length){
452			//모바일 depth3 tab
453			var m_depth3 = 0; 
454			$(".sub-tab li").each(function(index){
455				if($(this).hasClass("active")) m_depth3 = index; 
456			});
457			var tab_left2 = $(".sub-tab li").eq(m_depth3).offset().left; 
458			$(".sub-tab-box").scrollLeft(tab_left2); 
459		}		
460	});
461	
462	//main 베너 footer 멈추기
463	$(document).ready(function(){
464		$(window).scroll(function(){
465			var val = $(document).height() - $(window).height() - $(".footer").outerHeight();
466			  if($(window).scrollTop() >= val){
467				$(".main_banner").addClass("on");
468			  }else{
469				$(".main_banner").removeClass("on");
470			  }
471		});
472	})
473
474	$(document).ready(function(){
475		$(window).scroll(function(){   
476			if($(window).scrollTop() > 120){
477				$(".main_ttp.pc-banner-img").css('display', 'none');
478			}else if($(window).scrollTop() === 0 ){
479				$(".main_ttp.pc-banner-img").css('display', 'block');
480			}
481		});
482	});
483
484  function setCookie( name, value, expiredays ) {
485	var todayDate = new Date();
486	todayDate.setDate( todayDate.getDate() + expiredays );
487	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
488  }
489
490$(document).ready(function(){
491	$("#day-close").click(function(){
492		if($("#day-close").is(':checked')){
493			setCookie( "topPop", "done" , 1 );
494		}
495		$('#popWrap001').slideUp(500);
496	});
497	$(".close-btn").click(function(){
498		$('#popWrap001').slideUp(500);
499	});
500});

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.