1// 기존 í¤ë ì¤íì¼ ê´ë ¨ 2$("#top_layout .header-in").on("mouseover focusin", function(){ 3 $(this).parent('#top_layout').addClass("on"); 4}); 5$("#top_layout .header-in").on("mouseleave focusout", function(){ 6 $(this).parent('#top_layout').removeClass("on"); 7}); 8 9// ë©ì¸ ë¹ì£¼ì¼ swiper 10(function () { 11 'use strict'; 12 13 // mvisual 컨í ì´ëê° ì¤ì ë¡ ìëì§ ë¨¼ì íì¸ 14 var $visualContainer = $('.visualSwiper.mvisual'); 15 16 // ìì¼ë©´(= ì§ê¸ì²ë¼ nodataë§ ìë ê²½ì°) ì무 ê²ë íì§ ìì 17 if (!$visualContainer.length) { 18 return; 19 } 20 21 // ì´ ìëë .visualSwiper.mvisual ì´ ì¡´ì¬íë ê²½ì°ìë§ ì¤í 22 var visualSwiper = new Swiper('.visualSwiper.mvisual', { 23 slidesPerView: 1, 24 spaceBetween: 10, 25 loop: true, 26 autoplay: { 27 delay: 3000 28 }, 29 effect: 'slides', 30 speed: 1000, 31 observer: true, 32 observeParents: true, 33 watchSlidesProgress: true, 34 navigation: { 35 prevEl: '.visualSwiper.mvisual .swiper-btn.prev', 36 nextEl: '.visualSwiper.mvisual .swiper-btn.next' 37 }, 38 pagination: { 39 el: '.swiper-pagination', 40 type: 'custom', 41 renderCustom: function (s, c, t) { 42 return '' + 43 '<span class="current">' + c + '</span>' + 44 '<span class="divide">/</span>' + 45 '<span class="total">' + t + '</span>'; 46 } 47 }, 48 breakpoints: { 49 /* 500: { 50 slidesPerView: 1, 51 spaceBetween: 10, 52 }, */ 53 768: { 54 slidesPerView: 2, 55 spaceBetween: 15, 56 }, 57 1024: { 58 slidesPerView: 2, 59 spaceBetween: 20, 60 } 61 } 62 }); 63 64 swiperCustom(visualSwiper, { 65 autoBtn: '.swiper-btn.auto', 66 slideFocus: true, 67 edgeClass: false 68 }); 69})(); 70 71// ë©ì¸ ë¹ì£¼ì¼ swiper - íì ë°ì´í°ê° ìì ë (nodata ì ì©) 72(function () { 73 'use strict'; 74 75 var nodataSwiperEl = document.querySelector('.visualSwiper.nodata'); 76 if (!nodataSwiperEl) { 77 return; 78 } 79 80 // íì´ì§ë¤ì´ì 1 / 1 ê³ ì (í¹ì ë§í¬ì ìì ë¤ë¥¸ ê° ë¤ì´ì¨ ê²½ì° ëë¹) 81 var paginationCurrent = nodataSwiperEl.querySelector('.swiper-pagination .current'); 82 var paginationTotal = nodataSwiperEl.querySelector('.swiper-pagination .total'); 83 if (paginationCurrent) { 84 paginationCurrent.innerHTML = '1'; 85 } 86 if (paginationTotal) { 87 paginationTotal.innerHTML = '1'; 88 } 89 90 // 컨í¸ë¡¤ ëí¼ ì 체를 ì¤í¬ë¦°ë¦¬ëìì ì¨ê¹ (ì¥ìì© ì²ë¦¬) 91 var ctrlWrap = nodataSwiperEl.querySelector('.swiper-control .wrap'); 92 if (ctrlWrap) { 93 ctrlWrap.setAttribute('aria-hidden', 'true'); 94 } 95 96 // ì¢/ì°/ìë ë²í¼ + íì ë²í¼ ë¹íì±í 97 var ctrl = nodataSwiperEl.querySelector('.swiper-control'); 98 if (ctrl) { 99 var btns = ctrl.querySelectorAll( 100 '.swiper-btn.prev, .swiper-btn.next, .swiper-btn.auto, .popup-btn' 101 ); 102 for (var i = 0; i < btns.length; i++) { 103 // í¬ì»¤ì¤ ë¶ê° + ëì ë¶ê° 104 btns[i].setAttribute('disabled', 'disabled'); 105 btns[i].setAttribute('tabindex', '-1'); 106 btns[i].setAttribute('aria-disabled', 'true'); 107 108 // ìê°ì ì¼ë¡ë ë¹íì± ì¤íì¼ ì ì©ì© í´ëì¤ 109 if (btns[i].className.indexOf('disabled') === -1) { 110 btns[i].className += ' disabled'; 111 } 112 } 113 } 114})(); 115 116// ë©ì¸ ë¹ì£¼ì¼ swiper 컨í¸ë¡¤ë° ëì´ ì¡°ì 117(function () { 118 'use strict'; 119 120 var resizeTimer = null; 121 122 // 기본 ë¸ë ì´í¬í¬ì¸í¸ 123 var BREAKPOINT_DEFAULT = 500; // mvisual ë± ì¼ë° ì¼ì´ì¤: 499pxê¹ì§ 모ë°ì¼ 124 var BREAKPOINT_NODATA = 768; // nodataì¼ ë: 767pxê¹ì§ 모ë°ì¼ 125 126 /** 127 * class ë³´ì ì¬ë¶ ì²´í¬ (IE ëì) 128 */ 129 function hasClass(el, className) { 130 if (!el || !className) { 131 return false; 132 } 133 if (el.classList) { 134 return el.classList.contains(className); 135 } 136 var cls = el.className || ''; 137 return (' ' + cls + ' ').indexOf(' ' + className + ' ') > -1; 138 } 139 140 /** 141 * íì¬ visualSwiperì ë§ë ë¸ë ì´í¬í¬ì¸í¸ ë°í 142 * - .nodata ê° ë¶ì´ ìì¼ë©´ 768 143 * - ê·¸ ì¸(mvisual ë±)ë 500 144 */
145 function getBreakpoint(swiperEl) { 146 if (!swiperEl) { 147 return BREAKPOINT_DEFAULT; 148 } 149 if (hasClass(swiperEl, 'nodata')) { 150 return BREAKPOINT_NODATA; 151 } 152 // default: mvisual í¬í¨ ì¼ë° ì¼ì´ì¤ 153 return BREAKPOINT_DEFAULT; 154 } 155 156 /** 157 * íì¬ ëë¹ê° PC 구ê°ì¸ì§ ì¬ë¶ 158 * - swiperì ì¢ ë¥ì ë°ë¼ ë¸ë ì´í¬í¬ì¸í¸ê° ë¬ë¼ì§ 159 */ 160 function isPCWidth(swiperEl) { 161 var breakpoint = getBreakpoint(swiperEl); 162 // IE í¸í: window.innerWidth ì¬ì© 163 return window.innerWidth >= breakpoint; 164 } 165 166 function updateVisualControlSize() { 167 var visualSwiper = document.querySelector('.visualSwiper'); 168 if (!visualSwiper) { 169 return; 170 } 171 172 var control = visualSwiper.querySelector('.swiper-control'); 173 var thumb = visualSwiper.querySelector('.link .thambnail'); 174 175 if (!control || !thumb) { 176 return; 177 } 178 179 // â ë°ìí(모ë°ì¼/íë¸ë¦¿) 구ê°ììë JS ê°ì X 180 if (!isPCWidth(visualSwiper)) { 181 // PCìì ì¤ì íë ì¸ë¼ì¸ width ì ê±° â CSS ê°ë§ ì¬ì© 182 control.style.width = ''; 183 return; 184 } 185 186 // ì¬ê¸°ë¶í°ë PC 구ê°ììë§ ì¤í 187 var thumbHeight = thumb.clientHeight; 188 189 if (!thumbHeight || thumbHeight <= 0) { 190 return; 191 } 192 193 // íì ì width = íì í ì¸ë¡ ê¸¸ì´ 194 control.style.width = thumbHeight + 'px'; 195 } 196 197 function onResize() { 198 if (resizeTimer) { 199 clearTimeout(resizeTimer); 200 } 201 resizeTimer = setTimeout(function () { 202 updateVisualControlSize(); 203 }, 100); 204 } 205 206 // DOM ì¤ë¹ í í ë² ì¤í 207 if (document.readyState === 'loading') { 208 document.addEventListener('DOMContentLoaded', function () { 209 updateVisualControlSize(); 210 }); 211 } else { 212 updateVisualControlSize(); 213 } 214 215 // 리ì¬ì´ì¦ë§ë¤ ë¤ì ë§ì¶°ì£¼ê¸° 216 if (window.addEventListener) { 217 window.addEventListener('resize', onResize, false); 218 } else if (window.attachEvent) { 219 // IE8~9 ëì 220 window.attachEvent('onresize', onResize); 221 } 222})(); 223 224// ë리ìíµë§ > youtube swiper 225var snsSwiper1 = new Swiper(".snsSwiper.type1", { 226 slidesPerView: 1, 227 spaceBetween: 0, 228 loop: false, 229 effect: 'slide', 230 speed: 1000, 231 observer: true, 232 observeParents: true, 233 watchSlidesProgress: true, 234 navigation: { 235 prevEl: ".snsSwiper.type1 .swiper-btn.prev", 236 nextEl: ".snsSwiper.type1 .swiper-btn.next" 237 }, 238 breakpoints: { 239 768: { 240 slidesPerView: 2, 241 spaceBetween: 15, 242 }, 243 1024: { 244 slidesPerView: 3, 245 spaceBetween: 20, 246 }, 247 1281: { 248 slidesPerView: 3, 249 spaceBetween: 24, 250 } 251 } 252}); 253swiperCustom(snsSwiper1, { 254 autoBtn: false, 255 slideFocus: true, 256 edgeClass: false 257}); 258 259// ë리ìíµë§ > instagram, X swiper 260var snsSwiper2 = new Swiper(".snsSwiper.type2", { 261 slidesPerView: 1, 262 spaceBetween: 0, 263 loop: false, 264 effect: 'slide', 265 speed: 1000, 266 observer: true, 267 observeParents: true, 268 watchSlidesProgress: true, 269 navigation: { 270 prevEl: ".snsSwiper.type2 .swiper-btn.prev", 271 nextEl: ".snsSwiper.type2 .swiper-btn.next" 272 }, 273 breakpoints: { 274 768: { 275 slidesPerView: 3, 276 spaceBetween: 15, 277 }, 278 1024: { 279 slidesPerView: 4, 280 spaceBetween: 20, 281 }, 282 1281: { 283 slidesPerView: 4, 284 spaceBetween: 24, 285 } 286 } 287}); 288swiperCustom(snsSwiper2, { 289 autoBtn: false, 290 slideFocus: true, 291 edgeClass: false 292}); 293 294// ë리ìíµë§ í ìì ëì´ 295(function () { 296 'use strict'; 297 298 var BREAKPOINT = 1376; 299 var resizeTimer = null; 300 301 function isResponsiveWidth() { 302 // mq(1376)ì´ max-width: 1376px ë¼ë ê°ì 303 return window.innerWidth <= BREAKPOINT; 304 } 305 306 function updateSnsBoardHeight() { 307 var snsBoxes = document.querySelectorAll('.sns-box .sns-board .board-item'); 308 if (!snsBoxes || !snsBoxes.length) { 309 return; 310 } 311 312 var i; 313 for (i = 0; i < snsBoxes.length; i++) { 314 // ì¼ë¨ ì¸ë¼ì¸ height ì´ê¸°í 315 snsBoxes[i].style.height = ''; 316 } 317 318 // ë°ìí 구ê°ì´ ìëë©´(=PC ëì 구ê°) CSS height(311 / 444px)ì ë§¡ê¹ 319 if (!isResponsiveWidth()) { 320 return; 321 } 322 323 // ë°ìí 구ê°(<=1376px)ììë active íë§ ì¸ë¤ì¼ ëì´ì ë§ì¶° height ì¬ì¤ì 324 var activeItems = document.querySelectorAll('.sns-box .sns-board .board-item.active'); 325 if (!activeItems || !activeItems.length) { 326 return; 327 } 328 329 for (i = 0; i < activeItems.length; i++) { 330 var item = activeItems[i]; 331 var content = item.querySelector('.board-content'); 332 var swiper = item.querySelector('.snsSwiper'); 333 var thumb = swiper ? swiper.querySelector('.thambnail') : null; 334 335 if (!content || !thumb) { 336 continue; 337 } 338 339 // board-contentì top ìì¹ + ì¸ë¤ì¼ ëì´ = ì ì²´ ëì´ 340 var topOffset = content.offsetTop;
340 // ì§ê¸ SCSS ê¸°ì¤ ëëµ 73px 341 var thumbHeight = thumb.clientHeight; // padding-top ë¹ì¨ë¡ ê³ì°ë ì¤ì px ëì´ 342 343 // thumbHeightê° 0ì¸ ê²½ì°(ë ì´ìì 미ìë£) ëë¹ 344 if (!thumbHeight || thumbHeight <= 0) { 345 // ê·¸ëë ìµìí swiper ì ì²´ ëì´ ê¸°ì¤ì¼ë¡ ë³´ì 346 var swiperHeight = swiper.offsetHeight; 347 if (swiperHeight && swiperHeight > 0) { 348 thumbHeight = swiperHeight; 349 } else { 350 continue; 351 } 352 } 353 354 var totalHeight = topOffset + thumbHeight; 355 356 // ì¬ì 를 ì¡°ê¸ ëê³ ì¶ë¤ë©´ + ì¬ë°±(px)ì ëí´ë ë¨ 357 // totalHeight += 10; 358 359 item.style.height = totalHeight + 'px'; 360 } 361 } 362 363 function onResize() { 364 if (resizeTimer) { 365 clearTimeout(resizeTimer); 366 } 367 resizeTimer = setTimeout(function () { 368 updateSnsBoardHeight(); 369 }, 100); 370 } 371 372 // DOM ì¤ë¹ ì 1í ì¤í 373 if (document.readyState === 'loading') { 374 document.addEventListener('DOMContentLoaded', function () { 375 updateSnsBoardHeight(); 376 }); 377 } else { 378 updateSnsBoardHeight(); 379 } 380 381 // 리ì¬ì´ì¦ ìë§ë¤ ë¤ì ê³ì° 382 window.addEventListener('resize', onResize); 383 384 // í ì í ììë ë¤ì ê³ì° (기존 í 구조 íì©) 385 // data-type="tab" ë´ board-title í´ë¦ í activeê° ë°ëë©´ ëì´ ì¬ê³ì° 386 $(document).on('click', '.sns-box [data-type=tab] .board-title', function () { 387 // 기존 í ë¡ì§ì´ active í´ëì¤ë¥¼ ë°ê¾¼ ë¤ì í¸ì¶ëë ê²ì´ ê°ì¥ ì´ìì ì´ì§ë§, 388 // click ì´ë²¤í¸ í DOM ê°±ì íì´ë°ì ìí´ setTimeoutì¼ë¡ í í± ë¤ì ì¤í 389 setTimeout(function () { 390 updateSnsBoardHeight(); 391 }, 0); 392 }); 393})(); 394 395// swiper 커ì¤í í¨ì 396function swiperCustom(swiper, option) { 397 if (Array.isArray(swiper)) { 398 for (var i = 0; i < swiper.length; i++) { 399 setSwiperCustom(swiper[i]); 400 } 401 } else { 402 setSwiperCustom(swiper); 403 } 404 405 function setSwiperCustom(swiper) { 406 // ì¤ìì´í¼ê° ìì ê²½ì° ìë¬ ë°©ì§ 407 if (!swiper) { 408 console.warn("Swiperê° ì¡´ì¬íì§ ììµëë¤."); 409 return; 410 } 411 412 // 기본 ìµì ì¤ì 413 var defaultOption = { 414 autoBtn: false, 415 slideFocus: true, 416 edgeClass: false, 417 }; 418 419 // ìµì ë³í© (IE11 ìì í ë°©ì) 420 var mergedOption = {}; 421 422 // defaultOptionìì í¤ ì¶ì¶ (IE11 í¸í) 423 var defaultKeys = []; 424 for (var key in defaultOption) { 425 if (defaultOption.hasOwnProperty(key)) { 426 defaultKeys.push(key); 427 } 428 } 429 430 // 기본 ìµì ë³µì¬ 431 for (var i = 0; i < defaultKeys.length; i++) { 432 var key = defaultKeys[i]; 433 mergedOption[key] = defaultOption[key]; 434 } 435 436 // ì¬ì©ì ìµì ë³í© 437 if (option) { 438 for (var i = 0; i < defaultKeys.length; i++) { 439 var key = defaultKeys[i]; 440 if (option[key] !== undefined) { 441 mergedOption[key] = option[key]; 442 } 443 } 444 } else { 445 mergedOption = defaultOption; 446 } 447 448 // ê¸°ë¥ ì¤ì 449 var setupFunctions = { 450 autoBtn: function () { 451 autoBtn(swiper, mergedOption.autoBtn); 452 }, 453 slideFocus: function () { 454 slideFocus(swiper); 455 }, 456 edgeClass: function () { 457 edgeClass(swiper); 458 }, 459 }; 460 for (var i = 0; i < defaultKeys.length; i++) { 461 var key = defaultKeys[i]; 462 if (mergedOption[key]) { 463 setupFunctions[key](); 464 } 465 } 466 467 // ìë ì¬ì ë²í¼ ê¸°ë¥ ì¤ì 468 function autoBtn(swiper, selector) { 469 if (!swiper.autoplay || !swiper.autoplay.running) {
470 console.warn(swiper.el,"Swiperì autoplayê° íì±íëì´ ìì§ ììµëë¤."); 471 return; 472 } 473 var autoBtn = 474 swiper.el.querySelector(selector) || 475 swiper.el.parentElement.querySelector(selector) || 476 document.querySelector(selector); 477 478 // pagination ìì 찾기 479 var pagerEl = null; 480 if (swiper.pagination && swiper.pagination.el) { 481 // íì´ì§ë¤ì´ì ì´ ë¬¸ìì´ì¼ ê²½ì° (ì íì) 482 if (typeof swiper.params.pagination.el === "string") { 483 pagerEl = document.querySelector(swiper.params.pagination.el); 484 } 485 // íì´ì§ë¤ì´ì ì´ DOM ììì¼ ê²½ì° 486 else if (swiper.params.pagination.el instanceof Element) { 487 pagerEl = swiper.params.pagination.el; 488 } 489 } 490 491 if (!autoBtn) { 492 console.warn("ìëì¬ì ë²í¼ ìì를 ì°¾ì ì ììµëë¤: " + selector); 493 return; 494 } 495 496 var delay = swiper.params.autoplay.delay || 3000; 497 498 if (pagerEl) { 499 pagerEl.style.animationDuration = delay - 100 + "ms"; 500 } 501 502 var updateState = function () { 503 if (swiper.autoplay.running) { 504 autoBtn.setAttribute("aria-label", "ì¬ë¼ì´ë ì ì§"); 505 autoBtn.classList.remove("paused"); 506 } else { 507 autoBtn.setAttribute("aria-label", "ì¬ë¼ì´ë ì¬ì"); 508 autoBtn.classList.add("paused"); 509 } 510 }; 511 512 updateState(); 513 514 function toggleAuto() { 515 if (swiper.autoplay.running) { 516 swiper.autoplay.stop(); 517 if (pagerEl) pagerEl.classList.add("paused"); 518 } else { 519 swiper.autoplay.start(); 520 if (pagerEl) { 521 pagerEl.classList.remove("paused"); 522 pagerEl.style.animationDuration = delay - 100 + "ms"; 523 } 524 } 525 } 526 527 autoBtn.addEventListener("click", toggleAuto); 528 autoBtn.addEventListener("click", updateState); 529 530 if (pagerEl) { 531 swiper.on("slideChangeTransitionStart", function () { 532 pagerEl.style.animationDuration = 533 delay + swiper.params.speed - 100 + "ms"; 534 }); 535 } 536 537 swiper.on("beforeDestroy", function () { 538 autoBtn.removeEventListener("click", toggleAuto); 539 autoBtn.removeEventListener("click", updateState); 540 }); 541 } 542 543 // ì¬ë¼ì´ë í¬ì»¤ì¤ ì¤ì í¨ì 544 function slideFocus(swiper) { 545 swiper.params.watchSlidesProgress = true; 546 swiper.params.watchSlidesVisibility = true; 547 swiper.update(); 548 var updateSlideFocus = function () { 549 var slides = swiper.slides; 550 if (!slides || slides.length === 0) return; 551 552 for (var i = 0; i < slides.length; i++) { 553 var slide = slides[i]; 554 var tags = slide.querySelectorAll( 555 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])' 556 ); 557 var isFocusable = 558 slide.tagName.toLowerCase() === "a" || 559 slide.tagName.toLowerCase() === "button"; 560 var isVisible = slide.classList.contains("swiper-slide-visible"); 561 562 if (isVisible) { 563 for (var j = 0; j < tags.length; j++) { 564 tags[j].setAttribute("tabindex", 0); 565 tags[j].setAttribute("aria-hidden", "false"); 566 } 567 slide.setAttribute("aria-hidden", "false"); 568 if (isFocusable) slide.setAttribute("tabindex", 0); 569 } else { 570 for (var j = 0; j < tags.length; j++) { 571 tags[j].setAttribute("tabindex", -1); 572 tags[j].setAttribute("aria-hidden", "true"); 573 } 574 slide.setAttribute("aria-hidden", "true"); 575 if (isFocusable) slide.setAttribute("tabindex", -1); 576 } 577 } 578 }; 579 580 updateSlideFocus(); 581 swiper.on("slideChangeTransitionStart", updateSlideFocus); 582 swiper.on("observerUpdate", updateSlideFocus); 583 swiper.on("resize", updateSlideFocus); 584 } 585 586 // ì£ì§ í´ëì¤ ì¤ì í¨ì 587 function edgeClass(swiper) { 588 function updateClass() { 589 if (swiper.progress === 0) { 590 swiper.el.classList.add("begin"); 591 } else { 592 swiper.el.classList.remove("begin"); 593 } 594 if (swiper.progress === 1) { 595 swiper.el.classList.add("end"); 596 } else { 597 swiper.el.classList.remove("end"); 598 } 599 } 600 updateClass(); 601 swiper.on("progress", updateClass); 602 } 603 } 604} 605 606// íë©ë´ 607$('[data-type=tab]').each(function (key, item) { 608 var tabIdName = 'tab' + key; 609 this.id = tabIdName; 610 var tabId = '#' + tabIdName; 611 var n = 0; 612 613 var $tab = $(tabId).find('> .board-item'); 614 var $title = $(tabId).find('> .board-item > .board-title'); 615 616 $title.next('.board-content').hide(); 617 $title.next('.board-more').hide(); 618 $tab.eq(n).addClass('active'); 619 $tab.eq(n).children('.board-title').next('.board-content').show(); 620 $tab.eq(n).children('.board-title').next('.board-more').show(); 621 622 $title.on("click", function () { 623 var url; 624 var tabIndex = $(this).parent().index() 625 console.log(tabIndex) 626 if ($(this).attr("href")) url = $(this).attr('href').attr('target', $(this).attr('target')); 627 628 $title.next('.board-content').hide(); 629 $title.next('.board-more').hide(); 630 $title.parent().removeClass('active'); 631 $(this).next('.board-content').show(); 632 $(this).next('.board-more').show(); 633 $(this).parent().addClass('active'); 634 });
vendor: 9,385 bytes, lines 635-866
635}); 636 637// ajaxModal 638/* 639 A simple jQuery AJAX_modal (http://github.com/kylefox/jquery-AJAX_modal) 640 Version 0.9.2 641*/ 642(function (factory) { 643 if(typeof module === "object" && typeof module.exports === "object") { 644 factory(require("jquery"), window, document); 645 } 646 else { 647 factory(jQuery, window, document); 648 } 649}(function($, window, document, undefined) { 650 651 var AJAX_modals = [], 652 getCurrent = function() { 653 return AJAX_modals.length ? AJAX_modals[AJAX_modals.length - 1] : null; 654 }, 655 selectCurrent = function() { 656 var i, 657 selected = false; 658 for (i=AJAX_modals.length-1; i>=0; i--) { 659 if (AJAX_modals[i].$blocker) { 660 AJAX_modals[i].$blocker.toggleClass('current',!selected).toggleClass('behind',selected); 661 selected = true; 662 } 663 } 664 }; 665 666 $.AJAX_modal = function(el, options) { 667 var remove, target; 668 this.$body = $('body'); 669 this.options = $.extend({}, $.AJAX_modal.defaults, options); 670 this.options.doFade = !isNaN(parseInt(this.options.fadeDuration, 10)); 671 this.$blocker = null; 672 this.result = null; 673 if (this.options.closeExisting) 674 while ($.AJAX_modal.isActive()) 675 $.AJAX_modal.close(); // Close any open AJAX_modals. 676 AJAX_modals.push(this); 677 if (el.is('a')) { 678 target = el.attr('href'); 679 this.anchor = el; 680 if (/^#/.test(target)) { 681 this.$elm = $(target); 682 if (this.$elm.length !== 1) return null; 683 this.$body.append(this.$elm); 684 this.open(); 685 //AJAX 686 } else { 687 this.$elm = $('<div>'); 688 this.$body.append(this.$elm); 689 remove = function(event, AJAX_modal) { AJAX_modal.elm.remove(); }; 690 this.showSpinner(); 691 el.trigger($.AJAX_modal.AJAX_SEND); 692 $.get(target).done(function(html) { 693 if (!$.AJAX_modal.isActive()) return; 694 el.trigger($.AJAX_modal.AJAX_SUCCESS); 695 var current = getCurrent(); 696 current.$elm.empty().append(html).on($.AJAX_modal.CLOSE, remove); 697 current.hideSpinner(); 698 current.open(); 699 el.trigger($.AJAX_modal.AJAX_COMPLETE); 700 }).fail(function() { 701 el.trigger($.AJAX_modal.AJAX_FAIL); 702 var current = getCurrent(); 703 current.hideSpinner(); 704 AJAX_modals.pop(); // remove expected AJAX_modal from the list 705 el.trigger($.AJAX_modal.AJAX_COMPLETE); 706 }); 707 } 708 } else { 709 this.$elm = el; 710 this.anchor = el; 711 this.$body.append(this.$elm); 712 this.open(); 713 } 714 }; 715 716 $.AJAX_modal.prototype = { 717 constructor: $.AJAX_modal, 718 open: function() { 719 var m = this; 720 this.block(); 721 this.anchor.focus(); 722 if(this.options.doFade) { 723 setTimeout(function() { 724 m.show(); 725 }, this.options.fadeDuration * this.options.fadeDelay); 726 } else { 727 this.show(); 728 } 729 $(document).off('keydown.AJAX_modal').on('keydown.AJAX_modal', function(event) { 730 var current = getCurrent(); 731 if (event.which === 27 && current.options.escapeClose) current.close(); 732 }); 733 if (this.options.clickClose) 734 this.$blocker.click(function(e) { 735 if (e.target === this) 736 $.AJAX_modal.close(); 737 }); 738 }, 739 close: function(ret) { 740 this.result = ret; 741 AJAX_modals.pop(); 742 this.unblock(); 743 this.hide(); 744 if (!$.AJAX_modal.isActive()) 745 $(document).off('keydown.AJAX_modal'); 746 }, 747 748 block: function() { 749 this.$elm.trigger($.AJAX_modal.BEFORE_BLOCK, [this._ctx()]); 750 this.$body.css('overflow','hidden'); 751 this.$blocker = $('<div class="' + this.options.blockerClass + ' current"></div>').appendTo(this.$body); 752 selectCurrent(); 753 if(this.options.doFade) { 754 this.$blocker.css('opacity',0).animate({opacity: 1}, this.options.fadeDuration); 755 } 756 this.$elm.trigger($.AJAX_modal.BLOCK, [this._ctx()]); 757 }, 758 759 unblock: function(now) { 760 if (!now && this.options.doFade) 761 this.$blocker.fadeOut(this.options.fadeDuration, this.unblock.bind(this,true)); 762 else { 763 this.$blocker.children().appendTo(this.$body); 764 this.$blocker.remove(); 765 this.$blocker = null; 766 selectCurrent(); 767 if (!$.AJAX_modal.isActive()) 768 this.$body.css('overflow',''); 769 } 770 }, 771 772 show: function() { 773 this.$elm.trigger($.AJAX_modal.BEFORE_OPEN, [this._ctx()]); 774 if (this.options.showClose) { 775 this.closeButton = $('<a href="#close-modal" rel="AJAX_modal:close" class="close-modal ' + this.options.closeClass + '">' + this.options.closeText + '</a>'); 776 this.$elm.prepend(this.closeButton); 777 } 778 this.$elm.addClass(this.options.AJAX_modalClass).prependTo(this.$blocker); 779 if(this.options.doFade) { 780 this.$elm.css({opacity: 0, display: 'inline-block'}).animate({opacity: 1}, this.options.fadeDuration); 781 } else { 782 this.$elm.css('display', 'inline-block'); 783 } 784 this.$elm.trigger($.AJAX_modal.OPEN, [this._ctx()]); 785 }, 786 787 hide: function() { 788 this.$elm.trigger($.AJAX_modal.BEFORE_CLOSE, [this._ctx()]); 789 if (this.closeButton) this.closeButton.remove(); 790 var _this = this; 791 if(this.options.doFade) { 792 this.$elm.fadeOut(this.options.fadeDuration, function () { 793 _this.$elm.trigger($.AJAX_modal.AFTER_CLOSE, [_this._ctx()]); 794 _this.$elm.remove(); 795 }); 796 } else { 797 this.$elm.hide(0, function () { 798 _this.$elm.trigger($.AJAX_modal.AFTER_CLOSE, [_this._ctx()]); 799 _this.$elm.remove(); 800 }); 801 } 802 this.$elm.trigger($.AJAX_modal.CLOSE, [this._ctx()]); 803 }, 804 805 showSpinner: function() { 806 if (!this.options.showSpinner) return; 807 this.spinner = this.spinner || $('<div class="' + this.options.AJAX_modalClass + '-spinner"></div>') 808 .append(this.options.spinnerHtml); 809 this.$body.append(this.spinner); 810 this.spinner.show(); 811 }, 812 hideSpinner: function() { 813 if (this.spinner) this.spinner.remove(); 814 }, 815 _ctx: function() { 816 return { elm: this.$elm, $elm: this.$elm, $blocker: this.$blocker, options: this.options, $anchor: this.anchor, result: this.result }; 817 } 818 }; 819 $.AJAX_modal.close = function(event) { 820 if (!$.AJAX_modal.isActive()) return; 821 if (event) event.preventDefault(); 822 var current = getCurrent(); 823 current.close(); 824 return current.$elm; 825 }; 826 $.AJAX_modal.isActive = function () { 827 return AJAX_modals.length > 0; 828 }; 829 $.AJAX_modal.getCurrent = getCurrent; 830 $.AJAX_modal.defaults = { 831 closeExisting: true, 832 escapeClose: true, 833 clickClose: true, 834 closeText: 'Close', 835 closeClass: '', 836 AJAX_modalClass: "modal_popup", 837 blockerClass: "ui-modal__backdrop", 838 spinnerHtml: '<div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div>', 839 showSpinner: true, 840 showClose: true, 841 fadeDuration: null, 842 fadeDelay: 1.0 843 }; 844 // Event constants 845 $.AJAX_modal.BEFORE_BLOCK = 'AJAX_modal:before-block'; 846 $.AJAX_modal.BLOCK = 'AJAX_modal:block'; 847 $.AJAX_modal.BEFORE_OPEN = 'AJAX_modal:before-open'; 848 $.AJAX_modal.OPEN = 'AJAX_modal:open'; 849 $.AJAX_modal.BEFORE_CLOSE = 'AJAX_modal:before-close'; 850 $.AJAX_modal.CLOSE = 'AJAX_modal:close'; 851 $.AJAX_modal.AFTER_CLOSE = 'AJAX_modal:after-close'; 852 $.AJAX_modal.AJAX_SEND = 'AJAX_modal:ajax:send'; 853 $.AJAX_modal.AJAX_SUCCESS = 'AJAX_modal:ajax:success'; 854 $.AJAX_modal.AJAX_FAIL = 'AJAX_modal:ajax:fail'; 855 $.AJAX_modal.AJAX_COMPLETE = 'AJAX_modal:ajax:complete'; 856 $.fn.AJAX_modal = function(options){ 857 if (this.length === 1) { 858 new $.AJAX_modal(this, options); 859 } 860 return this; 861 }; 862 $(document).on('click.AJAX_modal', 'a[rel~="AJAX_modal:close"]', $.AJAX_modal.close); 863 $(document).on('click.AJAX_modal', 'a[rel~="AJAX_modal:open"]', function(event) { 864 event.preventDefault(); 865 $(this).AJAX_modal(); 866 });
867})); 868// Ajax modal 869(function () { 870 $(document).on("click", "[data-button='ajaxModal']", function (e) { 871 if ($(this).data("url")) { 872 e.preventDefault(); 873 $(this).each(function () { 874 var $this, url, target, prev, next; 875 $this = $(this); 876 url = $this.data('url'); 877 target = $this.data('target'); 878 prev = $this.data('focus-prev'); 879 next = $this.data('focus-next'); 880 881 $.get(url, function (data) { 882 $("html,body").css({ 883 "height": "100%", 884 "overflow": "hidden" 885 }); 886 887 $("<div class='ui-modal__ajax " + target + "'>" + data + "</div>") 888 .appendTo('body') 889 .AJAX_modal(); 890 891 $(".ui-modal__ajax .close-modal") 892 .focus() 893 .attr('data-button', 'ajaxModalClose') 894 .attr('data-focus-prev', prev) 895 .attr('data-focus-next', next); 896 897 $(document).on("click", "[data-button='ajaxModalClose']", function (e) { 898 e.preventDefault(); 899 $(this).each(function () { 900 var $this2, prev2, next2; 901 $this2 = $(this); 902 prev2 = $this2.data('focus-prev'); 903 next2 = $this2.data('focus-next'); 904 905 $("[data-focus-next='" + next2 + "']").focus(); 906 $("html,body").removeAttr('style'); 907 908 $("[class='ui-modal__ajax " + target + "']") 909 .remove('') 910 .AJAX_modal(); 911 }); 912 }); 913 }); 914 }); 915 } 916 }); 917 $(document).on($.AJAX_modal.AFTER_CLOSE, function (e, ctx) { 918 if (ctx && ctx.$elm && ctx.$elm.hasClass('ui-modal__ajax')) { 919 $("html,body").removeAttr('style'); 920 } 921 }); 922})();
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.