1(function ($) { 2 3 'use strict'; 4 5 $('[data-parts]').each(function(index, element) { 6 loadTemplate($(this)); 7 }) 8 9 /** 10 * setting 11 */ 12 var win = window; 13 var $win = $(win); 14 var doc = document; 15 var body = doc.body; 16 var $body = $(body); 17 var fukoku = win.fukoku; 18 var focusable = [ 19 'a[href]', 'area[href]', '[onclick]', '[tabindex]', 20 'input', 'button', 'select', 'option', 'textarea', 'output', 'summary', 21 'video', 'audio', 'object', 'embed' 22 ].join(','); 23 var isJpn = body.lang === 'ja'; 24 var winSize; 25 var setBlind; 26 var isFixedNav; 27 28 29 /** 30 * plugin: createElement 31 */ 32 $.ce = function (tag, attr, append) { 33 var $ce = $(doc.createElement(tag)); 34 35 if (typeof attr !== 'undefined') { 36 $ce.attr(attr); 37 } 38 39 if (typeof append !== 'undefined') { 40 $ce.append(append); 41 } 42 43 return $ce; 44 }; 45 46 47 /** 48 * plugin: eventChangeBP 49 */ 50 $.eventChangeBP = function (options) { 51 52 if (!this) { 53 return false; 54 } 55 56 var o = $.extend({ 57 'breakPoint' : { 58 'medium' : 1024, 59 'small' : 768 60 } 61 }, options); 62 var mqlM; 63 var mqlS; 64 65 function _mql (maxWidth) { 66 return win.matchMedia('screen and (max-width: ' + maxWidth + 'px)'); 67 } 68 69 function _matchMQL () { 70 if (mqlS.matches) { 71 winSize = 'S'; 72 } else if (mqlM.matches) { 73 winSize = 'M'; 74 } else { 75 winSize = 'L'; 76 } 77 $win.trigger('changeBP'); 78 } 79 80 mqlM = _mql(o.breakPoint.medium); 81 mqlS = _mql(o.breakPoint.small); 82 83 _matchMQL(); 84 85 mqlM.addListener(_matchMQL); 86 mqlS.addListener(_matchMQL); 87 88 }; 89 90 91 /** 92 * plugin: controlBlind 93 */ 94 $.controlBlind = function (options) { 95 96 if (!this) { 97 return false; 98 } 99 100 var o = $.extend({ 101 'blindId' : 'blind', 102 'notTabindex' : '', 103 'controlCls' : { 104 'isShow' : 'is-show', 105 'isAnimate' : 'is-animate' 106 } 107 }, options); 108 var $blind = $('#' + o.blindId); 109 var delay = 30; 110 var arrTabindex = []; 111 var $focusable; 112 var focusableLength; 113 var i; 114 115 if (!$blind.length) { 116 $blind = $.ce('div', { 117 'id' : o.blindId, 118 'role' : 'presentation' 119 }); 120 121 $body.append($blind); 122 123 $blind = $('#' + o.blindId); 124 } 125 126 function _showBlind () { 127 if ($blind.hasClass(o.controlCls.isAnimate)) { 128 return; 129 } 130 131 $focusable = $(focusable); 132 focusableLength = $focusable.length; 133 arrTabindex = []; 134 135 for (i = 0; i < focusableLength; i++) { 136 arrTabindex.push($focusable.eq(i).attr('tabindex')); 137 } 138 $focusable.not(o.notTabindex).attr('tabindex', -1); 139 $blind.addClass(o.controlCls.isShow); 140 141 setTimeout(function () { 142 $blind.off('transitionend.controlBlind').addClass(o.controlCls.isAnimate); 143 }, delay); 144 } 145 146 function _hideBlind () { 147 if (!$focusable) { 148 return; 149 } 150 151 $focusable.removeAttr('tabindex'); 152 153 for (i = 0; i < focusableLength; i++) { 154 if (arrTabindex[i] !== 'undefined') { 155 $focusable.eq(i).attr('tabindex', arrTabindex[i]); 156 } 157 } 158 159 $blind.removeClass(o.controlCls.isAnimate).on('transitionend.controlBlind', function () { 160 $blind.removeClass(o.controlCls.isShow); 161 }); 162 } 163 164 $win.on('changeBlind.show', function () { 165 _showBlind(); 166 }).on('changeBlind.hide', function () { 167 _hideBlind(); 168 }); 169 170 }; 171 172 173 /** 174 * plugin: controlNav 175 */ 176 $.controlNav = function (options) { 177 178 if (!this) { 179 return false; 180 } 181 182 var o = $.extend({ 183 'root' : '#header', 184 'menu' : '> #menu', 185 'orderChange' : '> .utility', 186 'blind' : '#blind', 187 'switch' : { 188 'cls' : 'btn-menu', 189 'label' : { 190 'isClose' : 'Menu', 191 'isOpen' : 'Close' 192 } 193 }, 194 'close' : { 195 'cls' : 'btn-close', 196 'label' : !isJpn ? 'Close' : '\u9589\u3058\u308b' // éãã 197 }, 198 'fixed' : { 199 'isFixedCls' : 'is-header-fixed', 200 'isStopCls' : 'is-header-stop' 201 }, 202 'isOpenCls' : 'is-menu-open' 203 }, options); 204 var $root = $(o.root); 205 var $menu = $root.find(o.menu); 206 207 if (!$menu.length) { 208 return; 209 } 210 211 var $defaultOrder = $root.children();
212 var $orderChange = $root.find(o.orderChange); 213 var $switchWrap = $.ce('p', { 214 'class' : o.switch.cls 215 }, $.ce('button', { 216 'type' : 'button', 217 'aria-controls' : $menu.attr('id') 218 }, $.ce('span').text(o.switch.label.isClose))); 219 var $switch = $switchWrap.find('button'); 220 var $label = $switch.find('span'); 221 var $closeWrap = $.ce('p', { 222 'class' : o.close.cls 223 }, $.ce('button', { 224 'type' : 'button' 225 }, $.ce('span').text(o.close.label))); 226 var $close = $closeWrap.find('button'); 227 var $adjustElm = $root.next(); 228 var posY = $root.offset().top; 229 var fixedHeight = $root.outerHeight(); 230 var timer = false; 231 var isOpen = false; 232 var isFixed = false; 233 var delay = 30; 234 var debounce = 100; 235 var $blind; 236 var scrlY; 237 238 function _setMenu () { 239 if (winSize !== 'S') { 240 $switch.removeAttr('aria-expanded'); 241 $menu.removeAttr('aria-expanded').off('transitionend.controlNav').css('overflow-y', ''); 242 $root.append($defaultOrder); 243 $win.trigger('changeBlind.' + [setBlind ? 'show' : 'hide']); 244 } else { 245 $menu.before($switchWrap).append($orderChange, $closeWrap).css('overflow-y', isOpen ? 'auto' : ''); 246 _setState(); 247 $win.trigger('changeBlind.' + [isOpen ? 'show' : 'hide']); 248 } 249 250 $.controlBlind({ 251 'notTabindex' : $root.find(focusable) 252 }); 253 254 if (!$blind) { 255 $blind = $(o.blind); 256 } 257 } 258 259 function _setState () { 260 $menu.attr('aria-expanded', isOpen); 261 $switch.attr('aria-expanded', isOpen); 262 $label.text(o.switch.label[isOpen ? 'isOpen' : 'isClose']); 263 } 264 265 function _setHeight () { 266 var menuHeight = 0; 267 268 for (var i = 0; i < $menu.children().length; i++) { 269 menuHeight += $menu.children().eq(i).outerHeight(); 270 } 271 272 return menuHeight; 273 } 274 275 function _closeMenu () { 276 isOpen = false; 277 _setState(); 278 $menu.off('transitionend.controlNav').css('height', _setHeight()); 279 $win.trigger('changeBlind.hide'); 280 setTimeout(function () { 281 $menu.css({ 282 'height' : 0, 283 'overflow-y' : '' 284 }).on('transitionend.controlNav', function () { 285 $menu.css('height', ''); 286 $body.removeClass(o.isOpenCls); 287 }); 288 }, delay); 289 } 290 291 _setMenu(); 292 293 $win.on('changeBP', function () { 294 _setMenu(); 295 }); 296 297 $switch.on('click', function () { 298 if (!isOpen) { 299 isOpen = true; 300 _setState(); 301 $body.addClass(o.isOpenCls).removeClass(o.fixed.isStopCls); 302 $win.trigger('changeBlind.show'); 303 304 setTimeout(function () { 305 $menu.off('transitionend.controlNav').css('height', _setHeight()).on('transitionend.controlNav', function () { 306 $menu.css({ 307 'height' : 'auto', 308 'overflow-y' : 'auto' 309 }).trigger('scroll'); 310 }); 311 }, delay); 312 } else { 313 _closeMenu(); 314 } 315 }); 316 317 $menu.on('touchstart', function (e) { 318 e.stopPropagation(); 319 }); 320 321 $close.on('click', function () { 322 _closeMenu(); 323 }); 324 325 $blind.on('click', function () { 326 if (winSize === 'S') { 327 _closeMenu(); 328 } 329 }); 330 331 if (!o.fixed) { 332 return; 333 } 334 335 isFixedNav = true; 336 337 function _controlFixed () { 338 scrlY = $win.scrollTop(); 339 340 if (!isFixed && (winSize === 'S' && !isOpen)) { 341 fixedHeight = $root.outerHeight(); 342 } 343 344 if ((posY + fixedHeight) < scrlY) { 345 $body.addClass(o.fixed.isFixedCls).removeClass(o.fixed.isStopCls); 346 $adjustElm.css('margin-top', fixedHeight); 347 isFixed = true; 348 } else { 349 if (!isFixed) { 350 return; 351 } 352 353 $body.addClass(o.fixed.isStopCls).removeClass(o.fixed.isFixedCls); 354 $adjustElm.css('margin-top', ''); 355 isFixed = false; 356 } 357 } 358 359 _controlFixed(); 360 361 $win.on('touchstart touchend', function () { 362 _controlFixed(); 363 }).on('touchmove scroll', function () { 364 if (timer) { 365 clearTimeout(timer); 366 } 367 368 timer = setTimeout(function () { 369 _controlFixed(); 370 timer = false; 371 }, debounce); 372 }); 373 }; 374 375 376 /** 377 * plugin: currentNav 378 */ 379 $.currentNav = function (options) { 380 381 if (!this) { 382 return false; 383 } 384 385 var o = $.extend({ 386 'nav' : '#menu > .g-nav > ul > li > a', 387 'currentCls' : 'current', 388 // 'unique' : false /* [ 389 // ['/dummy2/index.html', 'dummy1'], 390 // ['/dummy3/index.html', 'dummy4'] 391 // ] */ 392 }, options);
393 var $nav = $(o.nav); 394 var navLength = $nav.length; 395 396 if (!navLength) { 397 return; 398 } 399 400 var $navWrap = $nav.parent(); 401 var path = location.pathname; 402 var $aTgt; 403 var hrefDir; 404 var i; 405 406 function _setCurrent ($tgt) { 407 $navWrap.removeClass(o.currentCls); 408 $tgt.addClass(o.currentCls); 409 } 410 411 for (i = 0; i < navLength; i++) { 412 $aTgt = $navWrap.eq(i); 413 hrefDir = $nav.eq(i).attr('href').replace('index.html', ''); 414 415 // if (isUnique !== '') { 416 if (path.match(hrefDir)) { 417 _setCurrent($aTgt); 418 } 419 // } 420 421 } 422 423 }; 424 425 426 /** 427 * plugin: tglSubNav 428 */ 429 $.tglSubNav = function (options) { 430 431 if (!this) { 432 return false; 433 } 434 435 var o = $.extend({ 436 'root' : '#header', 437 'wrap' : '#menu > .g-nav > ul > li', 438 'tgt' : 'dl', 439 'tgtIn' : 'div', 440 'blind' : '#blind', 441 'controlCls' : { 442 'wrap' : 'is-nav-open', 443 'child' : 'is-open' 444 }, 445 'currentCls' : 'current' 446 }, options); 447 var $root = $(o.root); 448 var $wrap = $root.find(o.wrap); 449 450 if (!$wrap.length) { 451 return; 452 } 453 var $switch = $wrap.children('a'); 454 var delay = 30; 455 var $blind; 456 var tgtHeight; 457 var i; 458 459 $.controlBlind({ 460 'notTabindex' : $root.find(focusable) 461 }); 462 $blind = $(o.blind); 463 464 for (i = 0; i < $switch.length; i++) { 465 var $aSwitch = $switch.eq(i); 466 var $aTgt = $aSwitch.siblings(o.tgt).attr('aria-expanded', false); 467 468 if ($aTgt.length) { 469 $aSwitch.attr({ 470 'role' : 'button', 471 'aria-controls' : $aTgt.attr('id'), 472 'aria-expanded' : false, 473 'aria-pressed' : false 474 }); 475 } 476 } 477 478 function _closeSubNav ($closeSwitch) { 479 var $closeTgt = $closeSwitch.siblings(o.tgt); 480 var $closeWrap = $closeSwitch.parent(); 481 482 $closeSwitch.attr({ 483 'aria-expanded' : false, 484 'aria-pressed' : false 485 }); 486 487 setBlind = false; 488 tgtHeight = $closeTgt.children(o.tgtIn).outerHeight(); 489 $closeTgt.css('height', $closeTgt.children(o.tgtIn).outerHeight()); 490 491 setTimeout(function () { 492 $closeTgt.off('transitionend.tglSubNav').attr('aria-expanded', false).css({ 493 'height' : '', 494 'overflow-y' : '' 495 }).on('transitionend.tglSubNav', function () { 496 $closeWrap.removeClass(o.controlCls.child); 497 498 if ($wrap.filter('.' + o.controlCls.child).length) { 499 return; 500 } 501 502 $body.removeClass(o.controlCls.wrap); 503 504 if (winSize !== 'S') { 505 $win.trigger('changeBlind.hide'); 506 } 507 }); 508 }, delay); 509 } 510 511 $switch.on('click', function (e) { 512 var $thisSwitch = $(this); 513 var $thisTgt = $thisSwitch.siblings(o.tgt); 514 515 if ($thisTgt.length) { 516 e.preventDefault(); 517 } else { 518 return; 519 } 520 521 var $thisWrap = $thisSwitch.parent(); 522 var $beforeWrap = $wrap.filter('.' + o.controlCls.child); 523 var isOpen = $thisWrap.hasClass(o.controlCls.child); 524 525 if (!isOpen) { 526 $body.addClass(o.controlCls.wrap); 527 $thisWrap.addClass(o.controlCls.child); 528 $thisSwitch.attr({ 529 'aria-expanded' : true, 530 'aria-pressed' : true 531 }); 532 533 _closeSubNav($beforeWrap.children('a')); 534 535 if (winSize !== 'S') { 536 $beforeWrap.removeClass(o.controlCls.child); 537 $win.trigger('changeBlind.show'); 538 } 539 540 tgtHeight = $thisTgt.children(o.tgtIn).outerHeight(); 541
542 $thisTgt.off('transitionend.tglSubNav').attr('aria-expanded', true).css({ 543 'height' : tgtHeight, 544 'overflow-y' : '' 545 }).on('transitionend.tglSubNav', function () { 546 setBlind = true; 547 548 $thisTgt.css({ 549 'height' : 'auto', 550 'overflow-y' : 'auto' 551 }); 552 }); 553 } else { 554 _closeSubNav($thisSwitch); 555 } 556 557 $blind.on('click', function () { 558 if (winSize !== 'S') { 559 _closeSubNav($thisSwitch); 560 } 561 }); 562 563 }); 564 565 /* current open for sp */ 566 if (winSize === 'S') { 567 for (var i = 0; i < $wrap.length; i++) { 568 var $thisWrap = $wrap.eq(i); 569 var $thisSwitch = $thisWrap.children('a'); 570 var $thisTgt = $thisSwitch.siblings(o.tgt); 571 572 if ($thisWrap.hasClass(o.currentCls) && $thisTgt.length) { 573 $thisSwitch.trigger('click'); 574 $thisTgt.attr('aria-expanded', true); 575 setBlind = true; 576 $thisTgt.css({ 577 'height' : 'auto', 578 'overflow-y' : 'auto' 579 }); 580 581 break; 582 } 583 } 584 } 585 }; 586 587 588 /** 589 * plugin: setLinkInfo 590 */ 591 $.setLinkInfo = function (options) { 592 593 if (!this) { 594 return false; 595 } 596 597 var o = $.extend({ 598 'root' : '#page', 599 'icn' : { 600 'src' : '/img/share/icn-%%type%%-01.png', 601 'alt' : { 602 'blank' : !isJpn ? ' (New Window)' : '\uff08\u65b0\u3057\u3044\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u958b\u304f\uff09', // ï¼æ°ããã¦ã£ã³ãã¦ã§éãï¼ 603 'file' : ' (%%type%%)' 604 }, 605 'cls' : 'icn-01 _%%type%%', 606 'uniqueAppend' : '.set-info-tgt' 607 }, 608 'tgtType' : { 609 'pdf' : { 610 'icn' : true, 611 'size' : true 612 }, 613 'excel' : { 614 'icn' : false, 615 'size' : false 616 }, 617 'zip' : { 618 'icn' : false, 619 'size' : false 620 }, 621 'blank' : { 622 'icn' : true 623 } 624 }, 625 'sizeCls' : 'txt-size-01', 626 'notCls' : 'no-set-info' 627 }, options); 628 var $elm = $(o.root).find('a'); 629 var i; 630 631 function _setInfo ($tgt, type, href) { 632 function _setIcn () { 633 if (o.tgtType[type].icn) { 634 var $icn = $.ce('img').attr({ 635 'src' : o.icn.src.replace(/%%type%%/g, type), 636 'alt' : type !== 'blank' ? o.icn.alt.file.replace(/%%type%%/g, type) : o.icn.alt.blank, 637 'class' : o.icn.cls.replace(/%%type%%/g, type) 638 }); 639 640 $tgt.append($icn); 641 } 642 } 643 644 if (o.tgtType[type].size) { 645 var $size = $.ce('span', { 646 'class' : o.sizeCls 647 }); 648 var units = [ 649 [1024 * 1024 * 1024, 'GB'], 650 [1024 * 1024, 'MB'], 651 [1024, 'KB'], 652 [1, 'bytes'] 653 ]; 654 655 $.ajax({
656 'url' : href, 657 'type' : 'HEAD', 658 'cache' : false 659 }).done(function (data, textStatus, jqXHR) { 660 var fileSize = jqXHR.getResponseHeader('Content-Length'); 661 662 for (i = 0; i < units.length; i++) { 663 var unitSize = units[i][0]; 664 var unitTxt = units[i][1]; 665 666 if (fileSize >= unitSize) { 667 fileSize = Math.ceil((fileSize / unitSize) * 10) / 10; 668 $tgt.append($size.text(' (' + fileSize + unitTxt + ')')); 669 _setIcn(); 670 break; 671 } 672 } 673 }); 674 } else { 675 _setIcn(); 676 } 677 } 678 679 for (i = 0; i < $elm.length; i++) { 680 var $aElm = $elm.eq(i); 681 var $aAppendTgt = $aElm.find(o.icn.uniqueAppend); 682 var $aTgt = $aAppendTgt.length ? $aAppendTgt : $aElm; 683 var aHref = $aElm.attr('href'); 684 685 if ($aElm.find('img').length || $aElm.hasClass(o.notCls)) { 686 continue; 687 } 688 if (/\.pdf/.test(aHref)) { 689 _setInfo($aTgt, 'pdf', aHref); 690 } else if (/\.xls/.test(aHref)) { 691 _setInfo($aTgt, 'excel', aHref); 692 } else if (/\.zip/.test(aHref)) { 693 _setInfo($aTgt, 'zip', aHref); 694 } else if (/http(s)?:\/\//.test(aHref)) { 695 _setInfo($aTgt, 'blank', aHref); 696 } else { 697 continue; 698 } 699 $aElm.attr('target', '_blank'); 700 } 701 702 }; 703 704 705 /** 706 * plugin: setTelLink 707 */ 708 $.fn.setTelLink = function (options) { 709 710 if (!this || !fukoku.ua.isPhone) { 711 return false; 712 } 713 714 var o = $.extend({ 715 'dataName' : 'tel-num' 716 }, options); 717 718 return this.each(function () { 719 720 var $tgt = $(this); 721 var tgtHtml = $tgt.html(); 722 var $link = $.ce('a', { 723 'href' : 'tel:' + $tgt.data(o.dataName) 724 }, tgtHtml); 725 726 $tgt.after($link).remove(); 727 728 }); 729 730 }; 731 732 733 /** 734 * plugin: smoothScroll 735 */ 736 $.fn.smoothScroll = function (options) { 737 738 if (!this) { 739 return false; 740 } 741 742 var o = $.extend({ 743 'duration' : 300, 744 'useFixed' : { 745 'elm' : '#header', 746 'isFixedCls' : 'is-header-fixed' 747 } 748 }, options); 749 750 return this.each(function () { 751 752 var $ancLink = $(this); 753 var $fixed; 754 var adjust; 755 756 $ancLink.on('click', function (e) { 757 var hash = $(this).attr('href'); 758 var $tgt = $(hash === '#top' ? 'html' : hash); 759 var tgtPosY = $tgt.offset().top; 760 761 if ($tgt.length) { 762 e.preventDefault(); 763 764 if (isFixedNav && hash !== '#top') { 765 $fixed = $body.addClass(o.useFixed.isFixedCls).find(o.useFixed.elm); 766 adjust = $fixed.outerHeight(); 767 tgtPosY -= adjust; 768 $body.removeClass(o.useFixed.isFixedCls); 769 } 770 771 if (location.hash !== hash) { 772 win.history.pushState(null, null, hash); 773 } 774 775 $('html, body').stop().animate({ 776 'scrollTop' : tgtPosY 777 }, o.duration, function () { 778 location.replace(hash); 779 $win.scrollTop(tgtPosY); 780 781 if (hash === '#top') { 782 $tgt.attr('tabindex', 0).trigger('focus').removeAttr('tabindex'); 783 } 784 }); 785 } 786 }); 787 788 }); 789 790 }; 791 792 793 /** 794 * plugin: checkNumAlert 795 */ 796 $.fn.checkNumAlert = function (options) { 797 798 if (!this) { 799 return false; 800 } 801 802 var o = $.extend({ 803 'max' : 3, 804 'alert' : '\u30c1\u30a7\u30c3\u30af\u3067\u304d\u308b\u9805\u76ee\u306f%%max%%\u500b\u307e\u3067\u3067\u3059\u3002' // ãã§ãã¯ã§ããé ç®ã¯%%max%%åã¾ã§ã
804§ãã 805 }, options); 806 807 return this.each(function () { 808 809 var $root = $(this); 810 var $check = $root.find('input[type="checkbox"]'); 811 var count = 0; 812 813 $check.on('change', function () { 814 var $thisCheck = $(this); 815 816 if ($thisCheck.prop('checked')) { 817 count++; 818 if (o.max < count) { 819 $thisCheck.prop('checked', false); 820 count--; 821 win.alert(o.alert.replace(/%%max%%/g, o.max)); 822 } 823 } else { 824 count--; 825 } 826 }); 827 828 }); 829 830 }; 831 832 833 /** 834 * plugin: noticeScrl 835 */ 836 $.fn.noticeScrl = function (options) { 837 838 if (!this) { 839 return false; 840 } 841 842 var o = $.extend({ 843 'tgt' : '> .notice-in', 844 'notice' : { 845 'cls' : 'txt-scrl-01', 846 'isHideCls' : 'is-hide', 847 'txt' : !isJpn ? 'The following table can be seen by scrolling horizontally.' : '\u4ee5\u4e0b\u306e\u8868\u306f\u6a2a\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u3054\u78ba\u8a8d\u3044\u305f\u3060\u3051\u307e\u3059\u3002' // 以ä¸ã®è¡¨ã¯æ¨ªã«ã¹ã¯ãã¼ã«ãã¦ã確èªããã ãã¾ãã 848 } 849 }, options); 850 851 return this.each(function () { 852 853 var $root = $(this); 854 var $tgt = $root.find(o.tgt); 855 var $notice = $.ce('p', { 856 'class' : o.notice.cls 857 }, o.notice.txt); 858 var isSetNotice = false; 859 var timer = false; 860 var debounce = 200; 861 862 function _hasScrollber () { 863 return $root.innerWidth() < $tgt.get(0).scrollWidth; 864 } 865 866 function _setNotice () { 867 if (_hasScrollber() && !isSetNotice) { 868 $root.prepend($notice); 869 isSetNotice = true; 870 } else if (isSetNotice) { 871 $notice[(_hasScrollber() ? 'remove' : 'add') + 'Class'](o.notice.isHideCls); 872 } 873 } 874 875 _setNotice(); 876 877 $win.on('resize', function () { 878 if (timer) { 879 clearTimeout(timer); 880 } 881 timer = setTimeout(function () { 882 _setNotice(); 883 timer = false; 884 }, debounce); 885 }); 886 887 }); 888 889 }; 890 891 892 /** 893 * plugin: setTgl 894 */ 895 $.fn.setTgl = function (options) { 896 897 if (!this) { 898 return false; 899 } 900 901 var o = $.extend({ 902 'switch' : '> .tgl-switch', 903 'tgt' : '> .tgl-contents', 904 'inner' : '> .tgl-in', 905 'label' : { 906 'cls' : 'tgl-state', 907 'isClose' : !isJpn ? 'Open' : '\u958b\u304f', // éã 908 'isOpen' : !isJpn ? 'Close' : '\u9589\u3058\u308b' // éãã 909 }, 910 'btnCls' : 'tgl-btn', 911 'isOpenCls' : 'is-open', 912 'onlyWinS' : false, 913 'appendBtn' : null 914 }, options); 915 916 return this.each(function () { 917 918 var $root = $(this); 919 var $switch = $root.find(o.switch); 920 var $tgt = $root.find(o.tgt); 921 var isOpen = $tgt.hasClass(o.isOpenCls); 922 var $label = $.ce('span', { 923 'class' : o.label.cls 924 }, o.label[isOpen ? 'isOpen' : 'isClose']); 925 var $btn = $.ce('span', { 926 'class' : o.btnCls 927 }); 928 var $btnWrap = $.ce('p', { 929 'class' : o.appendBtn 930 }); 931 var isSetBtn = false; 932 var isAnimate = false; 933 var tgtHeight; 934 935 function _setting () { 936 if (!isSetBtn) { 937 if (!o.appendBtn) { 938 $switch.append($label).wrapInner($btn); 939 } else { 940 $tgt.after($btnWrap.append($label).wrapInner($btn)); 941 $switch = $tgt.next(); 942 } 943 $btn = $switch.children('.' + o.btnCls); 944 isSetBtn = true; 945 } 946 $btn.attr({ 947 'role' : 'button', 948 'tabindex' : 0, 949 'aria-controls' : $tgt.attr('id'), 950 'aria-expanded' : isOpen 951 }); 952 $tgt.off('transitionend.setTgl').attr('aria-expanded', isOpen).css({ 953 'height' : isOpen ? 'auto' : '', 954 'overflow' : isOpen ? 'visible' : '' 955 }); 956 } 957 958 if (!o.onlyWinS || (o.onlyWinS && winSize === 'S')) { 959 _setting(); 960 } 961 962 $win.on('changeBP', function () { 963 if (!o.onlyWinS) { 964 return; 965 } 966 if (o.onlyWinS && winSize !== 'S') { 967 $btn.removeAttr('role tabindex aria-controls aria-expanded'); 968 $tgt.removeAttr('aria-expanded'); 969 } else { 970 isOpen = $tgt.hasClass(o.isOpenCls); 971 _setting(); 972 } 973 }); 974 975 $btn.on('click', function () { 976 if (isAnimate || (o.onlyWinS && winSize !== 'S')) { 977 return; 978 } 979 var $thisBtn = $(this); 980 var $thisSwitch = $thisBtn.parent(); 981 var $thisTgt = !o.appendBtn ? $thisSwitch.next($tgt) : $thisSwitch.prev($tgt); 982 983 isOpen = $thisTgt.hasClass(o.isOpenCls); 984
985 var $thisTgtIn = $thisTgt.attr('aria-expanded', !isOpen).find(o.inner); 986 var delay = !isOpen ? 30 : 0; 987 988 $thisBtn.attr('aria-expanded', !isOpen).children('.' + o.label.cls).text(o.label[!isOpen ? 'isOpen' : 'isClose']); 989 990 if (!isOpen) { 991 $thisTgt.addClass(o.isOpenCls); 992 } else { 993 tgtHeight = $thisTgtIn.outerHeight(); 994 $thisTgt.css('height', tgtHeight); 995 } 996 997 $win.trigger('changeVisible'); 998 999 tgtHeight = !isOpen ? $thisTgtIn.outerHeight() : ''; 1000 isAnimate = true; 1001 1002 setTimeout(function () { 1003 $thisTgt.off('transitionend.setTgl').css({ 1004 'height' : tgtHeight, 1005 'overflow' : '' 1006 }).on('transitionend.setTgl', function () { 1007 if (!isOpen) { 1008 $thisTgt.css({ 1009 'height' : 'auto', 1010 'overflow' : 'visible' 1011 }); 1012 } else { 1013 $thisTgt.removeClass(o.isOpenCls); 1014 } 1015 isAnimate = false; 1016 }); 1017 }, delay); 1018 }).on('keydown', function (e) { 1019 if (e.key === 'Enter') { 1020 $(this).trigger('click'); 1021 } 1022 }); 1023 1024 }); 1025 1026 }; 1027 1028 1029 /** 1030 * plugin: setTab 1031 */ 1032 $.fn.setTab = function (options) { 1033 1034 if (!this) { 1035 return false; 1036 } 1037 1038 var o = $.extend({ 1039 'switchWrap' : '> .tab-switch', 1040 'tgt' : '> .tab-contents', 1041 'subSwitchWrap' : '.tab-sub-switch', 1042 'controlCls' : { 1043 'isShow' : 'is-show', 1044 'current' : 'current' 1045 }, 1046 'closeTopBtnCls' : 'btn-close-01', 1047 'closeBtmBtnCls' : 'btn-close-02', 1048 'closeBtnTxt' : '\u9589\u3058\u308b', // éãã 1049 'allClose' : false, 1050 'header' : '#header' 1051 }, options); 1052 1053 return this.each(function () { 1054 1055 var $root = $(this); 1056 var $switchList = $root.find(o.switchWrap).attr('role', 'tablist').children('li').attr('role', 'presentation'); 1057 var $switch = $switchList.children('a').attr('role', 'tab'); 1058 var $initSwitch = $switchList.filter('.' + o.controlCls.current).children('a'); 1059 var $panel = $root.find(o.tgt).attr('role', 'tabpanel'); 1060 var $subSwitch = $root.find(o.subSwitchWrap).find('a').attr('role', 'button'); 1061 1062 function _changeTab ($select) { 1063 if (o.allClose && $select.is('[aria-selected="true"]')) { 1064 $switchList.removeClass(o.controlCls.current); 1065 $switch.removeAttr('aria-selected'); 1066 $panel.removeClass(o.controlCls.isShow).attr('aria-hidden', true); 1067 $win.trigger('changeVisible'); 1068 } else { 1069 $switchList.removeClass(o.controlCls.current); 1070 $switch.attr('aria-selected', false); 1071 $panel.removeClass(o.controlCls.isShow).attr('aria-hidden', true); 1072 $select.attr('aria-selected', true).parent().addClass(o.controlCls.current); 1073 $($select.attr('href')).addClass(o.controlCls.isShow).attr('aria-hidden', false); 1074 $win.trigger('changeVisible'); 1075 } 1076 } 1077 1078 $switch.each(function () { 1079 var $aSwitch = $(this); 1080 var aSwitchHref = $aSwitch.attr('href'); 1081 var tgtId = aSwitchHref.replace(/^#/, ''); 1082 var ariaLabel = 'label-' + tgtId; 1083 var $closeSwitch; 1084 1085 $aSwitch.attr({ 1086 'id' : ariaLabel, 1087 'aria-controls' : tgtId 1088 }); 1089 1090 if (o.allClose) { 1091 $closeSwitch = $.ce('button', { 1092 'type' : 'button' 1093 }, $.ce('span').text(o.closeBtnTxt)); 1094 1095 $closeSwitch.on('click', function () { 1096 $('[aria-selected="true"]').triggerHandler('click'); 1097 $switch.first().focus(); 1098 $('html, body').stop().animate({ 1099 'scrollTop' : $root.offset().top - $(o.header).innerHeight() || $win.scrollTop() 1100 }); 1101 }); 1102 1103 if (o.closeTopBtnCls) { 1104 $(aSwitchHref).prepend($closeSwitch.clone(true).addClass(o.closeTopBtnCls)); 1105 } 1106 1107 if (o.closeBtmBtnCls) { 1108 $(aSwitchHref).append($closeSwitch.clone(true).addClass(o.closeBtmBtnCls)); 1109 } 1110 } 1111 1112 $(aSwitchHref).attr('aria-labelledby', ariaLabel); 1113 }); 1114 1115 if (!o.allClose) { 1116 _changeTab($initSwitch.length ? $initSwitch : $switch.eq(0)); 1117 } 1118 1119 $switch.on('click', function (e) { 1120 var $thisSwitch = $(this); 1121 1122 e.preventDefault(); 1123 _changeTab($thisSwitch); 1124 }); 1125 1126 $subSwitch.on('click', function (e) { 1127 e.preventDefault(); 1128 var aSwitchHref = $(this).attr('href'); 1129 1130 $('[aria-controls="' + aSwitchHref.replace(/^#/, '') + '"]').triggerHandler('click'); 1131 $('.' + o.controlCls.isShow).find(focusable).first().focus(); 1132 $('html, body').stop().animate({ 1133 'scrollTop' : $('.' + o.controlCls.isShow).offset().top - $(o.header).innerHeight() || $win.scrollTop() 1134 }); 1135 }); 1136 1137 }); 1138 1139 }; 1140 1141 1142 /** 1143 * plugin: setHeight 1144 */ 1145 $.fn.setHeight = function (options) { 1146 1147 if (!this) { 1148 return false; 1149 } 1150 1151 var o = $.extend({ 1152 'wrap' : '> *', 1153 'tgt' : '.height-tgt', 1154 'pairNum' : null 1155 }, options); 1156 1157 return this.each(function () { 1158 1159 var $root = $(this); 1160 var $wrap = $root.find(o.wrap); 1161 var $tgt = $wrap.find(o.tgt); 1162 var pairs = []; 1163 var arrPair = []; 1164 var eqData = 'equalize'; 1165 var eqPrefix = 'pair'; 1166 var timer = false; 1167 var debounce = 200; 1168 var $aWrap; 1169 var $wrapTgt; 1170 var $aTgt; 1171 var pairItemLength;
1172 var pairTgtLength; 1173 var keyName; 1174 var i; 1175 var j; 1176 1177 function _setPair () { 1178 j = 1; 1179 1180 $wrap.each(function (idx) { 1181 $aWrap = $(this); 1182 $wrapTgt = $aWrap.find(o.tgt); 1183 1184 if (o.pairNum && (o.pairNum * j <= idx)) { 1185 j++; 1186 } 1187 1188 for (i = 0; i < $wrapTgt.length; i++) { 1189 $wrapTgt.eq(i).data(eqData, eqPrefix + i + (o.pairNum ? '-' + j : '')); 1190 } 1191 1192 pairItemLength = i; 1193 pairTgtLength = j; 1194 }); 1195 } 1196 1197 function _calcMaxHeight () { 1198 pairs = []; 1199 arrPair = []; 1200 1201 for (i = 0; i < $tgt.length; i++) { 1202 $aTgt = $tgt.eq(i); 1203 pairs.push($aTgt.data(eqData) + '=' + $aTgt.css('height', '').outerHeight()); 1204 } 1205 1206 for (i = 0; i < pairs.length; i++) { 1207 var pair = pairs[i].split('='); 1208 1209 if (arrPair[pair[0]] === undefined) { 1210 arrPair[pair[0]] = ''; 1211 } 1212 1213 arrPair[pair[0]] += ',' + pair[1]; 1214 } 1215 1216 for (var key in arrPair) { 1217 if (arrPair.hasOwnProperty(key)) { 1218 arrPair[key] = arrPair[key].slice(1).split(','); 1219 1220 for (i = 0; i < arrPair[key].length; i++) { 1221 arrPair[key][i] = Number(arrPair[key][i]); 1222 } 1223 1224 arrPair[key] = Math.max.apply(null, arrPair[key]); 1225 } 1226 } 1227 1228 $tgt.each(function () { 1229 $aTgt = $(this); 1230 1231 function _setPairHeight () { 1232 if ($aTgt.data(eqData) === keyName) { 1233 $aTgt.css('height', arrPair[keyName]); 1234 } 1235 } 1236 1237 for (i = 0; i <= pairItemLength; i++) { 1238 if (!o.pairNum) { 1239 keyName = eqPrefix + i; 1240 _setPairHeight(); 1241 } else { 1242 for (j = 1; j <= pairTgtLength; j++) { 1243 keyName = eqPrefix + i + '-' + j; 1244 _setPairHeight(); 1245 } 1246 } 1247 } 1248 }); 1249 } 1250 1251 _setPair(); 1252 1253 $win.on('load changeVisible', function () { 1254 _calcMaxHeight(); 1255 }).on('resize', function () { 1256 if (timer) { 1257 clearTimeout(timer); 1258 } 1259 1260 timer = setTimeout(function () { 1261 _calcMaxHeight(); 1262 timer = false; 1263 }, debounce); 1264 }); 1265 1266 }); 1267 1268 }; 1269 1270 1271 /** 1272 * plugin: setFadeImg 1273 */ 1274 // $.fn.setFadeImg = function (options) { 1275 1276 // if (!this) { 1277 // return false; 1278 // } 1279 1280 // var o = $.extend({ 1281 // 'area' : '> .mv-in', 1282 // 'tgt' : 'li', 1283 // 'txt' : '> a > .txt', 1284 // 'txtBtn' : '>.btn', 1285 // 'pager' : { 1286 // 'cls' : ['mv-pager', 'prev', 'next'], 1287 // 'label' : [!isJpn ? 'Prev' : '\u524d\u3078', !isJpn ? 'Next' : '\u6b21\u3078'] // åã¸ã»æ¬¡ã¸ 1288 // }, 1289 // 'controls' : { 1290 // 'cls' : 'mv-controls', 1291 // 'pause' : { 1292 // 'cls' : 'mv-pause', 1293 // 'label' : [!isJpn ? 'Pause' : '\u505c\u6b62', !isJpn ? 'Play' : '\u518d\u751f'] // 忢ã»åç 1294 // }, 1295 // 'indicator' : { 1296 // 'cls' : 'mv-indicator', 1297 // 'label' : !isJpn ? 'Display %%num%% image' : '%%num%%\u679a\u76ee\u306e\u753b\u50cf\u3092\u8868\u793a' // %%num%%æç®ã®ç»åã表示 1298 // } 1299 // }, 1300 // 'controlCls' : { 1301 // 'isShow' : 'is-show', 1302 // 'isAnimate' : 'is-animate', 1303 // 'isActive' : 'current' 1304 // }, 1305 // 'interval' : 6000 1306 // }, options); 1307 1308 // return this.each(function () { 1309 1310 // var $root = $(this); 1311 // var $area = $root.find(o.area); 1312 // var $tgt = $area.find(o.tgt);
1313 // var $tgtTxt = $tgt.find(o.txt); 1314 // var $prev = $.ce('li', { 1315 // 'class' : o.pager.cls[1] 1316 // }, $.ce('button', { 1317 // 'type' : 'button' 1318 // }, $.ce('span', {}, o.pager.label[0]))); 1319 // var $next = $.ce('li', { 1320 // 'class' : o.pager.cls[2] 1321 // }, $.ce('button', { 1322 // 'type' : 'button' 1323 // }, $.ce('span', {}, o.pager.label[1]))); 1324 // var $pager = $.ce('ul', { 1325 // 'class' : o.pager.cls[0] 1326 // }, [$prev, $next]); 1327 // var $controls = $.ce('div', { 1328 // 'class' : o.controls.cls 1329 // }); 1330 // var $indicator = $.ce('ul', { 1331 // 'class' : o.controls.indicator.cls 1332 // }); 1333 // var $pause = $.ce('p', { 1334 // 'class' : o.controls.pause.cls 1335 // }, $.ce('button', { 1336 // 'type' : 'button' 1337 // }, $.ce('span', {}, o.controls.pause.label[0]))); 1338 // var tgtLength = $tgt.length; 1339 // var isPause = false; 1340 // var isChanging = false; 1341 // var changeTimer = false; 1342 // var resizeTimer = false; 1343 // var delay = 30; 1344 // var debounce = 200; 1345 // var currentNum = 0; 1346 // var $indicatorList; 1347 // var $indicatorBtn; 1348 // var selectNum; 1349 // var touchStartX; 1350 // var touchEndX; 1351 // var isSP; 1352 // var i; 1353 1354 // if (tgtLength < 2) { 1355 // return; 1356 // } 1357 1358 // function _setHeight () { 1359 // var arrTgtHeight = []; 1360 // var arrImgHeight = []; 1361 1362 // $tgt.find('*').each(function () { 1363 // var $aTgtChild = $(this); 1364 // var posTop = $aTgtChild.position().top; 1365 // var posBtm = posTop + $aTgtChild.outerHeight(); 1366 1367 // arrTgtHeight.push(posBtm); 1368 1369 // if ($aTgtChild.is('img')) { 1370 // arrImgHeight.push(posBtm); 1371 // } 1372 // }); 1373 1374 // $pager.css('height', Math.max.apply(null, arrImgHeight)); 1375 // $area.css('height', Math.max.apply(null, arrTgtHeight)); 1376 // } 1377 1378 // function _setArea () { 1379 // var $aTgt; 1380 1381 // $area.append($pager, $controls.append($indicator, $pause)); 1382 // $tgt.first().addClass(o.controlCls.isShow + ' ' + o.controlCls.isAnimate); 1383 1384 // for (i = 0; i < tgtLength; i++) { 1385 // $indicator.append($.ce('li', { 1386 // 'class' : i === 0 ? o.controlCls.isActive : '' 1387 // }, $.ce('button', { 1388 // 'type' : 'button' 1389 // }, $.ce('span', {}, o.controls.indicator.label.replace(/%%num%%/g, i + 1))))); 1390 1391 // $aTgt = $tgt.eq(i); 1392 // $aTgt.children('a').attr('aria-label', $aTgt.find(o.txt).text()); 1393 // } 1394 1395 // $indicatorList = $indicator.children('li'); 1396 // $indicatorBtn = $indicatorList.children('button'); 1397 // $prev = $prev.children('button'); 1398 // $next = $next.children('button'); 1399 // $pause = $pause.children('button'); 1400 // _setHeight(); 1401 // $tgt.css('position', 'absolute'); 1402 // } 1403 1404 // function _autoPlay () { 1405 // if (isPause) { 1406 // return; 1407 // } 1408 1409 // clearInterval(changeTimer); 1410 1411 // changeTimer = setInterval(function () { 1412 // _changeImg('next'); 1413 // }, o.interval); 1414 // } 1415 1416 // function _setTxt () { 1417 // var $tgtParent = $tgt.children('a'); 1418 // var $aTgt; 1419 // var $aTgtParent; 1420 1421 // isSP = $tgtTxt.find(o.txtBtn).css('display') === 'none'; 1422 1423 // for (i = 0; i < tgtLength; i++) { 1424 // $aTgt = $tgtTxt.eq(i); 1425 // $aTgtParent = $tgtParent.eq(i); 1426 // $aTgt[isSP ? 'insertAfter' : 'appendTo']($aTgtParent); 1427 // } 1428 // } 1429 1430 // function _changeImg (direction) { 1431 // if (isChanging) { 1432 // $tgt.eq(currentNum).removeClass(o.controlCls.isShow); 1433 // } 1434 1435 // isChanging = true; 1436 1437 // $tgt.off('transitionend.setFadeImg').eq(currentNum).removeClass(o.controlCls.isAnimate).on('transitionend.setFadeImg', function () { 1438 // $(this).removeClass(o.controlCls.isShow); 1439 // isChanging = false; 1440 // }); 1441 1442 // if (direction === 'prev') { 1443 // if (currentNum < 1) { 1444 // currentNum = tgtLength - 1; 1445 // } else { 1446 // currentNum--; 1447 // } 1448 // } else if (direction === 'next') { 1449 // if (currentNum < tgtLength - 1) { 1450 // currentNum++; 1451 // } else { 1452 // currentNum = 0; 1453 // } 1454 // }
1454 else if (direction === 'indicator') { 1455 // currentNum = selectNum; 1456 // } 1457 1458 // $tgt.eq(currentNum).addClass(o.controlCls.isShow); 1459 1460 // setTimeout(function () { 1461 // $tgt.eq(currentNum).addClass(o.controlCls.isAnimate); 1462 // }, delay); 1463 1464 // $indicatorList.removeClass(o.controlCls.isActive).eq(currentNum).addClass(o.controlCls.isActive); 1465 1466 // } 1467 1468 // function _controlImg () { 1469 // $prev.on('click', function () { 1470 // _changeImg('prev'); 1471 // }); 1472 1473 // $next.on('click', function () { 1474 // _changeImg('next'); 1475 // }); 1476 1477 // $indicatorBtn.on('click', function () { 1478 // selectNum = $indicatorList.index($(this).parent('li')); 1479 // _changeImg('indicator'); 1480 // }); 1481 1482 // $pause.on('click', function () { 1483 // var $thisPause = $(this); 1484 // var $thisPauseWrap = $thisPause.parent('p'); 1485 // var $thisPauseLabel = $thisPause.children('span'); 1486 1487 // if (!isPause) { 1488 // clearInterval(changeTimer); 1489 // $thisPauseWrap.addClass(o.controlCls.isActive); 1490 // $thisPauseLabel.text(o.controls.pause.label[1]); 1491 // } else { 1492 // $thisPauseWrap.removeClass(o.controlCls.isActive); 1493 // $thisPauseLabel.text(o.controls.pause.label[0]); 1494 // } 1495 1496 // isPause = $thisPauseWrap.hasClass(o.controlCls.isActive); 1497 1498 // if (!isPause) { 1499 // _autoPlay(); 1500 // } 1501 // }); 1502 1503 // $area.on('touchstart', function (e) { 1504 // touchStartX = e.changedTouches[0].pageX; 1505 // }).on('touchend', function (e) { 1506 // touchEndX = e.changedTouches[0].pageX; 1507 1508 // if (50 < Math.abs(touchStartX - touchEndX)) { 1509 // (touchStartX < touchEndX ? $prev : $next).trigger('click'); 1510 // } 1511 // }); 1512 // } 1513 1514 // $win.on('load', function () { 1515 // _setArea(); 1516 // _autoPlay(); 1517 // _controlImg(); 1518 // _setTxt(); 1519 // }).on('resize', function () { 1520 // if (changeTimer) { 1521 // clearInterval(changeTimer); 1522 // } 1523 1524 // if (resizeTimer) { 1525 // clearTimeout(resizeTimer); 1526 // } 1527 1528 // resizeTimer = setTimeout(function () { 1529 // _setHeight(); 1530 // _setTxt(); 1531 // _autoPlay(); 1532 // resizeTimer = false; 1533 // }, debounce); 1534 // }); 1535 1536 // }); 1537 1538 // }; 1539 1540 1541 /** 1542 * plugin: setMoreBtn 1543 */ 1544 $.fn.setMoreBtn = function (options) { 1545 1546 if (!this) { 1547 return false; 1548 } 1549 1550 var o = $.extend({ 1551 'tgt' : '> .more-contents', 1552 'btn' : { 1553 'wrapCls' : 'lyt-btn-01', 1554 'btnCls' : 'btn-01 _plus', 1555 'label' : !isJpn ? 'More' : '2\u793e\u76ee\u4ee5\u524d\u3092\u5165\u529b\u3059\u308b' // 2社ç®ä»¥åãå ¥åãã 1556 }, 1557 'isShowCls' : 'is-show' 1558 }, options); 1559 1560 return this.each(function () { 1561 1562 var $root = $(this); 1563 var $tgt = $root.find(o.tgt); 1564 var $btn = $.ce('p', { 1565 'class' : o.btn.wrapCls 1566 }, $.ce('button', { 1567 'type' : 'button', 1568 'class' : o.btn.btnCls 1569 }, $.ce('span', {}, o.btn.label))); 1570 var $switch = $btn.find('button'); 1571
1572 $root.prepend($btn); 1573 1574 $switch.on('click', function () { 1575 $tgt.addClass(o.isShowCls); 1576 $btn.remove(); 1577 $root.attr('tabindex', 0).trigger('focus').removeAttr('tabindex'); 1578 }); 1579 1580 }); 1581 1582 }; 1583 1584 1585 /** 1586 * plugin: filterItem 1587 */ 1588 $.fn.filterItem = function (options) { 1589 1590 if (!this) { 1591 return false; 1592 } 1593 1594 var o = $.extend({ 1595 'tgt' : '.filter-tgt', 1596 'key' : '.filter-key', 1597 'parts' : { 1598 'wrapCls' : 'filter-parts', 1599 'select' : { 1600 'cls' : 'filter-select', 1601 'label' : !isJpn ? 'Filter' : '\u7d5e\u308a\u8fbc\u307f\u3092\u9078\u629e' // çµãè¾¼ã¿ã鏿 1602 }, 1603 'btn' : { 1604 'cls' : 'filter-btn', 1605 'label' : !isJpn ? 'Enter' : '\u9078\u629e' // 鏿 1606 } 1607 }, 1608 'isHideCls' : 'is-hide' 1609 }, options); 1610 1611 return this.each(function () { 1612 1613 var $root = $(this); 1614 var $select = $.ce('select', { 1615 'class' : o.parts.select.cls 1616 }, $.ce('option', { 1617 'value' : '' 1618 }, o.parts.select.label)); 1619 var $btnWrap = $.ce('p', { 1620 'class' : o.parts.btn.cls 1621 }, $.ce('button', { 1622 'type' : 'button' 1623 }, o.parts.btn.label)); 1624 var $btn = $btnWrap.children('button'); 1625 var $parts = $.ce('div', { 1626 'class' : o.parts.wrapCls 1627 }, [$select, $btnWrap]); 1628 var $tgt = $root.find(o.tgt); 1629 var $key = $root.find(o.key); 1630 var arrKey = []; 1631 var $aTgt; 1632 var aTxt; 1633 var itemKey; 1634 var selectKey; 1635 var i; 1636 1637 $root.prepend($parts); 1638 1639 for (i = 0; i < $key.length; i++) { 1640 aTxt = $key.eq(i).text(); 1641 1642 if (arrKey.indexOf(aTxt) === -1) { 1643 $select.append($.ce('option', { 1644 'value' : aTxt 1645 }, aTxt)); 1646 arrKey.push(aTxt); 1647 } 1648 } 1649 1650 $btn.on('click', function () { 1651 selectKey = $select.val(); 1652 $tgt.removeClass(o.isHideCls); 1653 1654 if (!selectKey) { 1655 return; 1656 } 1657 1658 $tgt.each(function () { 1659 $aTgt = $(this); 1660 itemKey = $aTgt.find(o.key).text(); 1661 1662 if (selectKey !== itemKey) { 1663 $aTgt.addClass(o.isHideCls); 1664 } 1665 }); 1666 }); 1667 1668 }); 1669 1670 }; 1671 1672 1673 /** 1674 * plugin: getFAQList 1675 */ 1676 $.fn.getFAQList = function (options) { 1677 1678 if (!this) { 1679 return false; 1680 } 1681 1682 var o = $.extend({ 1683 'wrapCls' : 'link-01 _col2 _break ta-l', 1684 'url' : { 1685 'access' : '//faq.fukoku-life.co.jp/category/show/64.json', 1686 'show' : '//faq.fukoku-life.co.jp/faq/show/' 1687 }, 1688 'param' : { 1689 'page' : 1, 1690 'sort' : 'sort_access' 1691 }, 1692 'blank' : { 1693 'path' : '/img/share/icn-blank-01.png', 1694 'alt' : '\uff08\u65b0\u3057\u3044\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u958b\u304f\uff09', // ï¼æ°ããã¦ã£ã³ãã¦ã§éãï¼ 1695 'cls' : 'icn-01' 1696 }, 1697 'max' : 6, 1698 'errorTxt' : !isJpn ? 'Failed to get data.' : '\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002' // ãã¼ã¿ã®åå¾ã«å¤±æãã¾ããã 1699 }, options); 1700 1701 return this.each(function () { 1702 1703 var $root = $(this); 1704 var $wrap = $.ce('ul', { 1705 'class' : o.wrapCls 1706 }); 1707 var $error = $.ce('p', {}, o.errorTxt); 1708 var aData; 1709 var aFaq; 1710 var i; 1711 1712 $.ajax({
1713 'url' : o.url.access, 1714 'dataType' : 'jsonp', 1715 'data' : o.param 1716 }).done(function (json) { 1717 if (!json) { 1718 $root.append($error); 1719 } else { 1720 for (i = 0; i < o.max; i++) { 1721 aData = json.faqs[i]; 1722 1723 if (!aData) { 1724 break; 1725 } 1726 1727 aFaq = aData.faq; 1728 1729 $wrap.append($.ce('li', {}, $.ce('a', { 1730 'href' : o.url.show + aFaq.id, 1731 'target' : '_blank' 1732 }, [aFaq.title, $.ce('img', { 1733 'src' : o.blank.path, 1734 'alt' : o.blank.alt, 1735 'class' : o.blank.cls 1736 })]))); 1737 } 1738 1739 $root.append($wrap); 1740 } 1741 }).fail(function () { 1742 $root.append($error); 1743 }); 1744 1745 }); 1746 1747 }; 1748 1749 /** 1750 * plugin: scrlAnimation 1751 */ 1752 $.scrlAnimation = function (options) { 1753 1754 if (!this) { 1755 return false; 1756 } 1757 1758 var o = $.extend({ 1759 'tgt' : '.js-animate-01', 1760 'isAnimateClass' : 'is-animate', 1761 'isFocusClass' : 'isFocus', 1762 'adjust' : 60, 1763 'delayElm' : { 1764 'dataName' : 'animation-delay', 1765 'parentStyle' : ['display', 'flex'] 1766 } 1767 }, options); 1768 1769 var $elm = $(o.tgt); 1770 var timer = false; 1771 1772 $win.bind('load scroll resize', function () { 1773 if (timer) { 1774 clearTimeout(timer); 1775 } 1776 timer = setTimeout(function () { 1777 var scrlPos = $win.scrollTop(); 1778 var winHeight = $win.height(); 1779 var winArea = scrlPos + winHeight; 1780 1781 $elm.each(function () { 1782 var $thisElm = $(this); 1783 var tgtPos = $thisElm.offset().top; 1784 var tgtDelay = $thisElm.parent().css(o.delayElm.parentStyle[0]) === o.delayElm.parentStyle[1] ? $thisElm.attr('data-' + o.delayElm.dataName) || 0 : 0; 1785 1786 if ($thisElm.hasClass(o.isFocusClass)) { 1787 return; 1788 } 1789 setTimeout(function () { 1790 $thisElm[(tgtPos + o.adjust < winArea ? 'add' : 'remove') + 'Class'](o.isAnimateClass); 1791 }, tgtDelay); 1792 }); 1793 timer = false; 1794 }, 10); 1795 }).bind('closeToggle.setToggle', function () { 1796 scrollTo(0, $win.scrollTop() + 1); 1797 }); 1798 1799 $elm.find(focusable).bind('focus', function () { 1800 $(this).parents(o.tgt).addClass(o.isAnimateClass + ' ' + o.isFocusClass); 1801 }).bind('blur', function () { 1802 $(this).parents(o.tgt).removeClass(o.isFocusClass); 1803 }); 1804 }; 1805 1806 /** 1807 * plugin: notice include 1808 */ 1809 $.fn.setNoteInclude = function (options) { 1810 1811 if (!this) { 1812 return false; 1813 } 1814 1815 var o = $.extend({ 1816 'filePath' : '/advanced/note.html', 1817 'txtErr' : '\u30c6\u30ad\u30b9\u30c8\u306e\u8aad\u307f\u8fbc\u307f\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002' // ããã¹ãã®èªã¿è¾¼ã¿ã«å¤±æãã¾ããã 1818 }, options); 1819 1820 return this.each(function () { 1821 var $root = $(this); 1822 1823 $.ajax({
1824 'url' : o.filePath, 1825 'type' : 'GET', 1826 'cache' : false 1827 }).then(function (data) { 1828 $root.html(data); 1829 }, function () { 1830 $root.html($.ce('p').text(o.txtErr)); 1831 }); 1832 }); 1833 }; 1834 1835 /** 1836 * plugin: font size switcher 1837 */ 1838 $.fn.setFontSizeSwitcher = function (options) { 1839 if (!this.length) { 1840 return false; 1841 } 1842 1843 const o = $.extend({ 1844 'add' : 'body:not([lang="en"]) #header .utility > .switcher', 1845 'wrap' : { 1846 'cls' : 'font-size-switcher', 1847 'ttl' : '\u6587\u5b57\u30b5\u30a4\u30ba' // æåãµã¤ãº 1848 }, 1849 'btn' : [ 1850 {'size' : 'font-r', 'txt' : '\u6a19\u6e96'}, // æ¨æº 1851 {'size' : 'font-l', 'txt' : '\u5927'}, // 大 1852 {'size' : 'font-m', 'txt' : '\u6700\u5927'} // æå¤§ 1853 ], 1854 'default' : 'font-r', 1855 'data' : 'data-size', 1856 'cookie' : { 1857 'name' : 'site-font-size', 1858 'expires' : 30 // 30æ¥ 1859 }, 1860 'unique' : { 1861 'add' : 'body:not([lang="en"]) #header .utility .switcher', 1862 // 'elm' : '<li class="switcher"></li>' 1863 } 1864 }, options); 1865 1866 /*! 1867 * Javascript Cookie v1.5.1 1868 * https://github.com/js-cookie/js-cookie 1869 * 1870 * Copyright 2006, 2014 Klaus Hartl 1871 * Released under the MIT license 1872 */ 1873 (function(a){var f;if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){try{f=require("jquery")}catch(d){}module.exports=a(f)}else{var c=window.Cookies;var b=window.Cookies=a(window.jQuery);b.noConflict=function(){window.Cookies=c;return b}}}}(function(g){var e=/\+/g;function i(k){return h.raw?k:encodeURIComponent(k)}function a(k){return h.raw?k:decodeURIComponent(k)}function f(k){return i(h.json?JSON.stringify(k):String(k))}function c(k){if(k.indexOf('"')===0){k=k.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{k=decodeURIComponent(k.replace(e," "));return h.json?JSON.parse(k):k}catch(l){}}function b(l,k){var m=h.raw?l:c(l);return d(k)?k(m):m}function j(){var n,l;var m=0;var k={};for(;m<arguments.length;m++){l=arguments[m];for(n in l){k[n]=l[n]}}return k}function d(k){return Object.prototype.toString.call(k)==="[object Function]"}var h=function(r,q,w){if(arguments.length>1&&!d(q)){w=j(h.defaults,w);if(typeof w.expires==="number"){var s=w.expires,v=w.expires=new Date();v.setMilliseconds(v.getMilliseconds()+s*86400000)}return(document.cookie=[i(r),"=",f(q),w.expires?"; expires="+w.expires.toUTCString():"",w.path?"; path="+w.path:"",w.domain?"; domain="+w.domain:"",w.secure?"; secure":""].join(""))}var x=r?undefined:{},u=document.cookie?document.cookie.split("; "):[],p=0,n=u.length;for(;p<n;p++){var o=u[p].split("="),k=a(o.shift()),m=o.join("=");if(r===k){x=b(m,q);break}if(!r&&(m=b(m))!==undefined){x[k]=m}}return x};h.get=h.set=h;h.defaults={};h.remove=function(l,k){h(l,"",j(k,{expires:-1}));return !h(l)};if(g){g.cookie=h;g.removeCookie=h.remove}return h})); 1874 1875 return this.each(function () { 1876 if (o.unique) { 1877 $(o.unique.add).append($(o.unique.elm)); 1878 } 1879 1880 const $target = $(this); 1881 const $root = (function () { 1882 $target.find(o.add).append($('<dl class="' + o.wrap.cls + '"><dt>' + o.wrap.ttl + '</dt></dl>')); 1883 1884 return $target.find(o.add).children('.' + o.wrap.cls); 1885 }()); 1886 1887 if (!$root.length) { 1888 return false; 1889 } 1890 1891 const $btn = (function () { 1892 for (let i = 0; i < o.btn.length; i++) { 1893 $root.append($('<dd><button type="button" ' + o.data + '="' + o.btn[i].size + '">' + o.btn[i].txt + '</button></dd>')); 1894 } 1895 1896 return $root.find('button'); 1897 }()); 1898 const cookie = $.cookie(o.cookie.name); 1899 const checkCookie = function () { 1900 !cookie ? $target.attr(o.data, o.default) : $target.attr(o.data, cookie); 1901 }; 1902 1903 if (winSize !== 'S') { 1904 checkCookie(); 1905 } 1906 1907 $btn.on('click', function () { 1908 const size = $(this).attr(o.data); 1909
1910 $.cookie(o.cookie.name, size, {'expires' : o.cookie.expires, 'path' : '/'}); 1911 location.reload(false); 1912 }); 1913 1914 $win.on('changeBP', function () { 1915 if (winSize === 'S') { 1916 $target.removeAttr(o.data); 1917 } else if (winSize === 'M' || winSize === 'L') { 1918 checkCookie(); 1919 } 1920 }); 1921 }); 1922 }; 1923 1924 /** 1925 * execution: DOMContentLoaded 1926 */ 1927 $(function () { 1928 1929 $.eventChangeBP(); 1930 $.setLinkInfo(); 1931 $('[data-tel-num]').setTelLink(); 1932 $('.js-scrl-01').find('a').smoothScroll(); 1933 $('.feature-btn-01 a').smoothScroll(); 1934 $('.js-check-num-01').checkNumAlert(); 1935 $('.js-notice-scrl-01').noticeScrl(); 1936 $('.js-tgl-01').setTgl(); 1937 $('.js-tgl-02').setTgl({ 1938 'onlyWinS' : true 1939 }); 1940 $('.js-top-tgl-01').setTgl({ 1941 'label' : { 1942 'cls' : 'tgl-state', 1943 'isClose' : !isJpn ? 'Open' : '\u958b\u304f', // éã 1944 'isOpen' : !isJpn ? 'Close' : '\u9589\u3058\u308b' // éãã 1945 }, 1946 'onlyWinS' : true, 1947 'appendBtn' : 'top-tgl-switch' 1948 }); 1949 $('.js-tab-01').setTab(); 1950 $('.js-tab-02').setTab({ 1951 'allClose' : true 1952 }); 1953 // $('.js-mv-01').setFadeImg(); 1954 $('.js-height-01').setHeight(); 1955 $('.js-height-02._col2').setHeight({ 1956 'pairNum' : 2 1957 }); 1958 $('.js-height-02._col3').setHeight({ 1959 'pairNum' : 3 1960 }); 1961 $('.js-more-01').setMoreBtn(); 1962 $('.js-filter-01').filterItem(); 1963 $('.js-faq-api-01').getFAQList(); 1964 $.scrlAnimation(); 1965 $('.js-note-01').setNoteInclude(); 1966 $('.js-note-02').setNoteInclude({ 1967 'filePath' : '/advanced/note_02.html' 1968 }); 1969 }); 1970 1971 /** 1972 * Load Template 1973 */ 1974 function loadTemplate(jqueryObj) { 1975 $.ajax({
1976 type: 'get', 1977 url: jqueryObj.data('parts'), 1978 dataType: 'html', 1979 success: function(data) { 1980 jqueryObj.append(data); 1981 } 1982 }); 1983 } 1984 1985 /** 1986 * Search 1987 */ 1988 $(window).on('load', function() { 1989 $.controlNav(); 1990 $.currentNav(); 1991 $.tglSubNav(); 1992 $('html').setFontSizeSwitcher(); 1993 $('#srchBox').appendTo('#header .utility .search') 1994 }) 1995 1996}(jQuery));
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.