1/* feCommon.js | KOREAN */ 2/* 3 Required 4 - jQuery v1.12.4 5 - jQuery UI v1.12.1: focusable.js, keycode.js, widgets/datepicker.js 6 - jQuery Touch Swipe 7 - jQuery browser mobile 8 - Web Font Loader v1.6.26 9 - feSeries: feFAQ 0.1h, feTab 1.1g, feForm 0.1m, feSlide 0.9.1i 10*/ 11var feUI = feUI || {}; 12(function(feUI, $, window, document, undefined) { 13 'use strict'; 14 // Common variable 15 var $window = $(window), 16 $document = $(document), 17 $html = $document.find('html').addClass('_OL'), 18 $body = $document.find('body').on({ 19 'keydown': function(e) { 20 // Tab 21 if ( e.keyCode === 9 ) $html.removeClass('_OL'); 22 }, 23 'keyup': function(e) { 24 // Enter 25 if ( e.keyCode === 13 ) $html.removeClass('_OL'); 26 }, 27 'click': function() { 28 $html.addClass('_OL'); 29 } 30 }), 31 $wrap = $document.find('#wrap') 32 .append('<div class="dimmedLayer"></div>'), 33 $header = $body.find('#header'), 34 $nav = $body.find('#nav'), 35 $contTopBar = $body.find('#contTopBar'), 36 $container = $body.find('#container'), 37 $content = $body.find('#content'), 38 $footer = $body.find('#footer'), 39 $dimmedLayer = $body.find('.dimmedLayer'), 40 $popup = $body.find('.popup'), 41 winWidth = $window.width(), 42 winHeight = $window.height(), 43 scrollTopPos = $window.scrollTop(), 44 assetDir = '/asset', 45 activeClass = 'active', 46 checkedClass = 'checked', 47 currentClass = 'current', 48 disabledClass = 'disabled', 49 eNamespace = '.feUI', 50 aniSpeed = 150, 51 dimmedOpacity = 0.8, 52 isMobile = $.browser.mobile, 53 isMain = $content.hasClass('main'), 54 xSize, cSize, _L, _M, _S; // View Mode 55 // Google Web Font Loader 56 WebFont.load({ 57 custom: { 58 families: [ 59 'Noto Sans KR:300,400,500,700', 60 'Noto Sans TC' 61 ], 62 urls: [ 63 '/asset/css/font/notosanskr.min.css', 64 'https://fonts.googleapis.com/earlyaccess/notosanstc.css' 65 ] 66 }, 67 classes: false, 68 active: function() { 69 $html.addClass('_JS'); 70 feUI.navMethod.init(); 71 feUI.latestBbS(); 72 }, 73 inactive: function() { 74 setTimeout(function() { 75 $html.addClass('_JS'); 76 feUI.navMethod.init(); 77 feUI.latestBbS(); 78 }, 1000); 79 }, 80 loading : function() { 81 setTimeout(function() { 82 $html.addClass('_JS'); 83 feUI.navMethod.init(); 84 feUI.latestBbS(); 85 }, 1000); 86 }, 87 fontloading : function() { 88 }, 89 fontactive : function() { 90 }, 91 fontinactive : function() { 92 } 93 }); 94 // device check for ios 95 feUI.checkDevice = function(){ 96 var device = { 97 iphone: window.navigator.userAgent.match(/(iPhone|iPod|iPad)/) 98 }, 99 $targetEl = $('input[value="ìíê¸ ì¬ì©"]'); 100 if (device.iphone){ 101 $targetEl.hide(); 102 } 103 } 104 feUI.checkDevice(); 105 // datepicker 106 if ( $html.prop('lang') === 'en' ) { 107 $.datepicker.setDefaults({ 108 dateFormat: 'yy-mm-dd', 109 prevText: 'Previous month', 110 nextText: 'next month', 111 dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 112 dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 113 monthNames: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'], 114 //yearSuffix: '.', 115 yearRange: '1900:+0' , 116 showOtherMonths: true, 117 showMonthAfterYear: true 118 }); 119 } else { 120 $.datepicker.setDefaults({ 121 dateFormat: 'yy-mm-dd', 122 prevText: 'ì´ì ë¬', 123 nextText: 'ë¤ì ë¬', 124 dayNames: ['ì¼ìì¼', 'ììì¼', 'íìì¼', 'ììì¼', '목ìì¼', 'ê¸ìì¼', 'í ìì¼'], 125 dayNamesMin: ['ì¼', 'ì', 'í', 'ì', '목', 'ê¸', 'í '], 126 monthNames: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'], 127 //yearSuffix: '.', 128 yearRange: '1900:+0' , 129 showOtherMonths: true, 130 showMonthAfterYear: true 131 }); 132 } 133 // checkIE 134 feUI.checkIE = function() { 135 var usrAgent = window.navigator.userAgent, 136 msieCheck = usrAgent.match(/MSIE (\d+)/), 137 tridentCheck = usrAgent.match(/Trident\/(\d+)/), 138 updateURL = 'http://windows.microsoft.com/ko-kr/internet-explorer/download-ie', 139 ieInfo = { 140 isIE: false, 141 trueVer: 0, 142 activeVer: 0, 143 cpMode: false 144 }; 145 if ( tridentCheck ) { // Check gt IE7 146 ieInfo.isIE = true, 147 ieInfo.trueVer = parseInt(tridentCheck[1], 10) + 4; 148 } 149 if ( msieCheck ) { // Check lt IE8 150 ieInfo.isIE = true, 151 ieInfo.activeVer = parseInt(msieCheck[1]); 152 } else { 153 ieInfo.activeVer = ieInfo.trueVer; 154 } 155 // IE Compatibility Mode(IE8 to IE7) 156 if ( ieInfo.isIE && ieInfo.activeVer < 8 157 && ieInfo.trueVer < 9 ) { 158 ieInfo.cpMode = ieInfo.trueVer !== ieInfo.activeVer; 159 } 160 if ( ieInfo.isIE ) { 161 $html.addClass('_IE' + ieInfo.activeVer); 162 if ( ieInfo.trueVer < 9 ) $html.addClass('_IE' + ieInfo.trueVer + 'O'); 163 } 164 // if ( !ieInfo.isIE || ieInfo.activeVer > 8 ) $html.addClass('_MDB'); 165 ( ieInfo.cpMode ) ? $html.addClass('_CP') : $html.removeClass('_CP'); 166 // Redirect(~IE7) 167 if ( ieInfo.isIE && ieInfo.activeVer < 8 ) window.location = updateURL; 168 // Set IE 169 if ( ieInfo.isIE ) { 170 // Table border for rowspan
171 var $spanRow = $body.find('tr').has('[rowspan]:not([rowspan="1"])'); 172 $spanRow.each(function(e) { 173 var $this = $(this), 174 $tgWrap = $this.closest('thead, tbody, tfoot'), 175 tgIdx = parseInt($tgWrap.find('> tr').index($this)), 176 spanNum = parseInt($this.find('[rowspan]').prop('rowspan')), 177 $endRow = $tgWrap.find('> tr:eq(' + (tgIdx + spanNum) + ')'); 178 $this.nextUntil($endRow).not($spanRow) 179 .find('> :first-child').addClass('firstCell'); 180 }); 181 } 182 // Set Old IE(~IE8) 183 if ( ieInfo.isIE && ieInfo.activeVer < 9 ) { 184 var $setLineHeightInp = $body.find(':text, :password'); 185 setTimeout(function() { 186 $html.addClass('_JS'); 187 feUI.navMethod.init(); 188 feUI.latestBbS(); 189 }); 190 // Input line height 191 $setLineHeightInp.each(function() { 192 var $this = $(this), 193 currentVal = ( $this.val() !== '' ) 194 ? $this.val() : ( $this.is('[placeholder]') ) 195 ? $this.prop('placeholder') : ''; 196 $this.css({ 197 lineHeight: $this.height() + 'px' 198 }).val(' ').val(currentVal); 199 }); 200 } 201 return ieInfo; 202 }; 203 feUI.checkIE(); 204 // Cookie 205 feUI.createCookie = function(name, value, days) { 206 var expires; 207 if ( days ) { 208 var date = new Date(); 209 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 210 expires = '; expires=' + date.toGMTString(); 211 } else expires = ''; 212 document.cookie = name + '=' + value + expires + '; path=/'; 213 }; 214 feUI.getCookie = function(name) { 215 var nameEQ = name + '=', 216 ca = document.cookie.split(';'); 217 for ( var i=0; i < ca.length; i++ ) { 218 var c = ca[i]; 219 while ( c.charAt(0) == ' ' ) c = c.substring(1, c.length); 220 if ( c.indexOf(nameEQ) == 0 ) return c.substring(nameEQ.length, c.length); 221 } 222 return null; 223 }; 224 feUI.deleteCookie = function(name) { 225 feUI.createCookie(name, '', -1); 226 }; 227 // Get function from string 228 feUI.stringToFunc = function(string) { 229 var scope = window, 230 scopeSplit = string.split('.'); 231 for ( var i = 0; i < scopeSplit.length - 1; i++ ) { 232 scope = scope[scopeSplit[i]]; 233 if ( scope === undefined ) return; 234 } 235 return scope[scopeSplit[scopeSplit.length - 1]]; 236 }; 237 // Disable invalid alert 238 feUI.disableInvalid = function() { 239 var $requiredEl = $body.find('[required]'); 240 if ( !$requiredEl.length ) return false; 241 $requiredEl.on('invalid', function(e) { 242 e.preventDefault(); 243 }); 244 }; 245 feUI.disableInvalid(); 246 // Placeholder 247 feUI.placeholder = function() { 248 var $placeholderInp = $body.find('[placeholder]'), 249 placeholderClass = 'placeholder', 250 phSupported = document.createElement('input').placeholder !== undefined, 251 ieActiveVer = feUI.checkIE().activeVer, 252 _eNamesapece = eNamespace + '_placeholder'; 253 if ( phSupported ) return false; 254 $placeholderInp.each(function() { 255 var $this = $(this), 256 type = $this.attr('type'), 257 phTxt = $this.attr('placeholder'); 258 if ( ieActiveVer > 8 259 && type === 'password' && $this.val() === '' ) $this.attr('type', 'text'); 260 if ( $this.val() === '' ) $this.addClass(placeholderClass).val(phTxt); 261 $this.off(_eNamesapece).on('focus' + _eNamesapece, function() { 262 if ( ieActiveVer > 8 && type === 'password' ) 263 $this.attr('type', 'password'); 264 if ( $this.val() === phTxt ) 265 $this.val('').removeClass(placeholderClass); 266 }).on('focusout' + _eNamesapece, function() { 267 if ( $this.val() === '' || $this.val() === phTxt ) { 268 $this.val('').addClass(placeholderClass); 269 ( ieActiveVer > 8 && type === 'password' ) 270 ? $this.attr('type', 'text').val(phTxt) 271 : $this.val(phTxt); 272 } 273 }); 274 }); 275 }; 276 feUI.placeholder(); 277 // Check view mode 278 feUI.viewModeCheck = function() { 279 var sizeL = 1440, 280 sizeM = ( isMain ) 281 ? 1900 - 200 // 기본 ì½í ì¸ í¬ê¸° - ë¹ì£¼ì¼ ê°ë ¤ì§ë í¬ê¸° 282 : 1200 + 100, // + sizeL ì¢ì° ì¬ë°±(25px * 2) 283 sizeS = 940 + 50, // + sizeM ì¢ì° ì¬ë°±(15px * 2) 284 sizeLClass = '_L', // Default 285 sizeMClass = '_M', // Pad 286 sizeSClass = '_S'; // Mobile 287 xSize = ( $html.hasClass(sizeLClass) ) 288 ? sizeLClass : ( $html.hasClass(sizeMClass) ) 289 ? sizeMClass : ( $html.hasClass(sizeSClass) ) 290 ? sizeSClass : '_N'; 291 if ( $content.hasClass('popup') ) return false; 292 if ( $html.prop('lang') === 'en' ) { 293 _L = true, 294 xSize = '_N', 295 cSize = sizeLClass; 296 $html.addClass(sizeLClass); 297 return false; 298 } 299 $html.removeClass(sizeLClass + ' ' + sizeMClass + ' ' + sizeSClass); 300 if ( winWidth < sizeS ) cSize = sizeSClass; 301 else if ( winWidth < sizeM ) cSize = sizeMClass; 302 else cSize = sizeLClass; 303 $html.addClass(cSize); 304 // Update val 305 _L = $html.hasClass(sizeLClass), 306 _M = $html.hasClass(sizeMClass), 307 _S = $html.hasClass(sizeSClass); 308 return cSize; 309 }; 310 feUI.viewModeCheck(); 311 // Skip To Content 312 feUI.skipToContent = function() { 313 var $skipNaviBtn = $body.find('a.skipToContent'), 314 tgId = ( isMain ) ? $content.find('.mBoxWrap') : $skipNaviBtn.attr('href'), 315 _eNamesapece = eNamespace + '_skipToContent'; 316 if ( !$skipNaviBtn.length ) return false; 317 if ( !$content.length ) $skipNaviBtn.hide();
318 $skipNaviBtn.off(_eNamesapece).on('click' + _eNamesapece, function(e) { 319 e.preventDefault(); 320 $(tgId).attr('tabindexf', 0).focus().on('keydown', function(e) { 321 if ( e.keyCode === 9 ) $(this).removeAttr('tabindex'); 322 }); 323 }); 324 }; 325 feUI.skipToContent(); 326 // Focus rotation(jQuery UI :focusable required) 327 feUI.focusRotation = function(evtTg, tgWrap, closeBtn) { 328 var $tgWrap = tgWrap, 329 $firstFocusTg = $tgWrap.find(':focusable:first'), 330 $lastFocusTg = $tgWrap.find(':focusable:last'); 331 $tgWrap.attr('tabindex', 0).focus().on('keydown', function(e) { 332 var $this = $(this); 333 if ( !$(e.target).is(tgWrap) ) return; 334 if ( e.keyCode === 9 && e.shiftKey ) { 335 e.preventDefault(); 336 $this.removeAttr('tabindex'); 337 ( closeBtn ) ? closeBtn.focus() : $lastFocusTg.focus(); 338 } else if ( e.keyCode === 9 && !e.shiftKey ) { 339 e.preventDefault(); 340 $this.removeAttr('tabindex'); 341 $firstFocusTg.focus(); 342 } 343 }); 344 $firstFocusTg.off('keydown').on('keydown', function(e) { 345 if ( e.keyCode === 9 && e.shiftKey ) { 346 e.preventDefault(); 347 ( closeBtn ) ? closeBtn.focus() : $lastFocusTg.focus(); 348 } 349 if ( ( e.keyCode === 9 && !e.shiftKey ) 350 && ( $firstFocusTg.is($lastFocusTg) ) ) { 351 e.preventDefault(); 352 } 353 }); 354 $lastFocusTg.off('keydown').on('keydown', function(e) { 355 if ( e.keyCode === 9 && !e.shiftKey ) { 356 e.preventDefault(); 357 ( closeBtn ) ? closeBtn.focus() : $firstFocusTg.focus(); 358 } 359 if ( ( e.keyCode === 9 && e.shiftKey ) 360 && ( $firstFocusTg.is($lastFocusTg) ) ) { 361 e.preventDefault(); 362 } 363 }); 364 }; 365 // Document tile 366 feUI.documentTitle = function(){ 367 var $conTitle = $content.find('.heading-depth01 .title') 368 .filter(':visible:first'), 369 conTitleValue = $conTitle.text(), 370 docTitle = $document.attr('title'); 371 372 var textArray = $(".breadcrumb .item em").map(function() { 373 return $(this).text().trim(); 374 }).get(); 375 376 if (!textArray.length ) { 377 $document.attr('title', docTitle); 378 } else if (textArray.length == 1) { 379 $document.attr('title', textArray[0] + ' | ' + docTitle); 380 } else if (textArray.length == 2 ) { 381 $document.attr('title', textArray[0] + ' | ' + textArray[1] + ' | ' + docTitle); 382 } else if (textArray.length > 2 ) { 383 if(textArray[0] != 'depth1'){ 384 $document.attr('title', textArray[0] + ' | ' + textArray[1] + ' | ' + textArray[2] + ' | ' + docTitle); 385 }else{ 386 $document.attr('title', docTitle); 387 } 388 } 389 }; 390 /* 391 feUI.documentTitle = function(){ 392 var $conTitle = $content.find('.heading-depth01 .title') 393 .filter(':visible:first'), 394 conTitleValue = $conTitle.text(), 395 docTitle = $document.attr('title'), 396 $tabTitle = $content.find('.tab'), 397 tabTitleArray = []; 398 for ( var i = 0; i < $tabTitle.length; i++ ) { 399 tabTitleArray[i] = $tabTitle.eq(i).find('.current').text(); 400 } 401 if ( !$conTitle.length && !$tabTitle.length ) { 402 $document.attr('title', docTitle); 403 } else if ( $conTitle.length && !$tabTitle.length ) { 404 $document.attr('title', conTitleValue + ' | ' + docTitle); 405 } else if ( $conTitle.length && $tabTitle.length == 1 ) { 406 $document.attr('title', tabTitleArray[0] + ' | ' + conTitleValue + ' | ' + docTitle); 407 } else if ( $conTitle.length && $tabTitle.length > 1 ) { 408 $document.attr('title', tabTitleArray[1] + ' | ' + tabTitleArray[0] + ' | ' + conTitleValue + ' | ' + docTitle); 409 } 410 };*/ 411 feUI.documentTitle(); 412 // Target blank link title 413 feUI.newWindowTitle = function() { 414 if ( !$html.find('[target="_blank"]').length ) return false; 415 if ( $html.prop('lang') === 'en' ) { 416 $html.find('[target="_blank"]').prop('title', 'open new window'); 417 } else { 418 //$html.find('[target="_blank"]').prop('title', 'ìì°½'); 419 } 420 } 421 feUI.newWindowTitle(); 422 // Class for content style 423 feUI.contentClass = function() { 424 var defulatContClass = 'content', 425 contClass = $content.prop('class').replace(defulatContClass + ' ', ''); 426 if ( contClass === 'content' ) return false; 427 $html.addClass('_' + contClass); 428 }; 429 feUI.contentClass(); 430 // Form design 431 feUI.formDesign = function() { 432 var $formEl = $body.find('select, :checkbox, :radio, :file').not(".filebox :file"), 433 $formEtc = $body.find('.formEtc'); 434 if ( !$formEl.length ) return false;
435 $formEl.feForm(); 436 $formEtc.each(function(){ 437 var $this = $(this), 438 $inp = $this.find(':checkbox, :radio'), 439 $anchor = $this.find('.etcBtn'), 440 $etcInp = $this.find('.etcInp'); 441 $inp.on('change', function() { 442 ( $anchor.prop('checked') ) 443 ? $etcInp.prop('disabled', false) 444 : $etcInp.val('').prop('disabled', true); 445 }); 446 }); 447 }; 448 feUI.formDesign(); 449 // Accordion 450 feUI.accordion = function() { 451 var $faqList = $body.find('.accordion'), 452 _eNamesapece = eNamespace + '_accordion'; 453 if ( !$faqList.length ) return false; 454 $faqList.feFAQ({ 455 closeAll: false 456 }); 457 $body.off(_eNamesapece) 458 .on('click' + _eNamesapece, '[data-open], [data-close]', function(e) { 459 var $this = $(this), 460 $tgEl = ( $this.is('[data-open]') ) 461 ? $body.find('.' + $this.data('open')) 462 : $body.find('.' + $this.data('close')); 463 ( $this.is('[data-open]') ) 464 ? $tgEl.find('[role="button"]').not('.' + currentClass) 465 .trigger('feClick') 466 : $tgEl.find('[role="button"]').filter('.' + currentClass) 467 .trigger('feClick'); 468 }); 469 }; 470 feUI.accordion(); 471 // Accordion table 472 feUI.accordionTbl = function(item) { 473 var $accTbl = $body.find('.accordion-table'), 474 _eNamesapece = eNamespace + '_accordionTbl'; 475 if ( !$accTbl.length ) return false; 476 $accTbl.off(_eNamesapece) 477 .on('click' + _eNamesapece, '[class*=button-detail]', function(e) { 478 var $this = $(this), 479 $tgRow = $this.closest('tr'), 480 $tgContRow = $tgRow.next('tr'); 481 e.preventDefault(); 482 $tgRow.toggleClass(activeClass); 483 $tgContRow.toggleClass(activeClass); 484 if ( $this.is('.button-detail01') ) { 485 ( $tgRow.hasClass(activeClass) ) 486 ? $this.attr('title','ë«ê¸°') 487 : $this.attr('title','í¼ì¹ê¸°') 488 } else { 489 ( $tgRow.hasClass(activeClass) ) 490 ? $this.find('span').text('ë«ê¸°') 491 : $this.find('span').text('í¼ì¹ê¸°'); 492 } 493 }); 494 if ( item ) 495 $accTbl.each(function() { 496 $(this).find('.button-detail').eq(item - 1) 497 .trigger('click' + _eNamesapece); 498 }); 499 }; 500 feUI.accordionTbl(); 501 // Tab size check 502 feUI.tabSize = function() { 503 var $tab = $body.find('.tab:not(.tab-type02)'), 504 sizeClass = 'tab-col'; 505 if ( !$tab.length ) return false; 506 $tab.each(function() { 507 var $this = $(this), 508 $tgItem = $this.find('> ul > li'), 509 thisSize = ( $tgItem.length > 9 ) 510 ? $tgItem.length : '0' + $tgItem.length; 511 $this.addClass(sizeClass + thisSize); 512 }); 513 }; 514 feUI.tabSize(); 515 // Tab Select button 516 feUI.tabSelect = function() { 517 var $tabSelectBtn = $body.find('.tab-select'), 518 _eNamesapece = eNamespace + '_tabSelect'; 519 if ( !$tabSelectBtn.length ) return false; 520 $tabSelectBtn.each(function() { 521 var $this = $(this), 522 $tgWrap = $this.closest('.tab'), 523 $tgList = $tgWrap.find('> ul'), 524 $currentEl = $tgWrap.find('.' + currentClass), 525 btnTxt = ( !$currentEl.length ) 526 ? 'ì í' : $currentEl.find('a').text(); 527 $this.text(btnTxt); 528 $this.prop("title", btnTxt); 529 ( _S ) 530 ? ( $this.hasClass(activeClass) ) 531 ? $tgList.show() : $tgList.hide() 532 : $tgList.show(); 533 }).off(_eNamesapece) 534 .on('click' + _eNamesapece, function() { 535 var $this = $(this), 536 $tgWrap = $this.closest('.tab'), 537 $tgList = $tgWrap.find('> ul'); 538 if ( $tgList.is(':animated') ) return false; 539 $tgWrap.add($this).toggleClass(activeClass); 540 $tgList.stop().slideToggle(aniSpeed); 541 }); 542 }; 543 feUI.tabSelect(); 544 // Top button 545 feUI.goTopBtn = function() { 546 var $aside = $body.find('.aside'), 547 $topBtn = $body.find('.aside > button'), 548 docHeight = $document.height(), 549 footerHeight = $footer.outerHeight(), 550 btnHeight = $topBtn.outerHeight(), 551 startPos = $header.outerHeight() + $contTopBar.outerHeight(), 552 stopPos = docHeight - winHeight - footerHeight, 553 footerGap = ( _S ) ? 15 : 30, 554 _eNamesapece = eNamespace + '_goTopBtn'; 555 ( startPos > scrollTopPos ) 556 ? $topBtn.removeClass(activeClass) 557 : $topBtn.addClass(activeClass); 558 ( stopPos < scrollTopPos ) 559 ? $aside.removeClass(activeClass).css({ 560 top: docHeight - footerHeight - btnHeight - footerGap 561 }) 562 : $aside.addClass(activeClass).css({ 563 top: 'auto' 564 }); 565 // Event 566 $topBtn.off(_eNamesapece)
567 .on('keydown' + _eNamesapece + ' click' + _eNamesapece, 568 function(e) { 569 $document.scrollTop(0); 570 if ( e.keyCode === 13 ) { 571 $('#wrap .tab_go').focus(); 572 $body.find('a.skipToContent').focus(); 573 return false; 574 } 575 } 576 ); 577 }; 578 feUI.goTopBtn(); 579 // Quick Menu 580 feUI.quickMenu = function() { 581 var $qmenu = $body.find('#quickMenu'), 582 //$topBtn = $body.find('.aside > button'), 583 docHeight = $document.height(), 584 footerHeight = $footer.outerHeight(), 585 qmenuHeight = $qmenu.outerHeight(), 586 startPos = $header.outerHeight(), 587 stopPos = docHeight - winHeight - footerHeight + 20, 588 footerGap = ( _S ) ? 15 : 140; 589 ( stopPos < scrollTopPos ) 590 ? $qmenu.css({ 591 position: 'absolute', 592 top: docHeight - footerHeight - qmenuHeight - footerGap 593 }) 594 : $qmenu.css({ 595 position: 'fixed', 596 top: '242px' 597 }); 598 599 }; 600 feUI.quickMenu(); 601 // Search 602 feUI.search = function() { 603 var $searchForm = $body.find('.searchForm'), 604 $detailBtn = $searchForm.find('.detailBtn'), 605 $resetBtn = $searchForm.find('.resetBtn'), 606 $searchDetail = $searchForm.find('.searchDetail'), 607 $formEl = $searchForm.find('select, :checkbox, :radio, :file'), 608 _eNamesapece = eNamespace + '_search'; 609 if ( !$searchForm.length ) return false; 610 $detailBtn.off(_eNamesapece) 611 .on('click' + _eNamesapece, function(e) { 612 e.preventDefault(); 613 var $this = $(this); 614 if ( $searchDetail.is(':animated') ) return false; 615 $this.toggleClass(activeClass); 616 $searchDetail.stop().slideToggle(aniSpeed); 617 }); 618 $resetBtn.off(_eNamesapece) 619 .on('click' + _eNamesapece, function() { 620 $formEl.trigger('feReset'); 621 setTimeout(function() { 622 $searchForm.find(':radio:first').trigger('feChange'); 623 }); 624 }); 625 }; 626 feUI.search(); 627 // Mobile Search 628 feUI.mobSearch = function() { 629 var $openBtn = $header.find('.util .button-search'), 630 $navBtn = $header.find('.util > a'), 631 $search = $header.find('.search'), 632 _activeClass = 'activeSearch', 633 _eNamesapece = eNamespace + '_mobSearch'; 634 if ( !_S ) 635 $header.add($openBtn).add($dimmedLayer) 636 .off(_eNamesapece); 637 if ( !_S && $header.hasClass('activeSearch') ) close(0); 638 if ( isMain ) return false; 639 $openBtn.off(_eNamesapece) 640 .on('click' + _eNamesapece, function() { 641 ( !$(this).hasClass(activeClass) ) ? open() : close(aniSpeed); 642 }); 643 $dimmedLayer.off(_eNamesapece) 644 .on('click' + _eNamesapece, function() { 645 close(aniSpeed); 646 }); 647 function open() { 648 $navBtn.hide(); 649 $header.addClass(_activeClass); 650 $openBtn.addClass(activeClass).text('ê²ì ë«ê¸°'); 651 $search.stop().slideDown(aniSpeed) 652 .find(':text').focus(); 653 $dimmedLayer.stop().fadeIn(aniSpeed); 654 } 655 function close(_aniSpeed) { 656 $navBtn.show(); 657 $openBtn.addClass(activeClass).text('ê²ì ì´ê¸°'); 658 $openBtn.removeClass(activeClass); 659 $search.stop().slideUp(_aniSpeed); 660 $dimmedLayer.stop().fadeOut(_aniSpeed, function() { 661 $header.removeClass(_activeClass); 662 }); 663 } 664 }; 665 feUI.mobSearch(); 666 // Family site 667 feUI.familySite = function() { 668 var $siteList = $footer.find('.family select'), 669 $goBtn = $footer.find('.family button'), 670 _eNamesapece = eNamespace + '_familySite'; 671 $siteList.off(_eNamesapece) 672 .on('change' + _eNamesapece, function() { 673 var $this = $(this), 674 thisVal = $this.val(), 675 thisTxt = ( thisVal === '' ) 676 ? 'ì íë 문íë¶ ë° ììê¸°ê´ ìì°½ì¼ë¡ ì´ë' 677 : $this.find('option:selected').text() + ' ìì°½ì¼ë¡ ì´ë' 678 $goBtn.data('url', thisVal).prop('title', thisTxt); 679 }); 680 $goBtn.off(_eNamesapece) 681 .on('click' + _eNamesapece, function() { 682 var tgUrl = $(this).data('url'); 683 if ( !tgUrl || tgUrl === '' ) return false; 684 window.open(tgUrl); 685 }); 686 }; 687 feUI.familySite(); 688 // Main mBox 689 feUI.mainBox = function() { 690 var $mBox = $content.filter('.main').find('.mBox'); 691 if ( !$mBox.length ) return false; 692 $mBox.each(function() { 693 var $this = $(this), 694 linkSize = $this.find('> ul li').length, 695 linkClass = ( linkSize > 9 ) 696 ? 'mBox-link' + linkSize
697 : 'mBox-link0' + linkSize; 698 $this.addClass(linkClass); 699 $this.find('> ul li:odd').addClass('fR'); 700 }); 701 $mBox.find('.slide').feSlide({ 702 naviBtn: true, 703 pagingNum: false, 704 fixedLayout: false, 705 swipeEvent: true, 706 aniSpeed: aniSpeed * 1.5, 707 playSpeed: 3500, 708 autoPlay: true 709 }); 710 $mBox.find('.slide').each(function() { 711 var $this = $(this), 712 $slidePaging = $this.find('.feSlPaging'), 713 $contBtn = $this.find('.btnAuto, .btnStop'); 714 $slidePaging.append($contBtn).find('button').wrapAll('<li></li>'); 715 //20221208 justin 716 $slidePaging.find('a:contains("Slide")').each(function() { 717 var tmpTxt = $(this).text(); 718 $(this).empty().append($('<span>'+tmpTxt+'</span>')); 719 }); 720 }); 721 }; 722 feUI.mainBox(); 723 // Latest BBS 724 feUI.latestBbS = function() { 725 var $bbs = $content.filter('.main').find('.bbs'), 726 itemSize = ( _S ) ? 3 : 3; 727 if ( !$bbs.length ) return false; 728 // Save origin code 729 $bbs.each(function() { 730 var $this = $(this), 731 slideCode = $this.find('.slide').html(); 732 if ( $this.data('origin') !== undefined ) return true; 733 $this.data('origin', slideCode); 734 }); 735 if ( xSize !== '_N' ) resetSlide(); 736 $bbs.find('.slide').feSlide({ 737 vertical: true, 738 pagingNum: false, 739 pagingBtn: false, 740 swipeEvent: true, 741 visibleItem: itemSize, 742 aniSpeed: aniSpeed * 1.5, 743 scrollItem: 3 //20240603 justin 744 }); 745 function resetSlide() { 746 $bbs.each(function() { 747 var $this = $(this); 748 $this.find('.slide').html($this.data('origin')); 749 }); 750 } 751 }; 752 // Table colspan 753 feUI.tableColspan = function() { 754 var $table = $body.find('table:has([colspan])'); 755 if ( !$table.length ) return false; 756 $table.each(function() { 757 var $this = $(this), 758 $colgroup = $this.find('> colgroup'), 759 colSizeL = $colgroup.filter('._SX').find('col').length, 760 colSizeS = $colgroup.filter('._LX').find('col').length, 761 tgColSize = ( _S ) ? colSizeL : colSizeS, 762 colSize = ( _S ) ? colSizeS : colSizeL, 763 $tgCell = $this.find('[colspan="' + tgColSize + '"]'); 764 if ( !$tgCell.length ) return true; 765 $tgCell.prop('colspan', colSize); 766 }); 767 }; 768 feUI.tableColspan(); 769 // jQuery UI Datepicker 770 feUI.datepickerMethod = { 771 init: function() { 772 feUI.datepickerMethod.tgEl = {}; 773 var _ = feUI.datepickerMethod.tgEl; 774 _.icoURL = assetDir + '/img/common/ico_calendar.png', 775 _.icoTxt, 776 _.$dpInp = $body.find('.input-date'), 777 _.$setBtn = $body.find('[data-setdate]'), 778 _.eNamespace = eNamespace + '_datepicker'; 779 if ( $html.prop('lang') === 'en' ) { 780 _.icoTxt = 'View calendar' 781 } else { 782 _.icoTxt = 'ë¬ë ¥ 보기' 783 } 784 // Init 785 _.$dpInp.datepicker({ 786 showOn: 'both', 787 buttonImage: _.icoURL, 788 buttonText: _.icoTxt, 789 buttonImageOnly: true, 790 changeYear: true 791 }); 792 if ( _.$setBtn.length ) feUI.datepickerMethod._setDateBtn(); 793 }, 794 _scope: function(captionVal) { 795 var $dpCalendar = $body.find('.ui-datepicker-calendar'), 796 captionTxt = ( captionVal ) ? captionVal : 'ë¬ë ¥'; 797 $dpCalendar.prepend('<caption>' + captionTxt + '</caption>') 798 .find('th').attr('scope', 'col'); 799 }, 800 _setDateBtn: function() { 801 var _ = feUI.datepickerMethod.tgEl, 802 calcUnit, setDateVal, $inpGroup; 803 _.$setBtn.filter(':radio').off(_.eNamespace) 804 .on('change' + _.eNamespace, function(e) { 805 setDate(e); 806 }).end().not(':radio').off(_.eNamespace) 807 .on('click' + _.eNamespace, function(e) { 808 setDate(e); 809 }); 810 function setDate(e) { 811 var $this = $(e.target), 812 dateVal = $this.data('setdate'), 813 groupVal = $this.data('dpinp'); 814 calcUnit = dateVal.slice(0, 1), 815 setDateVal = dateVal.split(calcUnit + '-')[1], 816 $inpGroup = $body.find(':text[data-dpinp=' + groupVal +']'); 817 e.preventDefault(); 818 e.stopImmediatePropagation(); 819 ( calcUnit === 'b' ) 820 ? $inpGroup.first().datepicker('setDate', '-' + setDateVal).end() 821 .last().datepicker('setDate', new Date()) 822 : $inpGroup.first().datepicker('setDate', new Date()).end() 823 .last().datepicker('setDate', '+' + setDateVal).end(); 824 } 825 } 826 }; 827 feUI.datepickerMethod.init(); 828 // Navigation 829 feUI.navMethod = { 830 init: function() {
831 feUI.navMethod.tgEl = {}; 832 var _ = feUI.navMethod.tgEl, 833 blankStr = '[href=""], [href="/"], [href="#"]'; 834 _.$gnbDepth1 = $nav.find('.depth1'), 835 _.$gnbDepth1Item = _.$gnbDepth1.find('> li'), 836 _.$gnbDepth2 = _.$gnbDepth1.find('.depth2'), 837 _.$mobMenuBtn = $header.find('.util > a'), 838 _.eNamespace = eNamespace + '_nav', 839 _.$gnbBar; 840 // Init 841 if ( !_.$gnbDepth1.siblings('ins').length && !_S ) 842 _.$gnbDepth1.after('<ins />'); 843 _.$gnbBar = _.$gnbDepth1.siblings('ins'); 844 $nav.add(_.$gnbDepth1).addClass(disabledClass); 845 $nav.add(_.$gnbDepth1Item).off(_.eNamespace); 846 if ( _S ) { 847 feUI.navMethod.mob(); 848 feUI.navMethod.sub(); 849 } else { 850 feUI.navMethod.sub(); 851 /*( isMain ) 852 ? feUI.navMethod.mainNav() 853 :*/ feUI.navMethod.gnb(); 854 } 855 feUI.navMethod.siteMap(); 856 // Sitemap, Mobile menu 857 if ( _S ) { 858 ( _.$mobMenuBtn.hasClass(activeClass) ) 859 ? _.$mobMenuBtn.prop('title', 'ë©ë´ ë«ê¸°') 860 : _.$mobMenuBtn.prop('title', 'ë©ë´ ì´ê¸°'); 861 } else { 862 ( $html.hasClass('siteMap') ) 863 ? _.$mobMenuBtn.prop('title', 'ì´ì íì´ì§').text('ì´ì íì´ì§') 864 : _.$mobMenuBtn.removeAttr('title').text('ì ì²´ ë©ë´'); 865 _.$mobMenuBtn.off(_.eNamespace) 866 .on('click' + _.eNamespace, function(e) { 867 if ( $html.hasClass('_siteMap') ) { 868 e.preventDefault(); 869 ( document.referrer.length ) 870 ? window.history.back() 871 : window.location = '../main/main.jsp' 872 } 873 }); 874 } 875 // Blank Anchor 876 $body.find('.depth1').off(_.eNamespace) 877 .on('click' + _.eNamespace, blankStr, function(e) { 878 e.preventDefault(); 879 }); 880 }, 881 gnb: function(type) { 882 var _ = feUI.navMethod.tgEl, 883 $gnbSub = _.$gnbDepth1.find('.sub').removeAttr('style'), 884 itemSize = _.$gnbDepth1Item.length, 885 itemWidth = Math.floor(100/(itemSize-1)), 886 subHeightArr; 887 if ( type === 'close' ) { 888 closeGnb(); 889 return false; 890 } 891 if ( $header.hasClass(activeClass) ) {
892 feUI.navMethod.mob('close'); 893 closeGnb(); 894 } 895 // Set GNB 896 $nav.show().find('.hasSub').removeClass('hasSub').end() 897 .find('ul').show(); 898 _.$gnbDepth1Item.filter(':first').addClass('first').end() 899 .filter(':last').addClass('last'); 900 if ( itemSize >= 3 ) { 901 _.$gnbDepth1Item.width(itemWidth + '%') 902 .filter(':first, :last') 903 .width((100-itemWidth*(itemSize-2))/2 + '%'); 904 } else if ( itemSize === 2 ) { 905 _.$gnbDepth1Item.width('50%').removeClass('first last'); 906 } else { 907 _.$gnbDepth1Item.width('100%').removeClass('first last'); 908 } 909 _.$gnbDepth1.removeClass(disabledClass); 910 // Set Sub 911 _.$gnbDepth2.each(function(i) { 912 var $tgEl = $(this).find('> li').removeAttr('style'); 913 feUI.navMethod._setHeight(4, $tgEl); 914 // Reset display 915 if ( _.$gnbDepth2.length - 1 === i ) 916 $nav.removeClass(disabledClass); 917 }); 918 subHeightArr = $gnbSub.map(function() { 919 return $(this).outerHeight(true); 920 }).get(); 921 // Open Sub 922 _.$gnbDepth1Item.off(_.eNamespace) 923 .on('focusin' + _.eNamespace + ' ' + 'mouseenter' + _.eNamespace, '> a', 924 function(e) { 925 var $this = $(this), 926 $tgItem = $this.closest('li'), 927 $tgSub = $tgItem.find($gnbSub), 928 $tgLine = $tgSub.find('ins'), 929 tgIdx = _.$gnbDepth1.find('> li').index($tgItem), 930 preIdx; 931 if ( $tgItem.hasClass(activeClass) ) return false; 932 // Gnb bar 933 feUI.navMethod._gnbBar(tgIdx); 934 // Toggle layer 935 if ( !$gnbSub.filter('.' + activeClass).length 936 || !$nav.hasClass(activeClass) ) { 937 // GNB ì²ì ì§ì ì, ì´ë¦° Subê° ìì ê²½ì° 938 _.$gnbDepth1.find('.' + activeClass).removeClass(activeClass); 939 $nav.add(_.$gnbDepth1).add($tgItem).add($tgSub).addClass(activeClass); 940 // current layer 941 $tgSub.css({ 942 opacity: 0, 943 height: 0 944 }).show().stop().animate({ 945 opacity: 1, 946 height: subHeightArr[tgIdx] 947 }, aniSpeed); 948 // line 949 $tgLine.css({ 950 height: $tgItem.find(_.$gnbDepth2).height() 951 }); 952 } else { 953 // GNB íì±íë ìíë¡ ì´ë ì 954 preIdx = _.$gnbDepth1.find('> li') 955 .index( _.$gnbDepth1.find('> li.' + activeClass) ); 956 _.$gnbDepth1.find('.' + activeClass).removeClass(activeClass); 957 _.$gnbDepth1.add($tgItem).add($tgSub).addClass(activeClass); 958 // current layer 959 $tgSub.css({ 960 opacity: 1, 961 height: $gnbSub.filter(':visible:first') 962 .outerHeight(true) 963 }).show().stop().animate({ 964 height: subHeightArr[tgIdx] 965 }, aniSpeed); 966 // ex layer 967 $gnbSub.eq(preIdx).hide(); 968 // line 969 $tgLine.css({ 970 height: $tgItem.find(_.$gnbDepth2).height() 971 }); 972 } 973 }); 974 // Close Sub 975 $nav.off(_.eNamespace).on('mouseleave' + _.eNamespace, closeGnb) 976 .on('focusout' + _.eNamespace, function() { 977 setTimeout(function() { 978 if ( !$nav.find(':focus').length ) closeGnb(); 979 }); 980 }); 981 function closeGnb() { 982 $nav.removeClass(activeClass) 983 .find('.' + activeClass).removeClass(activeClass); 984 $gnbSub.stop().animate({ 985 opacity: 0, 986 height: 0 987 }, aniSpeed, function() { 988 $gnbSub.hide(); 989 }); 990 _.$gnbBar.stop().fadeOut(aniSpeed); 991 } 992 }, 993 mob: function(type) { 994 var _ = feUI.navMethod.tgEl, 995 $searchBtn = $header.find('.util .button-search'); 996 _.$gnbDepth1Item.removeAttr('style').removeClass('first last'); 997 _.$gnbDepth2.find('> li').removeAttr('style'); 998 if ( type === 'close' ) { 999 mobClose(0); 1000 return false; 1001 } 1002 if ( !$header.is('[class*=active]') ) mobClose(0); 1003 _.$mobMenuBtn.off(_.eNamespace) 1004 .on('click' + _.eNamespace, function(e) { 1005 if ( !_S || $nav.is(':animated')) return false; 1006 e.preventDefault(); 1007 ( $header.hasClass(activeClass) ) 1008 ? mobClose(aniSpeed) : mobOpen(); 1009 ( _.$mobMenuBtn.hasClass(activeClass) ) 1010 ? _.$mobMenuBtn.prop('title', 'ë©ë´ ë«ê¸°') 1011 : _.$mobMenuBtn.prop('title', 'ë©ë´ ì´ê¸°'); 1012 }); 1013 $nav.add(_.$gnbDepth1).removeClass(disabledClass); 1014 $dimmedLayer.off(_.eNamespace)
1015 .on('click' + _.eNamespace, function() { 1016 if ( $header.is('[class*=active]') ) { 1017 mobClose(aniSpeed); 1018 } 1019 }); 1020 function mobOpen() { 1021 if ( !isMain ) $searchBtn.hide(); 1022 $header.add(_.$mobMenuBtn).addClass(activeClass); 1023 $nav.stop().slideDown(aniSpeed); 1024 $dimmedLayer.stop().fadeIn(aniSpeed); 1025 return false; 1026 } 1027 function mobClose(_aniSpeed) { 1028 if ( !isMain ) $searchBtn.show(); 1029 $nav.stop().slideUp(_aniSpeed); 1030 _.$mobMenuBtn.removeClass(activeClass); 1031 $dimmedLayer.stop().fadeOut(_aniSpeed, function() { 1032 $header.removeClass(activeClass); 1033 }); 1034 return false; 1035 } 1036 }, 1037 sub: function(type) { 1038 var _ = feUI.navMethod.tgEl, 1039 $lnbDepth2 = $container.find('.depth2:not(.content .depth2)'), 1040 $hasSubItem = ( _S ) 1041 ? $nav.find('li') 1042 : ( isMain ) 1043 ? $content.find('.mainNav .depth2 > li') 1044 : $lnbDepth2.find('> li'); 1045 if ( type === 'close' ) { 1046 var $closeSub = ( _S ) 1047 ? $nav.find('.hasSub') : $body.find('.hasSub'); 1048 $closeSub.each(function() { 1049 var $this = $(this); 1050 $this.removeClass(activeClass) 1051 .find('.' + activeClass).removeClass(activeClass); 1052 $this.find('ul:first').hide(); 1053 }); 1054 return false; 1055 } 1056 $hasSubItem.each(function() { 1057 var $this = $(this), 1058 $tgAnchor = $this.find('> a'); 1059 if ( !$this.find('ul').length 1060 || $tgAnchor.is('[target="_blank"]') ) return true; 1061 $this.addClass('hasSub'); 1062 if ( $header.hasClass(activeClass) ) return true; 1063 if ( $this.hasClass(currentClass) 1064 || $this.hasClass(activeClass) ) { 1065 $this.find('ul:first').show(); 1066 $tgAnchor.prop('title', 'ë©ë´ ë«ê¸°'); 1067 } else { 1068 $this.find('ul:first').hide(); 1069 $tgAnchor.prop('title', 'ë©ë´ ì´ê¸°'); 1070 } 1071 }).off(_.eNamespace).filter('.hasSub') 1072 .on('click' + _.eNamespace, '> a', function(e) { 1073 var $this = $(this), 1074 $closeItem = $this.closest('li') 1075 .siblings('.' + activeClass).find(' > a'), 1076 $tgSub = $this.find('ul:first'); 1077 e.preventDefault(); 1078 if ( $tgSub.is(':animated') ) return false; 1079 ( $this.hasClass(activeClass) ) 1080 ? subClose($this) : subOpen($this); 1081 if ( _S || isMain ) subClose($closeItem); 1082 }); 1083 // Current(Depth3 Only) 1084 if ( $lnbDepth2.find('.' + currentClass).length ) { 1085 var $currentEl = $lnbDepth2.find('.' + currentClass), 1086 $tgEl = $currentEl.closest('.hasSub').addClass(currentClass) 1087 .find('> a'); 1088 subOpen($tgEl, 0); 1089 } 1090 function subOpen($tgEl, speed) { 1091 var $tgItem = $tgEl.closest('li'), 1092 $tgSub = $tgItem.find('ul:first'), 1093 _aniSpeed = ( speed === undefined ) ? aniSpeed : speed; 1094 $tgEl.add($tgItem).add($tgSub).addClass(activeClass); 1095 $tgSub.stop().slideDown(_aniSpeed); 1096 $tgEl.prop('title', 'ë©ë´ ë«ê¸°'); 1097 $tgItem.removeClass(currentClass); 1098 } 1099 function subClose($tgEl, speed) { 1100 var $tgItem = $tgEl.closest('li'), 1101 $tgSub = $tgItem.find('ul:first'), 1102 _aniSpeed = ( speed === undefined ) ? aniSpeed : speed; 1103 $tgEl.add($tgItem).add($tgSub).removeClass(activeClass); 1104 $tgSub.stop().slideUp(_aniSpeed); 1105 $tgEl.prop('title', 'ë©ë´ ì´ê¸°'); 1106 } 1107 }, 1108 siteMap: function() { 1109 var $smDepth1 = $wrap.find('.siteMap > .depth1'), 1110 colNum = ( $content.hasClass('naContent') || $html.prop('lang') === 'en') ? 3 : 4; 1111 $smDepth1.each(function(i) { 1112 var $tgEl = $(this).find('> li').removeAttr('style'); 1113 feUI.navMethod._setHeight(colNum, $tgEl); 1114 }); 1115 }, 1116 mainNav: function() { 1117 var _ = feUI.navMethod.tgEl, 1118 $mainNav = $content.find('.mainNav'), 1119 $mainDepth1Item = $mainNav.find('.depth1 > li'), 1120 $mainSub = $mainDepth1Item.find('.sub').hide(0); 1121 if ( $header.hasClass(activeClass) ) {
1122 feUI.navMethod.mob('close'); 1123 } 1124 $mainDepth1Item.each(function(i) { 1125 var idx = ( i + 1 > 9 ) ? i + 1 : '0' + ( i + 1 ); 1126 $(this).addClass('depth1-item' + idx); 1127 }).off(_.eNamespace) 1128 .on('focusin' + _.eNamespace + ' ' + 'mouseenter' + _.eNamespace, '> a', 1129 function(e) { 1130 var $this = $(this), 1131 $tgItem = $this.closest('li'), 1132 $tgSub = $tgItem.find('.sub'), 1133 aniSpeed = ( $mainNav.hasClass(activeClass) ) 1134 ? 0 : aniSpeed / 2; 1135 $mainSub.hide(); 1136 $mainDepth1Item.removeClass(activeClass); 1137 $tgSub.fadeIn(aniSpeed); 1138 $mainNav.add($tgItem).add($tgSub).addClass(activeClass); 1139 }); 1140 $mainNav.off(_.eNamespace) 1141 .on('mouseleave' + _.eNamespace + ' ' + 'focusout' + _.eNamespace, 1142 function() { 1143 setTimeout(function() { 1144 if ( !$mainNav.find(':focus').length 1145 && !$mainNav.is(':hover') ) closeNav(); 1146 }); 1147 }); 1148 function closeNav() { 1149 feUI.navMethod.sub('close'); 1150 $mainSub.fadeOut(aniSpeed / 2); 1151 $mainNav.add($mainDepth1Item).removeClass(activeClass); 1152 } 1153 }, 1154 _setHeight: function(dNum, $tgEl) { 1155 if ( !dNum || !$tgEl ) return false; 1156 var _ = feUI.navMethod.tgEl, 1157 divNum = dNum, // Number of group items 1158 divArr = [], 1159 valArr = []; 1160 // Check slice index 1161 $.map($tgEl, function(e, i) { 1162 valArr.push($(e).outerHeight(true)); 1163 if (i % divNum === 0) divArr.push(i); 1164 }); 1165 // Group class 1166 $.each(divArr, function (i, v) { 1167 var resultArr = Math.max.apply(Math, valArr.slice(v, v + divNum)); 1168 $tgEl.slice(v, v + divNum) 1169 .removeClass().addClass('row' + (i + 1)).height(resultArr); 1170 }); 1171 // line 1172 if ( !$tgEl.filter('.row1:not(:last)').find('ins').length ) 1173 $tgEl.filter('.row1:not(:last)').append('<ins />'); 1174 }, 1175 _gnbBar: function(tgIdx) { 1176 var _ = feUI.navMethod.tgEl, 1177 $tgAnchorTxt = _.$gnbDepth1Item.find('> a span'), 1178 depth1AnchorWidth = $tgAnchorTxt.map(function() { 1179 var tgWidth = ( $(this).width() < $(this).closest('a').width() ) 1180 ? $(this).width() : $(this).closest('a').width() - 5; 1181 return Math.round(tgWidth); 1182 }).get(), 1183 depth1AnchorPos = $tgAnchorTxt.map(function() { 1184 return Math.round($(this).position().left); 1185 }).get(); 1186 if ( _S ) return false; 1187 ( !$nav.hasClass(activeClass) ) 1188 ? _.$gnbBar.css({ 1189 left: depth1AnchorPos[tgIdx], 1190 width: depth1AnchorWidth[tgIdx] + 2, 1191 opacity: 0 1192 }).show().stop().animate({ 1193 opacity: 1 1194 }, aniSpeed) 1195 : _.$gnbBar.show().stop().animate({ 1196 left: depth1AnchorPos[tgIdx], 1197 width: depth1AnchorWidth[tgIdx] + 2, 1198 opacity: 1 1199 }, aniSpeed); 1200 } 1201 }; 1202 // Util 1203 feUI.utilMethod = { 1204 init: function() { 1205 feUI.utilMethod.tgEl = {}; 1206 var _ = feUI.utilMethod.tgEl; 1207 _.$copyBtn = $body.find('.util .share'), 1208 _.$printBtn = $body.find('.util .print'), 1209 _.$zoomInBtn = $body.find('.util .zoom-in,.util2 .zoom-in'), 1210 _.$zoomOutBtn = $body.find('.util .zoom-out,.util2 .zoom-out'), 1211 _.eNamespace = eNamespace + '_util,_util2'; 1212 if ( isMobile || _S ) { 1213 _.$zoomInBtn.add(_.$zoomOutBtn).hide(); 1214 return false; 1215 } 1216 feUI.utilMethod.copy(); 1217 feUI.utilMethod.print(); 1218 if ( feUI.checkIE().isIE 1219 && feUI.checkIE().activeVer < 8 ) { 1220 _.$zoomInBtn.add(_.$zoomOutBtn).hide(); 1221 return false; 1222 } 1223 feUI.utilMethod.zoom(); 1224 }, 1225 copy: function() { 1226 var _ = feUI.utilMethod.tgEl; 1227 _.$copyBtn.off(_.eNamespace) 1228 .on('click' + _.eNamespace, function(e) { 1229 var urlString = window.location.href; 1230 e.preventDefault(); 1231 copyToClipboard(urlString); 1232 }); 1233 function copyToClipboard(tgVal) { 1234 var $tempInp = $('<input type="text">'); 1235 $body.append($tempInp); 1236 $tempInp.val(tgVal).select(); 1237 document.execCommand('copy'); 1238 $tempInp.remove(); 1239 _.$copyBtn.focus(); 1240 alert('주ìê° ë³µì¬ëììµëë¤.'); 1241 } 1242 }, 1243 print: function() { 1244 var _ = feUI.utilMethod.tgEl; 1245 _.$printBtn.off(_.eNamespace) 1246 .on('click' + _.eNamespace, function(e) { 1247 e.preventDefault(); 1248 window.print(); 1249 }); 1250 }, 1251 zoom: function() { 1252 var _ = feUI.utilMethod.tgEl, 1253 zoomVal = 1,
1254 zoomStep = 0.25, 1255 zoomClass = '_ZOOM'; 1256 _.$zoomInBtn.add(_.$zoomOutBtn).show(); 1257 if ( zoomVal === 1 ) _.$zoomOutBtn.prop('disabled', true); 1258 _.$zoomInBtn.add(_.$zoomOutBtn).off(_.eNamespace) 1259 .on('click' + _.eNamespace, function() { 1260 var $this = $(this); 1261 if ( $this.is(_.$zoomInBtn) ) { 1262 zoomVal = zoomVal + zoomStep; 1263 } else if ( $this.is(_.$zoomOutBtn) ) { 1264 zoomVal = zoomVal - zoomStep; 1265 } else { 1266 zoomVal = 1; 1267 } 1268 if ( zoomVal !== 1 ) { 1269 _.$zoomOutBtn.prop('disabled', false); 1270 $html.addClass(zoomClass); 1271 } else { 1272 _.$zoomOutBtn.prop('disabled', true); 1273 $html.removeClass(zoomClass); 1274 } 1275 $body.css({ 1276 'zoom': zoomVal, 1277 '-o-transform': 'scale(' + zoomVal + ', ' + zoomVal + ')', 1278 '-o-transform-origin': 'left top', 1279 '-moz-transform-origin': 'left top', 1280 '-moz-transform': 'scale(' + zoomVal + ', ' + zoomVal + ')' 1281 }); 1282 }); 1283 } 1284 }; 1285 feUI.utilMethod.init(); 1286 // Breadcrumb 1287 feUI.breadcrumb = function() { 1288 var $breadcrumb = $popup.find('.history-breadcrumb'), 1289 $bcLinkLayerBtn = $breadcrumb.find('.layer-button'), 1290 $bcLinkLayer = $breadcrumb.find('.item > ul').attr({ 1291 'role': 'region', 1292 'aria-hidden': true, 1293 'aria-expanded': false 1294 }), 1295 btnOpenTxt = 'ì´ê¸°', 1296 btnCloseTxt = 'ë«ê¸°', 1297 $tgBcLinkLayer; 1298 if ( !$breadcrumb.length ) return false; 1299 $bcLinkLayerBtn.on({ 1300 'click': function() { 1301 var $this = $(this), 1302 tgOpenTxt = $this.text().replace(btnOpenTxt, btnCloseTxt), 1303 tgCloseTxt = $this.text().replace(btnCloseTxt, btnOpenTxt); 1304 $tgBcLinkLayer = $this.siblings().filter($bcLinkLayer); 1305 if ( $this.hasClass(activeClass) ) { 1306 $tgBcLinkLayer.stop().slideUp(aniSpeed, function() { 1307 $(this).attr({ 1308 'aria-hidden': true, 1309 'aria-expanded': false 1310 }); 1311 }); 1312 $this.text(tgCloseTxt).removeClass(activeClass); 1313 } else { 1314 $tgBcLinkLayer.stop().slideDown(aniSpeed, function() { 1315 $(this).attr({ 1316 'aria-hidden': false, 1317 'aria-expanded': true 1318 }); 1319 }); 1320 $this.text(tgOpenTxt).addClass(activeClass); 1321 feUI.focusRotation($this, $tgBcLinkLayer, $this); 1322 } 1323 }, 1324 'keydown': function(e) { 1325 if ( !$tgBcLinkLayer || $tgBcLinkLayer.is(':hidden') ) return; 1326 if ( e.keyCode === 9 && !e.shiftKey ) { 1327 e.preventDefault(); 1328 $tgBcLinkLayer.find(':focusable:first').focus(); 1329 } else if ( e.keyCode === 9 && e.shiftKey ) { 1330 e.preventDefault(); 1331 $tgBcLinkLayer.find(':focusable:last').focus(); 1332 } 1333 } 1334 }); 1335 $wrap.on('click', function(e) { 1336 if ( !$(e.target).is($bcLinkLayerBtn) ) 1337 $bcLinkLayerBtn.filter('.' + activeClass).trigger('click'); 1338 }); 1339 }; 1340 feUI.breadcrumb(); 1341 // popup 1342 feUI.popupOpen = function() { 1343 var $popupOpenBtn = $body.find('.popupOpenBtn'), 1344 popupHeight = $popupOpenBtn.data('height'); 1345 if ( !$popupOpenBtn.length ) return false; 1346 $popupOpenBtn.on('click', function() { 1347 var $this = $(this), 1348 popupUrl = $this.attr('href'); 1349 window.open( popupUrl, 'new', 'top=50, left=50, width=980, height= '+ popupHeight +', toolbar=no, menubar=no, scrollbars=yes, resizable=no' ); 1350 return false; 1351 }); 1352 }; 1353 feUI.popupOpen(); 1354 // audio 1355 feUI.audioPlay = function() { 1356 var $audioPlay = $body.find('.audioPlay'), 1357 audio = $body.find('#audio'), 1358 oggSrc = audio.find('#oggSrc'), 1359 mp3Src = audio.find('#mp3Src'); 1360 if ( !$audioPlay.length ) return false; 1361 $audioPlay.on('click', function() { 1362 var $this = $(this), 1363 dataOggSrc = $this.data('ogg'), 1364 dataMp3Src = $this.data('mp3'); 1365 oggSrc.attr("src", dataOggSrc); 1366 mp3Src.attr("src", dataMp3Src); 1367 audio[0].load(); 1368 audio[0].play(); 1369 return false; 1370 }); 1371 }; 1372 feUI.audioPlay(); 1373 // modal 1374 feUI.modal = function() { 1375 var $modal = $body.find('.modal'), 1376 modalLength = $modal.length, 1377 cookieName = 'todayModal', 1378 _eNamesapece = eNamespace + '_modal'; 1379 if ( !modalLength ) return false; 1380 var visible = function() { 1381 // html._modal ì dimmedLayer ì¤í 1382 if ( $modal.is(':visible') ) { 1383 $html.addClass('_modal'); 1384 } else { 1385 $html.removeClass('_modal'); 1386 } 1387 } 1388 visible(); 1389 $modal.each(function(idx){ 1390 var $this = $(this), 1391 thisIdx = idx + 1, 1392 modalWidth = $this.outerWidth(),
1393 modalHeight = $this.outerHeight(), 1394 $closeBtn = $this.find('.button-close'), 1395 $todayBtn = $this.find('.todayBtn'); 1396 $this.addClass('view modal' + thisIdx); // view : cookie check 1397 $closeBtn.on({ 1398 'click': function(e) { 1399 e.preventDefault(); 1400 $('#wrap .tab_go').focus(); 1401 close(); 1402 // ì¤ë í루 ë³´ì§ìì 1403 if( $(this).is($todayBtn) ) { 1404 feUI.createCookie(cookieName + thisIdx, 1, 1); 1405 } 1406 } 1407 }); 1408 var close = function() { 1409 var $others = $modal.not($this), 1410 $nextModal = $others.filter('.view'); 1411 $this.hide(); 1412 if( modalLength > thisIdx && $nextModal.length ) { 1413 $this.next($nextModal).show() 1414 } 1415 feUI.focusRotation($modal, $modal); 1416 $('#wrap .tab_go').focus(); 1417 visible(); 1418 $document.scrollTop(0); 1419 } 1420 // ì¤ë í루 ë³´ì§ìì 1421 if ( feUI.getCookie(cookieName + thisIdx) === '1' ) { 1422 $('#wrap .tab_go').focus(); 1423 close(); 1424 $this.remove().removeClass('view'); 1425 } 1426 }) 1427 $modal.hide().filter('.view').eq(0).show(); // ì´ê¸° ì¤í 1428 feUI.focusRotation($modal, $modal); 1429 }; 1430 feUI.modal(); 1431 // Window Event 1432 $window.on({ 1433 'resize': function(e) { 1434 if ( winWidth !== $window.width() ) { 1435 winWidth = $window.width(); 1436 feUI.viewModeCheck(); 1437 feUI.navMethod.init(); 1438 if ( cSize !== xSize ) { 1439 feUI.mobSearch(); 1440 feUI.tabSelect(); 1441 feUI.tableColspan(); 1442 feUI.utilMethod.init(); 1443 } 1444 if ( isMain ) { 1445 // ë©ì¸ ê²ìí ì¬ë¼ì´ë ì¬í¸ì¶ 1446 if ( (_S && xSize !== '_S') 1447 || !_S && xSize === '_S' ) feUI.latestBbS(); 1448 // ë©ì¸ ì´ë¯¸ì§ ì¬ë¼ì´ë ëì´ ì¤ë¥ ëì 1449 if ( ( _S && xSize !== '_S' ) 1450 && ( $('.mBox .feSlWrap').height() === 157 ) ) 1451 $window.trigger('resize'); 1452 } 1453 } 1454 if ( winHeight !== $window.height() ) { 1455 winHeight = $window.height(); 1456 feUI.goTopBtn(); 1457 feUI.quickMenu(); 1458 } 1459 }, 1460 'scroll': function() { 1461 scrollTopPos = $window.scrollTop();
1462 feUI.goTopBtn(); 1463 feUI.quickMenu(); 1464 } 1465 }); 1466})(feUI, jQuery, window, document);
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.