1$(window).on("load", onLoad) 2 .on("resize", onResize) 3 .on("scroll", onScroll); 4 5var windowWidth = $(window).outerWidth(); 6var windowHeight = $(window).outerHeight(); 7var pageURL = document.URL; 8function onLoad() 9{ 10 windowWidth = $(window).outerWidth(); 11 windowHeight = $(window).outerHeight(); 12 if (viewportWidth() > 768) 13 { 14 pageMode = "pc"; 15 }else{ 16 pageMode = "mobile"; 17 } 18 19 pageURL = document.URL; 20 subMenuSet(); 21} 22 23var pageMode = "pc"; 24var modeChange = false; 25function onResize() 26{ 27 windowWidth = $(window).outerWidth(); 28 windowHeight = $(window).outerHeight(); 29 30 modeChange = false; 31 if (viewportWidth() > 768 && pageMode == "mobile") 32 { 33 pageMode = "pc"; 34 modeChange = true; 35 }else if (viewportWidth() < 769 && pageMode == "pc"){ 36 pageMode = "mobile"; 37 modeChange = true; 38 } 39 40 if (modeChange) 41 { 42 if (pageMode == "pc") 43 { 44 }else if (pageMode == "mobile") 45 { 46 } 47 } 48} 49 50var scrollTop = 0; 51function onScroll() 52{ 53 scrollTop =$(window).scrollTop(); 54 if ($(".menu-bar").length > 0) 55 { 56 //var chkTop = $(".sub-kv").offset().top + $(".sub-kv").outerHeight(); 57 var headerTop = $("header").offset().top + $("header").outerHeight(); 58 if (scrollTop > headerTop) 59 { 60 $(".menu-bar").css({"position":"fixed", "top":"0", "left":"0", "width":"100%"}); 61 $("section").eq(0).css({"margin-top":"50px"}); 62 }else{ 63 $(".menu-bar").css({"position":""}); 64 $("section").css({"margin-top":""}); 65 } 66 } 67} 68 69$(function(){ 70 $("header .menu-btn").click(function(){ 71 if ($("header .open-menu").hasClass("open")) 72 { 73 $("body").css({"position":""}); 74 $(".dimmed").animate({"opacity":0},500,function(){ 75 $(this).css({"display":"none"}); 76 }); 77 $("header .open-menu").removeClass("open").animate({"opacity":0},500,function(){ 78 $(this).css({"display":"none"}); 79 }); 80 }else{ 81 $("body").css({"position":"fixed"}); 82 $("header .open-menu").addClass("open").css({"display":"block", "opacity":0}).animate({"opacity":1},500); 83 $(".dimmed").css({"display":"block", "opacity":0}).animate({"opacity":1},500); 84 } 85 86 return false; 87 }); 88 89 $("header .close-btn button").click(function(){ 90 $("body").css({"position":""}); 91 $(".dimmed").animate({"opacity":0},500,function(){ 92 $(this).css({"display":"none"}); 93 }); 94 $("header .open-menu").removeClass("open").animate({"opacity":0},500,function(){ 95 $(this).css({"display":"none"}); 96 }); 97 return false; 98 }); 99 100 $(".menu-bar .depth .btn").click(function(){ 101 if ($(this).parent().hasClass("active")) 102 { 103 $(this).parent().removeClass("active"); 104 $(this).parent().find("> ul").animate({"opacity":0},300,function(){ 105 $(this).css({"display":"none"}); 106 }); 107 }else{ 108 $(".menu-bar .depth").removeClass("active"); 109 $(".menu-bar .depth > ul").animate({"opacity":0},300,function(){ 110 $(this).css({"display":"none"}); 111 }); 112 $(this).parent().addClass("active"); 113 $(this).parent().find("> ul").css({"display":"block", "opacity":0}).stop().animate({"opacity":1},300); 114 } 115 }); 116 117 var clickPath = null; 118 function clickMenuEvent() { 119 if ($(clickPath[0]).hasClass('depth') || !clickPath.some(function(path) { 120 return $(path).hasClass("depth"); 121 })) { 122 $(".menu-bar .depth").removeClass("active"); 123 $(".menu-bar .depth > ul").animate({"opacity":0},300,function(){ 124 $(this).css({"display":"none"}); 125 }); 126 $(".menu-bar").addClass("active"); 127 $(".menu-bar").find("> ul").css({"display":"block", "opacity":0}).stop().animate({"opacity":1},300); 128 } 129 } 130 function touchStartEvent(event) { 131 if (event.path === void 0) { 132 event.path = event.composedPath(); 133 } 134 clickPath = event.path; 135 } 136 window.addEventListener('click', clickMenuEvent); 137 window.addEventListener((window.ontouchstart === null ? 'touchstart' : 'mousedown'), touchStartEvent); 138 139 $("header .open-menu .open-menu-inner ul li a.open-title").click(function(){ 140 if (viewportWidth() < 769) 141 { 142 if (!$(this).parent().hasClass("out-link")) 143 { 144 if ($(this).parent().hasClass("active")) 145 { 146 $(this).parent().removeClass("active"); 147 }else{ 148 $("header .open-menu .open-menu-inner ul li").removeClass("active"); 149 $(this).parent().addClass("active"); 150 } 151 152 gnbReload(); 153 return false; 154 } 155 } 156 }); 157 158 $(".link-tab ul li a").click(function(){ 159 if ($(".link-tab").hasClass("active")) 160 { 161 $(".link-tab").removeClass("active"); 162 }else{ 163 $(".link-tab").addClass("active"); 164 } 165 }); 166 167 $(".tab-menu ul li a").click(function(){ 168 if ($(".tab-menu").hasClass("active")) 169 { 170 $(".tab-menu").removeClass("active"); 171 }else{ 172 $(".tab-menu").addClass("active"); 173 } 174 175 if (!$(this).parent().hasClass("active")) 176 { 177 var clickIndex = $(this).parent().index(); 178 $(".tab-menu ul li").removeClass("active"); 179 $(this).parent().addClass("active"); 180 $(".tab-cont").removeClass("active"); 181 $(".tab-cont").eq(clickIndex).addClass("active"); 182 } 183 return false; 184 }); 185 186 var clickPath = null; 187 function clickEvent() { 188 if (!clickPath.some(function(path) { 189 return $(path).hasClass("link-tab"); 190 })) { 191 $('.link-tab.active').removeClass('active'); 192 } 193 } 194 function touchStartEvent(event) { 195 if (event.path === void 0) { 196 event.path = event.composedPath(); 197 } 198 clickPath = event.path; 199 } 200 window.addEventListener('click', clickEvent); 201 window.addEventListener((window.ontouchstart === null ? 'touchstart' : 'mousedown'), touchStartEvent); 202}); 203 204function subMenuSet() 205{ 206 if ($(".menu-bar").length > 0) 207 { 208 /*$(".menu-bar .depth1 ul li").each(function(){ 209 if (document.URL.indexOf($(this).find("a").attr("href")) > -1) 210 { 211 $(this).parents(".depth").find("> a").text($(this).find("a").text()); 212 } 213 });*/ 214 215 $(".menu-bar .depth2 ul li").each(function(){ 216 var groupURL = $(this).find("a").attr("href").split("/"); 217 var reURL = ""; 218 //var maxLength = groupURL.length > 3 ? 3 : groupURL.length; 219 var maxLength = Math.min(3, groupURL.length); 220 if (groupURL[1].match(/chn|eng/)) { 221 maxLength++; 222 } 223 for (var i = 1;i < maxLength ; i++ ) 224 { 225 reURL += "/" + groupURL[i]; 226 } 227 228 if (document.URL.indexOf(reURL) > -1) 229 { 230 $(this).parents(".depth").find("> a").text($(this).find("a").text()); 231 } 232 }); 233 } 234} 235 236// GNB Inner Scroll 237$(function() { 238 var header = $('header'); 239 240 header.menu = header.find('.open-menu'); 241 242 function resetScrollbar() { 243 if (header.menu.is('.mCustomScrollbar')) { 244 header.menu.css({'height': '', 'max-height': ''}); 245 header.menu.mCustomScrollbar('destroy'); 246 } 247 } 248 249 function generateScrollbar() { 250 header.menu.mCustomScrollbar({ 251 axis: 'y', 252 theme: 'dark-2', 253 mouseWheelPixels: 300, 254 scrollInertia: 200 255 }); 256 } 257 258 function loadGnb() { 259 if (page.mode === 'm') { 260 gnbReload(); 261 } 262 } 263 264 function resizeGnb() { 265 266 if (page.modeChanged || page.modeChanged === void 0) { 267 if (page.mode === 'pc') { 268 resetScrollbar(); 269 } 270 } 271 272 if (page.mode === 'm') { 273 gnbReload(); 274 } 275 } 276 277 function gnbReload() { 278 resetScrollbar(); 279 280 header.menu.css({'height': header.menu.height() + 1, 'max-height': page.height - header.height()}); 281 282 generateScrollbar(); 283 }; 284 285 window.addEventListener('load', loadGnb); 286 window.addEventListener('resize', resizeGnb); 287 288 window.gnbReload = gnbReload; 289}); 290 291function viewportWidth() 292{ 293 if (typeof document.documentElement.clientWidth != 'undefined' && typeof window.innerWidth != 'undefined') 294 { 295 if(document.documentElement.clientWidth > window.innerWidth) 296 return document.documentElement.clientWidth; 297 else 298 return window.innerWidth; 299 }else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) 300 { 301 return document.documentElement.clientWidth; 302 }else{ 303 return viewportwidth = document.getElementsByTagName('body')[0].clientWidth; 304 } 305}
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.