PageSourceSearch

https://www.kddi.com/extlib/common/scripts/layout.js

js kddi.com collected 2026-09-24 07:04:35 UTC 51,985 bytes, 1,387 lines download raw bytes

1/*################################################
2###### UTIL
3################################################*/
4class layoutUtil {
5  /**
6   * @constructor
7   */
8  constructor() {
9    this.baseDir = ''; // 各言語の第一階層ディレクトリを入れる
10    this.$win = jQuery(window);
11    this.$doc = jQuery(document);
12    this.$body = jQuery('body');
13    this.ua = navigator.userAgent.toLowerCase();
14    this.ver = window.navigator.appVersion.toLowerCase();
15    this.url = location.href;
16    this.path = location.pathname.replace('index.html', '');
17    this.dir = this.path.split('/');
18    this.firstDir = this.baseDir !== '' ? this.path.replace(new RegExp(`^/${this.baseDir}`, 'g'), '').split('/')[1] : this.path.split('/')[1];
19    this.hash = location.hash;
20    this.query = location.search;
21    this.view = 1372;
22    this.breakPoint1 = 767;
23    this.state = {
24      current: 'is-current',
25      open: 'is-open',
26      active: 'is-active',
27      fixed: 'is-fixed',
28      disabled: 'is-disabled',
29      selected: 'is-selected',
30      show: 'is-show',
31      headerFixed: 'is-header-fixed',
32      activeMenu: 'is-active-menu',
33    };
34  }
35
36  /**
37   * @method isRangeSP
38   * @return {Boolean}
39   */
40  isRangeSP() {
41    const clientW = document.documentElement.clientWidth;
42    const winW = window.innerWidth ? window.innerWidth : (this.$win.width() ? this.$win.width() : clientW);
43    return (winW <= this.breakPoint1);
44  }
45
46  /**
47   * @method isRangePC
48   * @return {Boolean}
49   */
50  isRangePC() {
51    const clientW = document.documentElement.clientWidth;
52    const winW = window.innerWidth ? window.innerWidth : (this.$win.width() ? this.$win.width() : clientW);
53    return (this.breakPoint1 < winW);
54  }
55
56  /**
57   * @method deviceChecker
58   * @return {String}
59   */
60  deviceChecker() {
61    if (this.ua.indexOf('iphone') !== -1) { return 'iphone'; }
62    if (this.ua.indexOf('ipod') !== -1) { return 'ipod'; }
63    if (this.ua.indexOf('ipad') !== -1) { return 'ipad'; }
64    if (this.ua.indexOf('android') !== -1 && this.ua.indexOf('mobile') !== -1) { return 'android mobile'; }
65    if (this.ua.indexOf('android') !== -1 && this.ua.indexOf('mobile') === -1) { return 'android tablet'; }
66    if (this.ua.indexOf('windows phone') !== -1) { return 'windows phone'; }
67    return 'desktop';
68  }
69
70  /**
71   * @method isMobile
72   * @return {Boolean}
73   */
74  isMobile() {
75    return !!((this.deviceChecker() === 'iphone' || this.deviceChecker() === 'ipod' || this.deviceChecker() === 'android mobile' || this.deviceChecker() === 'windows phone'));
76  }
77
78  /**
79   * @method isTablet
80   * @return {Boolean}
81   */
82  isTablet() {
83    return !!((this.deviceChecker() === 'ipad' || this.deviceChecker() === 'android tablet'));
84  }
85
86  /**
87   * @method isDesktop
88   * @return {Boolean}
89   */
90  isDesktop() {
91    return !!((!this.isMobile() && !this.isTablet()));
92  }
93
94  /**
95   * @method isBrowser
96   * @param {String}
97   * @return {Boolean}
98   */
99  isBrowser(_browser) {
100    const browser = ['chrome', 'safari', 'firefox', 'edge', 'ie11'];
101    const browser_old = ['ie8', 'ie9', 'ie10'];
102    switch (_browser) {
103      case browser[0]: return !!((this.ua.indexOf('chrome') !== -1 && this.ua.indexOf('edge') === -1 && this.ua.indexOf('edg') === -1));
104      case browser[1]: return !!((this.ua.indexOf('safari') !== -1 && this.ua.indexOf('chrome') === -1 && this.ua.indexOf('edg') === -1));
105      case browser[2]: return (this.ua.indexOf('firefox') !== -1);
106      case browser[3]: return (this.ua.indexOf('edge') !== -1 || this.ua.indexOf('edg') !== -1);
107      case browser[4]: return !!(((this.ua.indexOf('rv 11') !== -1 || this.ua.indexOf('rv:11') !== -1) && (this.ua.indexOf('trident') !== -1)));
108      case browser_old[0]: return (this.ver.indexOf('msie 8') !== -1);
109      case browser_old[1]: return (this.ver.indexOf('msie 9') !== -1);
110      case browser_old[2]: return (this.ver.indexOf('msie 10') !== -1);
111      default: return false;
112    }
113  }
114
115  /**
116   * @method isExternal
117   * @param {String}
118   * @return {Boolean}
119   */
120  isExternal(_link) {
121    const patterns = ["www\.kddi\.com", "news\.kddi\.com"];
122    return !patterns.some(pattern => new RegExp(pattern).test(_link));
123  }
124
125  /**
126   * @method isPdf
127   * @param {String}
128   * @return {Boolean}
129   */
130  isPdf(_filename) {
131    if (!_filename) return false;
132    const ext = _filename.split('.').pop();
133    return ext === 'pdf';
134  }
135
136  /**
137   * @method isFontSizeWatch
138   * @param {function}
139   * @return {Boolean}
140   */
141  isFontSizeWatch(callback) {
142    const $body = jQuery('body');
143    const watchName = 'js-font-size-watch';
144    let currentH = 0;
145    const interval = 500;
146    const HTML_FS_WATCH = jQuery(`<div class="${watchName}">&nbsp;</div>`);
147    const CSS_FS_WATCH = {
148      position: 'absolute', top: '0', display: 'block', padding: '0', visibility: 'hidden',
149    };
150    // 監視用HTMLを生成する
151    if (!jQuery(`.${watchName}`).length) {
152      HTML_FS_WATCH.css(CSS_FS_WATCH).appendTo($body);
153    }
154    const $elm = jQuery(`.${watchName}`);
155    // 要素の高さを取得
156    const getHeight = function ($elm) { return $elm.height(); };
157    // 要素の高さを比較して、異なればcallbackを実行
158    const watching = function () {
159      const h = getHeight($elm);
160      if (h === currentH) {
161        return false;
162      }
163      currentH = h;
164      callback();
165    };
166    setInterval(watching, interval);
167  }
168
169  /**
170   * @method isWindowSizeWatch
171   * @param {function}
172   * @return {Boolean}
173   */
174  isWindowSizeWatch(callback) {
175    let resize = false;
176    const interval = 500;
177    this.$win.on('resize', () => {
178      // リサイズされている間は何もしない
179      if (resize !== false) { clearTimeout(resize); }
180      resize = setTimeout(() => {
181        callback();
182      }, interval);
183    });
184  }
185
186  /**
187   * @method formatDate
188   * @param {String}
189   * @return {String}
190   */
191  formatDate(_data,_format) {
192    const date = new Date(_data);
193    const year = date.getFullYear();
194    const month = String(date.getMonth() + 1).padStart(2, '0');
195    const day = String(date.getDate()).padStart(2, '0');
196    switch (_format) {
197      case 'YYYY.MM.DD':
198        return `${year}.${month}.${day}`;
199      case 'YYYY-MM-DD':
200        return `${year}-${month}-${day}`;
201      default:
202        return `${year}.${month}.${day}`; // デフォルトのフォーマット
203    }
204  }
205}
206
207
208
209/*################################################
210###### HEADER
211################################################*/
212jQuery('document').ready(function () {
213  if (!jQuery('.Header').hasClass('is-renewal')) {
214    /*!*********************************************!*
215    !*** 旧体裁 ***!
216    \*********************************************/
217    var d = location.pathname.split("/")[1];
218    var d2 = location.pathname.split("/")[2];
219    var d3 = location.pathname.split("/")[3];
220    var d4 = location.pathname.split("/")[4];
221    if (d == 'corporate' || d == 'english' && d2 == 'corporate') {
222      if (d2 == 'sustainability' || d == 'english' && d3 == 'sustainability') {
223        jQuery('.grobalNav > nav > ul > li#CSR > a').addClass('active');
224      } else if (d2 == 'ir' || d == 'english' && d3 == 'ir') {
225        jQuery('.grobalNav > nav > ul > li#IR > a').addClass('active');
226      } else if (d2 == 'recruit' || d == 'english' && d3 == 'recruit') {
227        jQuery('.grobalNav > nav > ul > li#RECRUIT > a').addClass('active');
228      } else if (d == 'english' && d3 == 'r-and-d') {
229        jQuery('.grobalNav > nav > ul > li#RD > a').addClass('active');
230      } else {
231        jQuery('.grobalNav > nav > ul > li#CORP > a').addClass('active');
232      }
233    } else if (d == 'open-innovation-program' || d == 'english' && d2 == 'open-innovation-program') {
234      jQuery('.grobalNav > nav > ul > li#CORP > a').addClass('active');
235    } else if (d == 'brand') {
236      jQuery('.grobalNav > nav > ul > li#BRAND > a').addClass('active');
237    } else if (d == 'cable' || d == 'phone' || d == 'au-energy' || d == 'personal' || d == 'english' && d2 == 'phone') {
238      jQuery('.grobalNav > nav > ul > li#CONSUMER > a').addClass('active');
239    } else if (d == 'vision' || d == 'english' && d2 == 'vision') {
240      jQuery('.grobalNav > nav > ul > li#VISON > a').addClass('active');
241    } else if (d == 'anti-disaster') {
242      jQuery('.grobalNav > nav > ul > li#DIZASTER > a').addClass('active');
243    } else if (d == 'technology') {
244        jQuery('.grobalNav > nav > ul > li#RD > a').addClass('active');
245    }
246
247
248    let searchGroup;
249    switch (d) {
250      case 'business':
251        searchGroup = 14;
252        break;
253      case 'corporate':
254      case 'open-innovation-program':
255        searchGroup = 15;
256        break;
257      case 'press':
258        searchGroup = 17;
259        break;
260      case 'english':
261        searchGroup = 16;
262        break;
263      default:
264        searchGroup = 13;
265    }
266    jQuery('#SS_design1').val(searchGroup);
267    jQuery('#SS_group1').val(searchGroup);
268
269    var scrollTopP;
270    var anmMove = 0;
271    // Global NAV
272    jQuery('.grobalNav > nav > ul > li > a').not('li#NEWS > a , li#DIZASTER > a , li#RECRUIT > a , li#RD > a').on('click', function () {
273      if (anmMove == 0) {
274        anmMove = 1;
275        jQuery('.grobalNav > nav > ul > li > a').not(jQuery(this)).removeClass('is_slc');
276        jQuery(this).toggleClass('is_slc');
277        jQuery('.searchBtn').removeClass('is_open');
278        if (jQuery('#fixedNav_sp').css('display') == 'none') { // for PC
279          jQuery('.grobalNav > nav > ul > li > a').not(jQuery(this)).next().slideUp(500);
280          if (jQuery(this).next().is(":hidden")) {
281            jQuery('#nav_bg').fadeIn();
282          } else {
283            jQuery('#nav_bg').fadeOut();
284          }
285          jQuery(this).next().delay(500).slideToggle(500, function () {
286            anmMove = 0
287          });
288          jQuery('.headerSearch').slideUp(500);
289        } else { // for SP
290          jQuery('.grobalNav > nav > ul > li > a').not(jQuery(this)).next().slideUp(500);
291          /*if(jQuery(this).next().is(":hidden")){
292                  jQuery('#nav_bg').fadeIn();
293              }else{
294                  jQuery('#nav_bg').fadeOut();
295          }*/
296          jQuery(this).next().slideToggle(500, function () {
297            anmMove = 0
298          });
299          //jQuery('.headerSearch').slideUp();
300        }
301      } else {
302        //return false;
303      }
304    });
305
306
307    // Search Box
308    jQuery('.searchBtn').on('click', function () {
309      if (anmMove == 0) {
310        anmMove = 1;
311        if (jQuery('#fixedNav_sp').css('display') == 'none') { // for PC
312          if (jQuery('.headerSearch').is(":hidden")) {
313            jQuery('#nav_bg').fadeIn();
314          } else {
315            jQuery('#nav_bg').fadeOut();
316          }
317          jQuery('.headerSearch').slideToggle(500, function () {
318            anmMove = 0
319          });
320        } else { // for SP
321          /*if(jQuery('.headerSearch').is(":hidden")){
322                      jQuery('#nav_bg').fadeIn();
323                      scrollTopP = jQuery(window).scrollTop();
324                      noScroll();
325              }else{
326                      jQuery('#nav_bg').fadeOut();
327                      scroll();
328              window.scrollTo(0,scrollTopP);
329          }
330          jQuery('.headerSearch').slideToggle(500,function(){anmMove = 0});*/
331        }
332        jQuery('#navWrap').slideUp();
333        jQuery('.grobalNav > nav > ul > li > a').next().slideUp();
334        jQuery('.searchBtn').toggleClass('is_open');
335        jQuery('.headerBtnNav_1_sp a').removeClass('is_open');
336        jQuery('.grobalNav > nav > ul > li > a').removeClass('is_slc');
337        jQuery('#opnOpNav').show();
338      } else {
339        //return false;
340      }
341    });
342
343    // SP Fixed MENU
344
345    jQuery('.headerBtnNav_1_sp a').on('click', function () {
346      if (anmMove == 0) {
347        anmMove = 1;
348        if (jQuery('#navWrap').is(":hidden")) {
349          jQuery('#nav_bg').fadeIn();
350          //window.scrollBy(0,10);
351          scrollTopP = jQuery(window).scrollTop();
352          noScroll();
353          //jQuery('#opnOpNav').hide();
354        } else {
355          jQuery('#nav_bg').fadeOut();
356          scroll();
357          window.scrollTo(0, scrollTopP);
358          jQuery('.grobalNav > nav > ul > li > a').next().slideUp();
359          jQuery('.grobalNav > nav > ul > li > a').removeClass('is_slc');
360          //jQuery('#opnOpNav').show();
361        }
362        jQuery('#navWrap').slideToggle(500, function () {
363          anmMove = 0
364        });
365        //jQuery('.headerSearch').slideUp();
366        jQuery(this).toggleClass('is_open');
367        jQuery('.searchBtn').removeClass('is_open');
368      } else {
369        //return false;
370      }
371    });
372
373    // Close Actinon
374    jQuery('.slideCloseBtn,#nav_bg').on('click', function () {
375      if (anmMove == 0) {
376        anmMove = 1;
377        if (jQuery('#fixedNav_sp').css('display') == 'none') {
378          jQuery('.headerSearch').slideUp();
379        }
380        jQuery('#nav_bg').fadeOut();
381        jQuery('.grobalNav > nav > ul > li > a').next().slideUp();
382        scroll();
383        jQuery('.grobalNav > nav > ul > li > a').removeClass('is_slc');
384        jQuery('.searchBtn').removeClass('is_open');
385        jQuery('.headerBtnNav_1_sp a').removeClass('is_open');
386        jQuery('#navWrap').slideUp(500, function () {
387          anmMove = 0
388        });
389        if (jQuery('#fixedNav_sp').css('display') != 'none') {
390          //jQuery("html, body").animate({scrollTop:scrollTopP}, 0);
391          window.scrollTo(0, scrollTopP);
392        }
393        jQuery('#opnOpNav').show();
394      }
395    });
396
397    // Resize Window JUDGE
398    jQuery(window).resize(function () {
399      if (jQuery('#fixedNav_sp').css('display') == 'none') { // for PC
400      jQuery('.headerSearch').css('display', 'none');
401        jQuery('#nav_bg').fadeOut();
402        jQuery('header .headerUtility .searchBtn').removeClass('is_open');
403        jQuery('.headerBtnNav_1_sp a').removeClass('is_open');
404        jQuery('.grobalNav > nav > ul > li > a').next().slideUp();
405        jQuery('.grobalNav > nav > ul > li > a').removeClass('is_slc');
406      } else { // for SP
407        jQuery('.headerSearch').css('display', 'block');
408      }
409    });
410
411    function noScroll() {
412      jQuery('body').addClass('is-no-scroll');
413      jQuery(window).on('touchmove.noScroll', function (e) {
414        e.preventDefault();
415      });
416      window.scrollTo(0, scrollTopP);
417    }
418
419    function scroll() {
420      jQuery('body').removeClass('is-no-scroll');
421      jQuery(window).off('.noScroll');
422    }
423
424    jQuery(window).scroll(function () {
425      var scroll = jQuery(this).scrollTop();
426      if (scroll > 86) {
427        jQuery('#nav_bg').addClass('ov');
428      } else {
429        jQuery('#nav_bg').removeClass('ov');
430      }
431    });
432  } else {
433    /*!*********************************************!*
434    !*** 新体裁 ***!
435    \*********************************************/
436    const u = new layoutUtil();
437    /**
438     * @method headerControl
439     */
440    function headerControl(config) {
441      /**
442       * options
443       */
444      const c = jQuery.extend({
445        factorElement: '.js-header',
446        gnavElement: '.js-header-gnav',
447        gnavListElement: '.js-header-gnav__list',
448        gnavTriggerElement: '.js-header-gnav__trigger',
449        gnavMegamenuElement: '.js-header-gnav__megamenu',
450        gnavMegamenuHeadingElement: '.js-header-gnav__megamenu__heading',
451        searchElement: '.js-header-search',
452        searchTriggerElement: '.js-header-search__trigger',
453        searchMegamenuElement: '.js-header-search__megamenu',
454        searchCloseElement: '.js-header-search__close',
455        menuElement: '.js-header-menu',
456        menuTriggerElement: '.js-header-menu__trigger',
457        menuMegamenuElement: '.js-header-menu__megamenu',
458        menuMegamenuContentsElement: '.js-header-menu__megamenu__contents',
459        menuCloseElement: '.js-header-menu__close',
460        menuBodyElement: '.js-header-menu__body',
461        menuFootElement: '.js-header-menu__foot',
462        cloneBodyElement: '.js-header-clone__body',
463        cloneFootElement: '.js-header-clone__foot',
464        navWrapElement: '.js-header-nav-wrap',
465        navWrapHeadElement: '.js-header-nav-wrap__head',
466        navWrapBodyElement: '.js-header-nav-wrap__body',
467      }, config);
468
469      const $header = jQuery(c.factorElement);
470      if ($header.length === 0) { return false; }
471
472      /**
473       * initialization
474       */
475      /* PC時のグロナビ等をSP時のメニュー内にコピー */
476      (function headerClone() {
477        // SP時メニュー用のエリアに要素をクローン
478        jQuery(c.cloneBodyElement).clone().appendTo(jQuery(c.menuBodyElement));
479        jQuery(c.cloneFootElement).clone().appendTo(jQuery(c.menuFootElement));
480
481        // SP時メニュー用のエリア内にクローンした要素のidを変更;
482        const $id = jQuery(`${c.menuBodyElement}, ${c.menuFootElement}`).find('[id]');
483        const $ariaControls = jQuery(`${c.menuBodyElement}, ${c.menuFootElement}`).find('[aria-controls]');
484        const cloneIdName = '--sp';// クローンした要素の末尾に追加する名前を定義
485        $id.each(function () {
486          const id = jQuery(this).attr('id');
487          jQuery(this).attr('id', `${id}${cloneIdName}`);
488        });
489        $ariaControls.each(function () {
490          const ariaControls = jQuery(this).attr('aria-controls');
491          const href = jQuery(this).attr('href');
492          jQuery(this).attr('aria-controls', `${ariaControls}${cloneIdName}`);
493          if (href) {
494            if (href.split('#')[1] === ariaControls) {
495              jQuery(this).attr('href', `${href}${cloneIdName}`);
496            }
497          }
498        });
499
500        // クローンした要素内のc.gnavMegamenuHeadingElementをボタンに変更
501        jQuery(c.menuBodyElement).find(c.gnavMegamenuHeadingElement).each(function() {
502          const $this = jQuery(this);
503          const $buttonElement = jQuery('<button>');
504          // 元のdivの属性をコピー
505          jQuery.each($this[0].attributes, function(index, attr) {
506            $buttonElement.attr(attr.name, attr.value);
507          });
508          $buttonElement.attr({
509            type: 'button',
510            'aria-label': '戻る'
511          })
512          // 元のdivの子要素をコピー
513          $buttonElement.append($this.contents());
514          // 元のdivをbuttonに置き換え
515          $this.replaceWith($buttonElement);
516        });
517      })();
518
519      /* サイト内検索の検索対象の切り替え */
520      (function searchGroupControl() {
521        let searchGroup;
522        switch (u.dir[1]) {
523          case 'business':
524            searchGroup = 14;
525            break;
526          case 'corporate':
527          case 'open-innovation-program':
528            searchGroup = 15;
529            break;
530          case 'press':
531            searchGroup = 17;
532            break;
533          case 'english':
534            searchGroup = 16;
535            break;
536          default:
537            searchGroup = 13;
538        }
539        jQuery('#SS_design1').val(searchGroup);
540        jQuery('#SS_group1').val(searchGroup);
541      })();
542
543      /**
544       * vars
545       */
546      const $gnavList = jQuery(c.gnavListElement);
547      const $gnavTrigger = jQuery(c.gnavTriggerElement);
548      const $gnavMegamenu = jQuery(c.gnavMegamenuElement);
549      const $gnavMegamenuHeading = jQuery(c.gnavMegamenuHeadingElement);
550      const $gnavWrap = $gnavTrigger.parent('li');
551      const $search = jQuery(c.searchElement);
552      const $searchTrigger = jQuery(c.searchTriggerElement);
553      const $searchMegamenu = jQuery(c.searchMegamenuElement);
554      const $searchClose = jQuery(c.searchCloseElement);
555      const $menu = jQuery(c.menuElement);
556      const $menuTrigger = jQuery(c.menuTriggerElement);
557      const $menuMegamenu = jQuery(c.menuMegamenuElement);
558      const $menuMegamenuContents = jQuery(c.menuMegamenuContentsElement);
559      const $menuClose = jQuery(c.menuCloseElement);
560      const $navWrap = jQuery(c.navWrapElement);
561      const root = document.documentElement;
562      const headerHeight = getComputedStyle(root).getPropertyValue('--header-height');
563      const headerHeightNum = Number(headerHeight.replace('px', ''));
564      const headerMegamenuHeight = getComputedStyle(root).getPropertyValue('--header-megamenu-height');
565      let activeMegamenuHeight = 0;
566      let defaultMegamenuContentsHeight = $menuMegamenuContents.outerHeight();
567      let activeMegamenuContentsHeight = 0;
568      let setPos = 0;
569      const activeName = u.state.active;
570      const activeMenuName = u.state.activeMenu
571      const currentName = u.state.current
572      const noHideHeaderName = 'is-no-hide-header';
573      let breakFlg = u.isRangeSP();
574
575      /**
576       * functions
577       */
578      /* aria属性制御 */
579      function ariaControl(_trigger, _boolean, _callback) {
580        const expandedAttr = 'aria-expanded';
581        const targetHiddensAttr = 'aria-hidden';
582        const targetControlsAttr = 'aria-controls';
583        const targetId = _trigger.attr(targetControlsAttr);
584        const $target = jQuery(`#${targetId}`);
585        if (_callback) {
586          _callback();
587        }
588        if (_boolean) {
589          _trigger.attr(expandedAttr, 'true');
590          $target.attr(targetHiddensAttr, 'false');
591          $target.removeAttr('inert');
592        } else {
593          _trigger.attr(expandedAttr, 'false');
594          $target.attr(targetHiddensAttr, 'true');
595          $target.attr('inert', '');
596        }
597      }
598
599      /* ヘッダー表示項目の並び順変更 */
600      function reorderElements() {
601        const $item1 = $navWrap.find(c.navWrapHeadElement);
602        const $item2 = $navWrap.find(c.navWrapBodyElement);
603        if (u.isRangeSP()) {
604          // SP時:Item 2 → Item 1
605          if ($navWrap.children().first() !== $item2) {
606            $item2.insertBefore($item1); // DOMを移動
607          }
608        } else {
609          // PC時:Item 1 → Item 2
610          if ($navWrap.children().first() !== $item1) {
611            $item1.insertBefore($item2); // DOMを移動
612          }
613        }
614      }
615
616      /* 追従表示処理 */
617      function headerFixed() {
618        let lastScrollTop = 0;
619
620        const initFixed = function() {
621          const scrollTop = jQuery(this).scrollTop();
622          if (scrollTop > 0) {
623            // スクロールダウン時
624            $header.css('top', `-${headerHeight}`);
625          } else {
626            // スクロールアップ時
627            $header.css('top', '0');
628          }
629          setTimeout(function(){
630            $header.addClass(u.state.fixed);
631          },50);
632        }
633
634        const scrollFixed = function(){
635          if(!u.$body.hasClass(noHideHeaderName)) {
636            const scrollTop = jQuery(this).scrollTop();
637            if (scrollTop > 0 && scrollTop >= lastScrollTop) {
638              // スクロールダウン時
639              $header.css('top', `-${headerHeight}`);
640
641              //PC時、メガメニューが開かれていたら閉じる
642              if(u.isRangePC()) {
643                $gnavWrap.removeClass(activeName);
644                $gnavTrigger.each(function () {
645                  ariaControl(jQuery(this), false, () => {
646                    root.style.setProperty('--header-megamenu-height', headerMegamenuHeight);
647                  });
648                });
649              }
650            } else {
651              // スクロールアップ時
652              $header.css('top', '0');
653            }
654            lastScrollTop = scrollTop;
655          } else {
656            u.$body.removeClass(noHideHeaderName);
657          }
658        }
659        initFixed();
660        u.$win.on('scroll', function() {
661          scrollFixed();
662        });
663      }
664
665
666      /**
667      * 現在のページに対応するナビゲーションにcurrentNameを付与
668      */
669      function currentControl() {
670        const path = location.pathname;
671        let maxMatchLength = 0;
672        let $currentNav = null;
673
674        $gnavList.each(function () {
675          const $this = jQuery(this);
676          const gnavCurrent = $this.data('gnav-current');
677          if (gnavCurrent) {
678            const paths = gnavCurrent.split(',');
679            paths.forEach(p => {
680              const fullPath = `/${p}`;
681              const pathSegments = path.split('/');
682              const fullPathSegments = fullPath.split('/');
683              let isMatch = true;
684
685              for (let i = 0; i < fullPathSegments.length; i++) {
686                if (fullPathSegments[i] !== pathSegments[i]) {
687                  isMatch = false;
688                  break;
689                }
690              }
691
692              if (isMatch && fullPathSegments.length > maxMatchLength) {
693                maxMatchLength = fullPathSegments.length;
694                $currentNav = $this;
695              }
696            });
697          }
698        });
699
700        if ($currentNav) {
701          $currentNav.addClass(currentName);
702        }
703      }
704
705      /**
706       * グローバルナビ制御
707       */
708      function gnavControl() {
709        // exit
710        if ($gnavTrigger.length === 0) { return false; }
711
712        // 初期化
713        $gnavWrap.removeClass(activeName);
714        $gnavTrigger.each(function () {
715          ariaControl(jQuery(this), false);
716        });
717
718        let isMouseOutsideGnavWrap = false;
719        let isMouseOutsideHeaderGnav = false;
720
721        function checkMouseLeave() {
722          if (isMouseOutsideGnavWrap && isMouseOutsideHeaderGnav) {
723            root.style.setProperty('--header-megamenu-height', headerMegamenuHeight);
724          }
725        }
726
727        if(u.isRangePC()) {
728          /* PC時の処理 */
729          /* ホバー時 */
730          $gnavWrap.on('mouseenter', function() {
731            // マウスが要素に乗ったときの処理
732            isMouseOutsideGnavWrap = false;
733            const $thisTrigger = jQuery(this).find(c.gnavTriggerElement);
734            const $thisMegamenu = jQuery(this).find(c.gnavMegamenuElement);
735            const $thisWrap = $thisTrigger.parent('li');
736            if(!$thisWrap.hasClass(activeName)) {
737              $gnavMegamenu.removeAttr('style').css('max-height', window.innerHeight - headerHeightNum);
738              $gnavTrigger.each(function () {
739                ariaControl(jQuery(this), false);
740              });
741              ariaControl($thisTrigger, true, () => {
742                const thisHeight = $thisMegamenu.outerHeight();
743                root.style.setProperty('--header-megamenu-height', `${thisHeight}px`);
744              });
745            }
746          }).on('mouseleave', function() {
747            // マウスが要素から離れたときの処理
748            const $thisTrigger = jQuery(this).find(c.gnavTriggerElement);
749            const $thisWrap = $thisTrigger.parent('li');
750            if(!$thisWrap.hasClass(activeName)) {
751              ariaControl($thisTrigger, false, () => {
752                if(!$gnavWrap.hasClass(activeName)) {
753                  isMouseOutsideGnavWrap = true;
754                  checkMouseLeave();
755                } else {
756                  const $activeWrap = $gnavWrap.filter(`.${activeName}`);
757                  const $activeTrigger = $activeWrap.find(c.gnavTriggerElement);
758                  ariaControl($activeTrigger, true, () => {
759                    root.style.setProperty('--header-megamenu-height', `${activeMegamenuHeight}px`);
760                  });
761                }
762              });
763            }
764          });
765
766          /* .js-header-gnavからマウスが離れたときの処理 */
767          jQuery(c.gnavElement).on('mouseleave', function() {
768            isMouseOutsideHeaderGnav = true;
769            checkMouseLeave();
770          }).on('mouseenter', function() {
771            isMouseOutsideHeaderGnav = false;
772          });
773
774          /* フォーカスアウト時 */
775          $gnavWrap.on('focusout', function(e) {
776            const $thisWrap = jQuery(this);
777            if(e.relatedTarget) {
778              setTimeout(() => {
779                if (!$thisWrap.find(':focus').length) {
780                  $thisWrap.removeClass(activeName);
781                  const $thisTrigger = $thisWrap.find(c.gnavTriggerElement);
782                    ariaControl($thisTrigger, false);
783                }
784              }, 10); // 少し遅延させてフォーカスが移動するのを待つ
785            }
786          });
787
788          /* 領域外クリック時 */
789          jQuery(document).on('click', function(e) {
790            if (!jQuery(e.target).closest(c.gnavElement).length) {
791              $gnavWrap.removeClass(activeName);
792              $gnavTrigger.each(function () {
793                ariaControl(jQuery(this), false, () => {
794                  root.style.setProperty('--header-megamenu-height', headerMegamenuHeight);
795                });
796              });
797            }
798          });
799
800          /* Escキー 押下時 */
801          jQuery(document).on('keydown', function(e) {
802            if (e.key === 'Escape') {
803              const $visibleMenu = $gnavMegamenu.filter('[aria-hidden="false"]');
804              if ($visibleMenu.length > 0) {
805                $gnavWrap.removeClass(activeName);
806                $gnavTrigger.each(function () {
807                  ariaControl(jQuery(this), false, () => {
808                    root.style.setProperty('--header-megamenu-height', headerMegamenuHeight);
809                  });
810                });
811              }
812            }
813          });
814
815          /* クリック時 */
816          $gnavTrigger.on('click', function(e) {
817            e.preventDefault();
818            const $thisTrigger = jQuery(this);
819            const $thisMegamenu = jQuery(`#${$thisTrigger.attr('aria-controls')}${c.gnavMegamenuElement}`);
820            const $thisWrap = $thisTrigger.parent('li');
821            const $siblingsWrap = $thisWrap.siblings('li');
822
823            if (!$thisWrap.hasClass(activeName)) {
824              //メガメニューが非アクティブの場合の処理
825              $siblingsWrap.removeClass(activeName);
826              $siblingsWrap.each(function(){
827                const $siblingsTrigger = jQuery(this).find(c.gnavTriggerElement);
828                ariaControl($siblingsTrigger, false);
829              });
830              $thisWrap.addClass(activeName);
831              ariaControl($thisTrigger, true, () => {
832                const thisHeight = $thisMegamenu.outerHeight();
833                activeMegamenuHeight = thisHeight;
834                root.style.setProperty('--header-megamenu-height', `${thisHeight}px`);
835              });
836            } else {
837              //メガメニューがアクティブの場合の処理
838              $thisWrap.removeClass(activeName);
839              ariaControl($thisTrigger, false, () => {
840                root.style.setProperty('--header-megamenu-height', headerMegamenuHeight);
841              });
842            }
843          });
844        } else {
845          /* SP時の処理 */
846
847          //閉じる処理
848          function closeGnavMegamenu(_wrap, _trigger) {
849            $menuMegamenuContents.outerHeight(defaultMegamenuContentsHeight);
850            _wrap.removeClass(activeName);
851            ariaControl(_trigger, false);
852          }
853
854          /* フォーカスアウト時 */
855          $gnavMegamenu.on('focusout', function(e) {
856            const $thisMegamenu = jQuery(this);
857            const $thisWrap = $thisMegamenu.parent('li');
858            if(e.relatedTarget) {
859              setTimeout(() => {
860                if (!$thisMegamenu.find(':focus').length && !jQuery(e.relatedTarget).closest(c.gnavMegamenuElement).length) {
861                  const $thisTrigger = $thisWrap.find(c.gnavTriggerElement);
862                  closeGnavMegamenu($thisWrap, $thisTrigger);//メニューを閉じる
863                }
864              }, 10); // 少し遅延させてフォーカスが移動するのを待つ
865            }
866          });
867
868          /* クリック時 */
869          $gnavTrigger.on('click', function(e) {
870            e.preventDefault();
871            const $thisTrigger = jQuery(this);
872            const $thisMegamenu = jQuery(`#${$thisTrigger.attr('aria-controls')}${c.gnavMegamenuElement}`);
873            const $thisWrap = $thisTrigger.parent('li');
874            const $siblingsWrap = $thisWrap.siblings('li');
875
876            if (!$thisWrap.hasClass(activeName)) {
877              //メガメニューが非アクティブの場合の処理
878              $siblingsWrap.removeClass(activeName);
879              $siblingsWrap.each(function(){
880                const $siblingsTrigger = jQuery(this).find(c.gnavTriggerElement);
881                ariaControl($siblingsTrigger, false);
882              });
883              activeMegamenuContentsHeight = $thisMegamenu.outerHeight();
884              $menuMegamenuContents.outerHeight(activeMegamenuContentsHeight);
885              $thisWrap.addClass(activeName);
886              ariaControl($thisTrigger, true);
887              $menuMegamenu.animate({
888                scrollTop: 0,
889              }, 300, 'swing');
890            } else {
891              //メガメニューがアクティブの場合の処理
892              closeGnavMegamenu($thisWrap, $thisTrigger);//メニューを閉じる
893            }
894          });
895
896          /* 閉じるボタンクリック時 */
897          $gnavMegamenuHeading.on('click', function() {
898            const $thisMegamenu = jQuery(this).closest(c.gnavMegamenuElement);
899            const $thisTrigger = jQuery(`${c.gnavTriggerElement}[aria-controls='${$thisMegamenu.attr('id')}']`);
900            const $thisWrap = $thisTrigger.parent('li');
901            closeGnavMegamenu($thisWrap, $thisTrigger);//メニューを閉じる
902            $menuMegamenu.animate({
903              scrollTop: 0,
904            }, 300, 'swing');
905          });
906        }
907      }
908
909      /**
910       * SP時ハンバーガーメニュー制御
911       */
912      function menuControl() {
913        // exit
914        if ($menu.length === 0) { return false; }
915
916        // 初期化
917        $menuTrigger.removeClass(activeName);
918        ariaControl($menuTrigger, false);
919
920        if(u.isRangeSP()) {
921          /* SP時の処理 */
922
923          //閉じる処理
924          function closeMenu() {
925            $menuMegamenuContents.outerHeight(defaultMegamenuContentsHeight);
926            $menu.removeClass(activeName);
927            ariaControl($menuTrigger, false);
928            //グロナビのメガメニューを閉じる
929            $gnavWrap.removeClass(activeName);
930            $gnavTrigger.each(function () {
931              ariaControl(jQuery(this), false);
932            });
933            //背景の固定解除
934            if (u.$body.hasClass(activeMenuName)) {
935              u.$body.addClass(noHideHeaderName);
936              setPos = u.$body.css('top').replace(/-(.*)px/, '$1');
937              u.$body.removeClass(activeMenuName);
938              u.$body.css('top', 'auto');
939              u.$win.scrollTop(setPos);
940            }
941          }
942
943          /* フォーカスアウト時 */
944          $menu.on('focusout', function(e) {
945            if(e.relatedTarget) {
946              setTimeout(() => {
947                if (!$menu.find(':focus').length && !jQuery(e.relatedTarget).closest(c.menuElement).length) {
948                  closeMenu();//メニューを閉じる
949                }
950              }, 10); // 少し遅延させてフォーカスが移動するのを待つ
951            }
952          });
953
954          /* 領域外クリック時 */
955          jQuery(document).on('click', function(e) {
956            if (!jQuery(e.target).closest(c.menuElement).length) {
957              closeMenu();//メニューを閉じる
958            }
959          });
960
961          /* クリック時 */
962          $menuTrigger.on('click', function(e) {
963            e.preventDefault();
964
965            defaultMegamenuContentsHeight = $menuMegamenuContents.outerHeight();
966            $menuMegamenuContents.outerHeight(defaultMegamenuContentsHeight);
967
968            if (!$menu.hasClass(activeName)) {
969              //検索窓が非アクティブの場合の処理
970              $menu.addClass(activeName);
971              $menuMegamenu.removeAttr('style').css('max-height', window.innerHeight - 60);
972              ariaControl($menuTrigger, true);
973              //背景の固定
974              if (!u.$body.hasClass(activeMenuName)) {
975                setPos = u.$win.scrollTop();
976                u.$body.addClass(activeMenuName);
977                u.$body.css('top', -setPos);
978              }
979            } else {
980              //検索窓がアクティブの場合の処理
981              closeMenu();//メニューを閉じる
982            }
983          });
984
985          /* 閉じるボタンクリック時 */
986          $menuClose.on('click', function() {
987            closeMenu();//メニューを閉じる
988          });
989        }
990      }
991
992      /**
993       * 検索窓制御
994       */
995      function searchControl() {
996        // exit
997        if ($search.length === 0) { return false; }
998
999        // 初期化
1000        $searchTrigger.removeClass(activeName);
1001        ariaControl($searchTrigger, false);
1002
1003        //閉じる処理
1004        function closeSearch() {
1005          $search.removeClass(activeName);
1006          ariaControl($searchTrigger, false);
1007        }
1008        /* フォーカスアウト時 */
1009        $search.on('focusout', function(e) {
1010          if(e.relatedTarget) {
1011            setTimeout(() => {
1012              if (!$search.find(':focus').length) {
1013                closeSearch();//検索窓を閉じる
1014              }
1015            }, 10); // 少し遅延させてフォーカスが移動するのを待つ
1016          }
1017        });
1018
1019        /* 領域外クリック時 */
1020        jQuery(document).on('click', function(e) {
1021          if (!jQuery(e.target).closest(c.searchElement).length) {
1022            closeSearch();//検索窓を閉じる
1023          }
1024        });
1025
1026        /* クリック時 */
1027        $searchTrigger.on('click', function(e) {
1028          e.preventDefault();
1029          //const forId = jQuery(this).attr('data-for');
1030
1031          if (!$search.hasClass(activeName)) {
1032            //検索窓が非アクティブの場合の処理
1033            $search.addClass(activeName);
1034            $searchMegamenu.removeAttr('style').css('max-height', window.innerHeight - headerHeightNum);
1035            ariaControl($searchTrigger, true);
1036            // 検索窓用フォーカス処理
1037            //if (forId) {
1038            //  setTimeout(() => {
1039            //    jQuery(`#${forId}`)[0].focus();
1040            //  }, 100); // 少し遅延させてフォーカスが移動するのを待つ
1041            //}
1042          } else {
1043            //検索窓がアクティブの場合の処理
1044            closeSearch();//検索窓を閉じる
1045          }
1046        });
1047
1048        /* 閉じるボタンクリック時 */
1049        $searchClose.on('click', function() {
1050          closeSearch();//検索窓を閉じる
1051        });
1052      }
1053
1054      /**
1055       * ヘッダー内アンカーリンク制御
1056       * 同ページ内 `#` リンクのみを対象に、ヘッダーのパネルを閉じて単純に位置遷移する。
1057       * 別ページ遷移リンクやコンテンツ内リンクは対象外(通常挙動にä
1057»»ã›ã‚‹ï¼‰ã€‚
1058       */
1059      function anchorLinkControl() {
1060        // ヘッダー内で開いているパネルをまとめて閉じる
1061        function closeAllPanelsForAnchor() {
1062          //グロナビメガメニューを閉じる
1063          $gnavWrap.removeClass(activeName);
1064          $gnavTrigger.each(function () {
1065            ariaControl(jQuery(this), false);
1066          });
1067          if (u.isRangePC()) {
1068            root.style.setProperty('--header-megamenu-height', headerMegamenuHeight);
1069          } else {
1070            $menuMegamenuContents.outerHeight(defaultMegamenuContentsHeight);
1071          }
1072
1073          //検索窓を閉じる
1074          $search.removeClass(activeName);
1075          ariaControl($searchTrigger, false);
1076
1077          //SP ハンバーガーメニューを閉じる
1078          $menu.removeClass(activeName);
1079          ariaControl($menuTrigger, false);
1080          //body の固定解除はメニュー展開中のみ行う
1081          if (u.$body.hasClass(activeMenuName)) {
1082            u.$body.addClass(noHideHeaderName);
1083            u.$body.removeClass(activeMenuName);
1084            u.$body.css('top', 'auto');
1085          }
1086        }
1087
1088        $header.on('click', 'a[href*="#"]', function (e) {
1089          const href = jQuery(this).attr('href');
1090          const hashIndex = href.indexOf('#');
1091          const urlPath = href.substring(0, hashIndex);
1092          const hash = href.substring(hashIndex);
1093          if (hash === '#') { return; }
1094
1095          //同ページ内アンカーのときのみ処理(別ページ遷移はブラウザに任せる)
1096          const isSamePage = (urlPath === '' || urlPath === location.pathname);
1097          if (!isSamePage) { return; }
1098
1099          const $target = jQuery(hash);
1100          if (!$target.length) { return; }
1101
1102          e.preventDefault();
1103          closeAllPanelsForAnchor();
1104
1105          //単純な位置遷移(スムーススクロールなし、ヘッダー分オフセット)
1106          const targetTop = Math.max(0, $target.offset().top - headerHeightNum);
1107          window.scrollTo(0, targetTop);
1108
1109          //URL ハッシュ更新(同一ハッシュの再クリックでも確実に動作させるため replaceState で無条件更新)
1110          window.history.replaceState(null, '', hash);
1111        });
1112      }
1113
1114
1115      /**
1116       * @execution
1117       */
1118      currentControl();
1119      gnavControl();
1120      menuControl();
1121      searchControl();
1122      anchorLinkControl();
1123      reorderElements();
1124      u.isWindowSizeWatch(() => {
1125        const checkFlg = u.isRangeSP();
1126        if (checkFlg !== breakFlg) {
1127          reorderElements();
1128          breakFlg = checkFlg;
1129        }
1130      })
1131      headerFixed();
1132    }
1133
1134    /**
1135     * @method langControl
1136     */
1137    function langControl(config) {
1138      // options
1139      const c = jQuery.extend({
1140        factorElement: '.js-lang',
1141        jaTriggerElement: '.js-lang__ja',
1142        enTriggerElement: '.js-lang__en',
1143        jaDirectoryName: '',
1144        enDirectoryName: 'english',
1145        baseDirectory: '/', // 言語ディレクトリより上にある共通のディレクトリ(例:/xxxx/xxxxxxx/en/の場合、「/xxxx/xxxxxxx/」を指定。上のディレクトリが存在しない場合は「/」を指定。)
1146        isSameHierarchy: false, //  日本語のディレクトリが他言語のディレクトリと同階層にあるか
1147      }, config);
1148      // vars
1149      const $elm = jQuery(c.factorElement);
1150      const $jaTrigger = $elm.find(c.jaTriggerElement);
1151      const $enTrigger = $elm.find(c.enTriggerElement);
1152      const jaDir = (c.jaDirectoryName === '') ? '/' : `/${c.jaDirectoryName}/`;
1153      const enDir = `/${c.enDirectoryName}/`;
1154      const baseDir = c.baseDirectory;
1155      const pagePath = u.path;
1156      let targetPath;
1157      let lang;
1158      const currentName = u.state.current;
1159      const JUMP_URL = {
1160        ja_home: baseDir.slice(0, -1) + jaDir,
1161        en_home: baseDir.slice(0, -1) + enDir,
1162      };
1163      // exit
1164      if ($elm.length === 0) { return false; }
1165      // setting:言語判定
1166      if (pagePath.indexOf(enDir) !== -1) { lang = 'en'; } else { lang = 'ja'; }
1167      // setting:ON設定
1168      if (lang === 'ja') { $jaTrigger.addClass(currentName); } else if (lang === 'en') { $enTrigger.addClass(currentName); }
1169      // function:Ajax読み込み
1170      const getAjax = function (targetPath) {
1171        return jQuery.ajax({
1172          type: 'GET',
1173          url: targetPath,
1174          dataType: 'html',
1175        });
1176      };
1177      // control:「日本語」ボタン制御
1178      $jaTrigger.on('click', () => {
1179        if (lang === 'ja') { return false; }
1180        if (baseDir === '/') {
1181          targetPath = pagePath.replace(new RegExp(`${enDir}`, 'g'), jaDir);
1182        } else {
1183          targetPath = baseDir.slice(0, -1) + (`/${pagePath.split(baseDir)[1]}`).replace(new RegExp(`${enDir}`, 'g'), jaDir);
1184        }
1185        jQuery.when(getAjax(targetPath))
1186          .done(() => { window.location = targetPath; })
1187          .fail(() => { window.location = JUMP_URL.ja_home; });
1188        return false;
1189      });
1190      // control:「English」ボタン制御
1191      $enTrigger.on('click', () => {
1192        if (lang === 'en') { return false; }
1193        if (c.isSameHierarchy) {
1194          targetPath = pagePath.replace(new RegExp(`${jaDir}`, 'g'), enDir);
1195        } else if (baseDir === '/') {
1196          targetPath = enDir.slice(0, -1) + pagePath;
1197        } else {
1198          targetPath = `${baseDir.slice(0, -1) + enDir.slice(0, -1)}/${pagePath.split(baseDir)[1]}`;
1199        }
1200        jQuery.when(getAjax(targetPath))
1201          .done(() => { window.location = targetPath; })
1202          .fail(() => { window.location = JUMP_URL.en_home; });
1203        return false;
1204      });
1205    }
1206
1207
1208    /**
1209     * @execution
1210     */
1211    headerControl();
1212    langControl();
1213  }
1214});
1215
1216
1217/*################################################
1218###### FOOTER
1219################################################*/
1220
1221jQuery('document').ready(function (){
1222  if(!jQuery('.Footer').hasClass('is-renewal')){
1223    /*!*********************************************!*
1224    !*** 旧体裁 ***!
1225    \*********************************************/
1226    footerFunc();
1227    let lastWidth = window.innerWidth;
1228    window.addEventListener('resize',function(){
1229      if(lastWidth != window.innerWidth){
1230        lastWidth = window.innerWidth;
1231        jQuery(window).on('resize', footerFunc);
1232      }
1233    });
1234
1235    function footerFunc() {
1236      const ua = navigator.userAgent.toLowerCase(),
1237        ww = jQuery(window).width();
1238      jQuery('#footerConsumerBtn').off();
1239      if ((ua.indexOf('iphone') > 0 || ua.indexOf('android') > 0 && ua.indexOf('Mobile') > 0) || (ua.indexOf('ipad') > 0 || ua.indexOf('android') > 0) || ww < 768) {
1240        jQuery('#footerConsumerBtn').on('click', function () {
1241          jQuery(this).toggleClass('on');
1242          jQuery('#footerConsumerLinkBox').toggle();
1243          return false;
1244        });
1245        jQuery('body').on('click', function (e) {
1246          if (!jQuery(e.target).closest('#footerConsumerLinkBox').length && jQuery('#footerConsumerLinkBox').css('display') === 'block') {
1247            jQuery('#footerConsumerLinkBox').hide();
1248          }
1249        });
1250      } else {
1251        jQuery('#footerConsumerBtn').on('click', function () {
1252          jQuery(this).toggleClass('on');
1253          jQuery('#footerConsumerLinkBox').toggle();
1254          return false;
1255        });
1256        jQuery('#footerConsumerBtn').hover(function () {
1257          jQuery('#footerConsumerLinkBox').removeAttr('style');
1258        });
1259      //jQuery('#footerConsumerBtn').off();
1260        /*jQuery('#footerConsumerBtn').on('click', function () {
1261          return false;
1262        });*/
1263      }
1264    }
1265  } else {
1266    /*!*********************************************!*
1267    !*** 新体裁 ***!
1268    \*********************************************/
1269    const u = new layoutUtil();
1270    /**
1271     * @method footerSmoothScroll
1272     */
1273    function footerSmoothScroll(config) {
1274      // options
1275      const c = jQuery.extend({
1276        factorElement: '.js-footer-smooth-scroll',
1277      }, config);
1278      // vars
1279      const $elm = jQuery(c.factorElement);
1280      // exit
1281      if ($elm.length === 0) { return false; }
1282
1283      $elm.on('click', function(e){
1284        e.preventDefault();
1285        const href= jQuery(this).attr("href");
1286        const $target = jQuery(href);
1287        const gap = 30;
1288        const speed = 500;
1289        if($target.offset()) {
1290          const targetPosition = href === '#headerLogo' ? 0 : $target.get(0).offsetTop - gap;
1291          jQuery('html, body').animate({
1292            scrollTop: targetPosition,
1293          }, speed, 'swing');
1294        }
1295      });
1296    }
1297
1298    /**
1299     * @method footerScrollAnimation
1300     */
1301    function footerScrollAnimation(config) {
1302      // options
1303      const c = jQuery.extend({
1304        factorElement: '.js-footer-scroll-animation',
1305        childElement: '.js-footer-scroll-animation__child',
1306      }, config);
1307      // vars
1308      const $elm = jQuery(c.factorElement);
1309      const showName = u.state.show;
1310      const triggerRatio = 0.1;
1311      const windowHeight = window.innerHeight;
1312      const triggerPoint = windowHeight - windowHeight * triggerRatio;
1313      const orderAttr = 'data-scroll-animation-order';
1314      // exit
1315      if ($elm.length === 0) { return false; }
1316
1317      function scrollControl() {
1318        // 各要素のpositionを格納する配列を作成
1319        const groupByPosition = [];
1320
1321        $elm.each(function () {
1322          const $child = jQuery(this).find(c.childElement);
1323          const elementTop = this.getBoundingClientRect().top;
1324
1325          // 要素の位置が一致するグループを探す
1326          let group = groupByPosition.find(g => g.position === elementTop);
1327
1328          if (!group) {
1329            group = { position: elementTop, elements: [] };
1330            groupByPosition.push(group);
1331          }
1332
1333          // $childがある場合、並び替え
1334          if ($child.length > 0) {
1335            // $childを並び替える
1336            const sortedChildren = $child.toArray().sort((a, b) => {
1337              const orderA = jQuery(a).attr(orderAttr);
1338              const orderB = jQuery(b).attr(orderAttr);
1339
1340              const isNumericA = orderA !== undefined && !isNaN(orderA);
1341              const isNumericB = orderB !== undefined && !isNaN(orderB);
1342
1343              if (isNumericA && isNumericB) {
1344                return parseInt(orderA) - parseInt(orderB);
1345              } else if (isNumericA) {
1346                return -1;
1347              } else if (isNumericB) {
1348                return 1;
1349              } else {
1350                return 0;
1351              }
1352            });
1353
1354            group.elements.push(...sortedChildren);
1355          } else {
1356            group.elements.push(this);
1357          }
1358        });
1359
1360        // 上辺位置が同じ要素をグループ化し、グループごとに順番にaddClassを実行
1361        groupByPosition.sort((a, b) => a.position - b.position); // 上辺位置でソート
1362
1363        groupByPosition.forEach((group, index) => {
1364          const groupElements = group.elements;
1365          if (group.position <= triggerPoint) {
1366            groupElements.forEach((element, index) => {
1367              setTimeout(() => {
1368                jQuery(element).addClass(showName);
1369              }, index * 35);
1370            });
1371          }
1372        });
1373      }
1374      scrollControl();
1375        u.$win.on('scroll', () => {
1376        scrollControl();
1377      });
1378    }
1379
1380
1381    /**
1382     * @execution
1383     */
1384    footerSmoothScroll();
1385    footerScrollAnimation();
1386  }
1387});

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.