1const AC = 'active', 2 FX = 'fixed', 3 ALL = 'all_nav', 4 ScrollNo = 'scroll-no', 5 srOnly = '.sr-only', 6 OpenTxt = 'ì´ê¸°', 7 CloseTxt = 'ë«ê¸°', 8 $html = $('html'); 9 10/* mobile ------------------------------------------------------------------------------ */ 11function mobile() { 12 return window.innerWidth < 1024 ? 1 : 0 //ipad proë ëì´ì webíë©´ì´ ëì¤ê² 13} 14/* initial setup of accessibility ------------------------------------------------------- */ 15function accessInit(el) { 16 $(el).attr('aria-expanded', 'false') 17 //$(el).append('<span class="sr-only">' + OpenTxt + '</span>').attr('aria-expanded', 'false') 18} 19 20/* -------------------------------------------------------------------------------------- 21* íë©´í¬ê¸° 22----------------------------------------------------------------------------------------- */ 23function zoom(el) { 24 const zoomLevels = [0.9, 1, 1.1, 1.2, 1.3], 25 classNames = ['xsm', 'sm', 'md', 'lg', 'xlg'], 26 $item = $(el); 27 let zoom = 1; 28 29 $html.on('click', el, function(){ 30 const $na = $(this); 31 32 $na.attr('aria-selected', true).parent().addClass(AC).siblings().removeClass(AC).children().removeAttr('aria-selected')/*.attr('aria-selected', false)*/ 33 $.each(classNames, function(index, className) { 34 if ($na.hasClass(className)) zoom = zoomLevels[index]; 35 }); 36 //ì´ê¸°í 37 if($na.hasClass('ico-reset')) { 38 $html.css('zoom', 1); 39 $item.eq(1).attr('aria-selected', true).parent().addClass(AC).siblings().removeClass(AC).children().removeAttr('aria-selected')/*.attr('aria-selected', false)*/ 40 } 41 localStorage.setItem('zoomDefault', zoom); 42 $html.css('zoom', zoom); 43 }) 44 45 //ë¡ì»¬ ì ì¥ 46 zoom = localStorage.getItem('zoomDefault') || 1; 47 $html.css('zoom', zoom); 48 $.each(zoomLevels, function (index, zoomLevel){ 49 if(zoom == zoomLevel) $item.eq(index).attr('aria-selected', true).parent().addClass(AC) 50 }) 51} 52 53/* --------------------------------------------------------------------------------------- 54* gnb 55----------------------------------------------------------------------------------------- */ 56function gnb() { 57 const $gnb = $('#head_menu'), 58 $depth1 = $gnb.find('>li>a:not(.linkWindow)'), 59 $depth2 = $gnb.find('.submenu>ul>li>a:not(.linkWindow)'); 60 61 //ì´ê¸°ì í - 1ì°¨ëì¤ ì ê·¼ì±, 2ì°¨ëì¤ ì²«ë²ì§¸ ë©ë´ íì± 62 accessInit($depth1) 63 accessInit($depth2) 64 $gnb.find('>li>a.active').attr('aria-current', 'page') 65 $('.subfirst').addClass(AC).find('>a').attr('aria-expanded', 'true') 66 67 //1ì°¨, 2ì°¨ëì¤ í´ë¦ 68 $depth1.add($depth2).on('click', function(e) { 69 const $na = $(this) 70 71 e.preventDefault() 72 $html.addClass(AC)//ë°°ê²½ dimì²ë¦¬ 73 $na.attr('aria-expanded', 'true').parent().addClass(AC).siblings().removeClass(AC).find('>a:not(.linkWindow)').attr('aria-expanded', 'false') 74 }) 75 76 //2ì°¨ëì¤ íì´í ìì± 77 $depth2.each(function(){ 78 if(!$(this).next().is("div")) $(this).after("<div></div>") 79 $(this).next("div").prepend($(this).clone()).find('a').removeAttr('aria-expanded'); 80 }) 81 82 //ì´ë¦° ë©ë´ ë«ê¸° 83 function gnbClose() { 84 $depth1.attr('aria-expanded', 'false').parent().add($html).removeClass(AC) 85 } 86 $html.on('click keyup', function(e) { 87 if(!$(e.target).closest($gnb).length) gnbClose() 88 }) 89 $(window).on('scroll', function() { gnbClose() }) //2ì°¨ëì¤ê° ì´ë¦°ìíìì ì¤í¬ë¡¤ì 90} 91 92/* --------------------------------------------------------------------------------------- 93* mGnb 94----------------------------------------------------------------------------------------- */ 95function mGnb(){ 96 const $mGnbWrap = $('.m-gnb-wrap'), 97 $mGnb = $('.topmenu-all'); 98 99 $('.m-gnb-top-etc').prepend($('#header').find('.etc-ul').clone()); 100 $mGnb.children('li').eq(0).addClass(AC) 101 $('#m-gnb-open').on('click', function() { 102 $(this).add($mGnbWrap).toggleClass(AC) 103 $html.addClass(ScrollNo) 104 }) 105 $mGnbWrap.on('click', '.ico-close', function() { 106 $mGnbWrap.removeClass(AC) 107 $html.removeClass(ScrollNo) 108 }) 109 $mGnb.on('click', '>li>a', function(e) { 110 e.preventDefault() 111 $(this).parent().addClass(AC).siblings().removeClass(AC) 112 }) 113 114 //모ë°ì¼ìì Active ì°¾ìì íì±í 115 $mGnb.find('>li').each(function(){ 116 if ($(this).children().hasClass(AC)) { 117 $(this).addClass(AC).siblings().removeClass(AC) 118 } 119 }) 120 121} 122 123/* ------------------------------------------------------------------------------------- 124* snb 125----------------------------------------------------------------------------------------- */ 126function snb(){ 127 const $snb = $('#snb'); 128 129 // snb ì ê·¼ì± ì¸í 130 $snb.find('#left_menu_top li>a').each(function(){ 131 const $na = $(this), 132 $parent = $na.parent(), 133 isActive = $parent.hasClass(AC); 134 135 if (isActive) $na.attr('aria-current', 'page') 136 if ($na.next('ul').length > 0) { //3ì°¨ëì¤ 137 $na.attr('aria-expanded', isActive ? 'true' : 'false').removeAttr('aria-current') 138 $parent.addClass('is-depth3') 139 } 140 });
141 142 // íì 3ì°¨ëì¤ë¥¼ ê°ê³ ìë ë©ë´ë¥¼ í´ë¦íìë 143 $snb.on('click', '.is-depth3>a', function(e) { 144 const $na = $(this), 145 $parent = $na.parent(), 146 isActive = $parent.hasClass(AC); 147 148 e.preventDefault() 149 if (!isActive){ 150 $parent.addClass(AC).siblings().removeClass(AC) 151 $('.is-depth3').find('>a').attr('aria-expanded', 'false') 152 $na.attr('aria-expanded', 'true') 153 } 154 }); 155} 156 157/* ------------------------------------------------------------------------------------- 158* 리ì¤í¸ ì´ê³ ë«ê¸° listOpen('.sns .sns_btn', 'targetí´ëì¤ëª ') 159----------------------------------------------------------------------------------------- */ 160function listOpen(el, target, noAnyClick){ 161 accessInit(el); 162 163 const $el = $(el); 164 165 $html.on('click', el, function(e) { 166 const $na = $(this), 167 $elTarget = $na.closest(target), 168 isActive = $elTarget.hasClass(AC) 169 170 e.preventDefault() 171 if(!isActive) $html.trigger('click') 172 $elTarget.toggleClass(AC) 173 $na.attr('aria-expanded', isActive ? 'false' : 'true') 174 .find(srOnly).text(isActive ? OpenTxt : CloseTxt) 175 }) 176 if(!noAnyClick){ 177 $html.on('click', function(e) { 178 if(!$(e.target).closest(target).length){ 179 $(target).removeClass(AC) 180 .find(el).attr('aria-expanded', 'false') 181 .find(srOnly).text(OpenTxt) 182 } 183 }) 184 } 185 $(target).on('click', '.btn-close', function(e){ 186 $el.trigger('click'); 187 }) 188} 189 190/* ------------------------------------------------------------------------------------- 191* dataê°ì¼ë¡ ì´ê³ ë«ê¸° dataOpen('í´ë¦í í´ëì¤ëª ') 192----------------------------------------------------------------------------------------- */ 193function dataOpen(el){ 194 accessInit(el); 195 196 $(el).on('click', function() { 197 const $na = $(this), 198 isActive = $na.hasClass(AC) 199 $('#' + $na.data('id')).toggle(); 200 $na.toggleClass(AC).attr('aria-expanded', isActive ? 'false' : 'true').find(srOnly).text(isActive ? OpenTxt : CloseTxt); 201 }) 202} 203 204/* ------------------------------------------------------------------------------------- 205* íì ëë ë ì´ì´ ì´ê³ ë«ê¸° 206----------------------------------------------------------------------------------------- */ 207let $clickSpot; 208 209function layerPopup(el){ 210 accessInit(el); 211 const OL = 'opened-layer'; 212 213 $(el).on('click', function(e) { 214 e.preventDefault(); 215 216 $clickSpot = $(this); 217 const isActive = $clickSpot.hasClass(AC); 218 219 $clickSpot.toggleClass(AC).attr('aria-expanded', isActive ? 'false' : 'true') 220 $('#' + $(this).data('id')).attr('tabindex', 0).fadeIn(300).focus().addClass(OL); 221 $html.addClass(ScrollNo); 222 }) 223 224 $html.on('click', '.opened-layer .popup-close', function(e) { 225 e.preventDefault(); 226 $(this).closest('.opened-layer').removeAttr('tabindex').fadeOut(100).removeClass(OL); 227 $html.removeClass(ScrollNo); 228 $clickSpot.focus().removeClass(AC).attr('aria-expanded', 'false'); 229 }) 230 231 $html.on('keydown', '.opened-layer .popup-close', function(e) { 232 if(e.keyCode == 9) $(this).closest('.opened-layer').focus(); 233 }) 234} 235 236/* ------------------------------------------------------------------------------------- 237* tabë©ë´ - íì´ì§ê° ì íëë íë©ë´(ex. depth4, depth5) tabs(this) 238* tabë©ë´ì ì½í ì¸ ê° í¬í¨ë ê²½ì° tabs(this, "íì½í ì¸ ") 239----------------------------------------------------------------------------------------- */ 240function tabs(el, cont) { 241 const tabLi = $(el).find('>li').length 242 $(el).addClass("num" + tabLi + "") 243 244 245 //íì½í ì¸ ë´ìì ì íëë ê²½ì° 246 if(cont) { 247 //íë©ë´ ì ê·¼ì± 248 $(el).find('li.active') 249 .children('a, button').attr('aria-selected', true) 250 .parent().siblings('li').find('>a, >button').attr('aria-selected', false) 251 252 $(el).on("click", ">li>a, >li>button", function(e){
253 $(this).attr('aria-selected', true).parent().addClass(AC) 254 .siblings().removeClass(AC).find(">button, >a").attr('aria-selected', false) 255 $("#"+$(this).data('id')).addClass(AC).siblings().removeClass(AC) 256 e.preventDefault() 257 }) 258 }else{ 259 //íë©ë´ ì ê·¼ì± 260 $(el).find('li.active') 261 .children('a, button').attr('aria-current', 'page') 262 263 //íë©ë´(모ë°ì¼) 264 $(el).find('li>a, li>button').on("click", function(e) { 265 if (mobile() && $(this).parent().hasClass(AC)) { 266 e.preventDefault() 267 $(this).parents(el).toggleClass(AC) 268 } 269 }) 270 //íë©ë´(모ë°ì¼) : ë²ì´ë ê³³ í´ë¦ì íë©ë´ ë«íê² 271 $html.on('click', function(e) { 272 if(!$(e.target).closest(el).length) $(el).removeClass(AC) 273 }) 274 } 275} 276 277 278/* -------------------------------------------------------------------------------------- 279* ìì½ëì¸ - detailsë¡ ìì ( â»nameìì±ì W3C Validationìì ì¤ë¥ë¡ ì¸ìí기 ë문ì data-nameì¼ë¡ 그룹ì¤ì ) 280----------------------------------------------------------------------------------------- */ 281function accordion(el){ 282 const $el = $(el) 283 284 //ì ì²´ details ì¤ìºí´ì open ëì´ ìëê±°ì activeì§ì 285 $el.children('details').each(function(){ 286 $(this).attr('open') ? $(this).addClass(AC).find('summary i').append('<span class="sr-only">' + CloseTxt + '</span>') : $(this).removeClass(AC).find('summary i').append('<span class="sr-only">' + OpenTxt + '</span>') 287 }) 288 289 //summaryí´ë¦íìë 290 $el.on('click', 'summary', function(){ 291 const $details = $(this).parent('details'), 292 isOpen = $details.attr('open'), 293 $accordion = $(this).parents(el), 294 $btnAll = $accordion.find('.btn-all'); 295 296 $details.toggleClass(AC, !isOpen).find("summary i .sr-only").text(!isOpen ? CloseTxt : OpenTxt) 297 298 //detailsê° ì´ë¦¬ë©´? ì ì²´ë²í¼ ë«ê¸° : ì´ê¸° 299 $accordion.children('details').hasClass(AC) ? $btnAll.addClass(AC).find("span").text(CloseTxt) : $btnAll.removeClass(AC).find("span").text(OpenTxt) 300 }) 301 302 //ì ì²´ ë²í¼ í´ë¦íìë 303 $el.on('click', '.btn-all', function () { 304 $(this).hasClass(AC) ? $(this).parents(el).find('details.active summary').trigger('click') : $(this).parents(el).find('summary').trigger('click'); 305 }) 306} 307 308 309 310/* ------------------------------------------------------------------------------------- 311* dialog 312----------------------------------------------------------------------------------------- */ 313 314function dialogPop(){ 315 document.addEventListener('click', function(event) { 316 const target = event.target; 317 if (target.classList.contains('open-dialog')) { 318 const dialogId = target.dataset.target; 319 const dialog = document.getElementById(dialogId); 320 if (dialog) { 321 dialog.showModal(); 322 } 323 } else if (target.classList.contains('btn-close') || target.closest('.btn-close') || target.classList.contains('btn-cancel')){ 324 const dialog = target.closest('.dialog'); 325 if (dialog) { 326 dialog.close(); 327 } 328 } 329 }); 330} 331 332 333/* ------------------------------------------------------------------------------------- 334* 첨ë¶íì¼ 335----------------------------------------------------------------------------------------- */ 336function fileLoad(fileBox) { 337 let $fileBox = $(fileBox); 338 $.each($fileBox, function(idx){ 339 var $this = $fileBox.eq(idx), 340 $btnUpload = $this.find('[type="file"]'), 341 $label = $this.find('.file-label'); 342 343 $btnUpload.on('change', function() { 344 var $target = $(this), 345 fileName = $target.val(), 346 $fileText = $target.siblings('.file-name'); 347 $fileText.val(fileName); 348 }) 349 $btnUpload.on('focusin focusout', function(e) { 350 e.type == 'focusin' ? 351 $label.addClass('file-focus') : $label.removeClass('file-focus'); 352 }) 353 }) 354} 355 356/* -------------------------------------------------------------------------------------- 357* ê³µíµ - header ê³ ì , topë²í¼, ì ê·¼ì±(ìì´ì½, targetì²ë¦¬) 358----------------------------------------------------------------------------------------- */ 359$(function(){ 360 //header ê³ ì 361 let lastScroll 362 $(window).on('load scroll', function() { 363 let scrollT = $(this).scrollTop() 364 scrollT > lastScroll ? $('#header').addClass(FX) : $('#header').removeClass(FX) 365 lastScroll = scrollT 366 }) 367 //topë²í¼ 368 $(window).on('load scroll', function() { 369 $(window).scrollTop() > 0 ? $('.go-top').addClass(FX) : $('.go-top').removeClass(FX) 370 }) 371 // web accessibility 372 //$('[class*="ri-"]').attr('aria-hidden', 'true') 373 //$('a[target="_blank"]').attr('title', 'ìì°½ì¼ë¡ ì´ë¦¼') 374 //$("a[target='_blank')]").not(".board-view .file .file-list .link").attr("title","ìì°½ì¼ë¡ ì´ë¦¼"); 375 $("a[target='_blank']").not(".board-view .file .file-list .link a").attr("title","ìì°½ì¼ë¡ ì´ë¦¼"); 376 $('.page-info .current strong').prepend('<span class="sr-only">
376íì¬ íì´ì§</span>'); 377 $('.page-info .current b').prepend('<span class="sr-only">ì ì²´ íì´ì§ ì</span>'); 378 379 //모ë°ì¼ìì ì본ì´ë¯¸ì§ë³´ê¸° 380 if(mobile()){ 381 $('.img-zoom, .zoom_posi, .img').each(function(){ 382 const imgSrc = $(this).find('img').attr('src') 383 $(this).append('<a href="' + imgSrc + '" target="_blank" title="ì´ë¯¸ì§ ìì°½ì´ê¸°" class="btn-zoom"></a>') 384 }) 385 } 386 387 //ë¹ë°ë²í¸ 보기 388 $('.btn-pw-view').on('click', function(){ 389 $(this).toggleClass(AC) 390 var $pwInput = $(this).prev('input'), $srOnly = $(this).find(srOnly) 391 $pwInput.attr('type') == 'password' ? $pwInput.attr('type', 'text').add($srOnly).text('ë¹ë°ë²í¸ ì¨ê¸°ê¸°') : $pwInput.attr('type', 'password').add($srOnly).text('ë¹ë°ë²í¸ 보기') 392 }) 393 394}) 395
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.