PageSourceSearch

https://www.coo-kai.jp/assets/js/script.js

js coo-kai.jp collected 2026-10-04 15:26:37 UTC 34,904 bytes, 1,082 lines download raw bytes

1/* タブレット判定 */
2var ua = window.navigator.userAgent.toLowerCase();
3if (ua.indexOf('ipad') > 0 || ua.indexOf('android') > 0 && 1 > ua.indexOf('mobile')) {
4  $('head>meta[name="viewport"]').replaceWith('<meta name="viewport" content="width=1366,user-scalable=yes">');
5} else if (ua.indexOf('iPad') > -1 || ua.indexOf('macintosh') > -1 && 'ontouchend' in document) {
6  $('head>meta[name="viewport"]').replaceWith('<meta name="viewport" content="width=1366,user-scalable=yes">');
7}
8/* ===================================================================
9 * カラムを揃える - matchHeight
10=================================================================== */
11$(document).ready(function () {
12  setTimeout(function () {
13    if (window.matchMedia('(min-width:768px)').matches) {
14      $('.series-list .icn').matchHeight();
15    }
16  }, 100);
17});
18
19/* ===================================================================
20 * 追従処理
21=================================================================== */
22$(function () {
23  const header = $("#header").height();
24  $(window).on("scroll", function () {
25    const scrollTop = $(window).scrollTop();
26    if (scrollTop > header) {
27      $("body").addClass("is_scroll");
28    } else {
29      $("body").removeClass("is_scroll");
30    }
31  });
32});
33
34/* ===================================================================
35 * page top
36=================================================================== */
37$(window).on('load scroll', function () {
38  var scroll = $(window).scrollTop();
39  var winH = window.innerHeight;
40  if (window.matchMedia('(min-width:768px)').matches) {
41    var fitPosi = $('#footer').offset().top - winH + 80;
42  } else {
43    var fitPosi = $('#footer').offset().top - winH + 50;
44  }
45  if (scroll > 100) {
46    $('.js-page-top').addClass('is-show');
47  } else {
48    $('.js-page-top').removeClass('is-show');
49  }
50  if (scroll > fitPosi) {
51    $('.js-page-top').addClass('is-end');
52  } else {
53    $('.js-page-top').removeClass('is-end');
54  }
55
56});
57
58
59/* ===================================================================
60 * スムーススクロール
61=================================================================== */
62$(function () {
63  $('.js-anchor-link').on('click', function (e) {
64    e.preventDefault();
65    var tar = $(this).attr('href');
66    var posi = $(tar).offset().top;
67    var hdH = $('.js-gnav').outerHeight();
68    $('html, body').animate({ scrollTop: posi - hdH }, 500, 'swing');
69  });
70});
71
72
73/* ===================================================================
74 * 直近の子要素を探索
75=================================================================== */
76$.fn.closestOpposite = function (selector) {
77  // 1階層下の子要素を取得
78  var children = this.children();
79  // 子要素がないときは探索終了
80  if (children.length === 0) return $();
81  // 現在の要素が探索するクラス名を持っていたとき
82  if (this.filter(selector).length) {
83    return this.filter(selector);
84  }
85  // それ以外のときはさらに下層を再帰的に探索
86  return children.closestOpposite(selector);
87};
88
89
90/*===================================================================
91 * タブ切り替え
92=================================================================== */
93$(function () {
94  $('.js-tab-wrap .js-tab-ttl:not(.link-tab)').on('click', function (e) {
95    e.preventDefault();
96    var tar = $(this).attr('href');
97    if (!$(this).hasClass('cur')) {
98      $(this).closest('.js-tab-wrap').closestOpposite('.js-tab-ttl').removeClass('cur');
99      $(this).closest('.js-tab-wrap').closestOpposite('.js-tab-contents').removeClass('cur');
100      $(this).addClass('cur');
101      $(tar).addClass('cur');
102    }
103  });
104});
105
106/* 読み込み時URLに?tab=があればタブ切替 */
107$(window).on('load', function () {
108  function getParam(name, url) {
109    if (!url) url = window.location.href;
110    name = name.replace(/[\[\]]/g, "\\$&");
111    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
112      results = regex.exec(url);
113    if (!results) return null;
114    if (!results[2]) return '';
115    return decodeURIComponent(results[2].replace(/\+/g, " "));
116  }
117  var tar = getParam('tab');
118  if (tar != null) {
119    var $this = $('.js-tab-wrap .js-tab-ttl[href="#' + tar + '"]');
120    console.log(tar);
121    $this.closest('.js-tab-wrap').find('.js-tab-ttl').removeClass('cur');
122    $this.closest('.js-tab-wrap').find('.js-tab-contents').removeClass('cur');
123    $this.addClass('cur');
124    $('#' + tar).addClass('cur');
125    var urlHash = location.hash;
126    if (urlHash) {
127      var position = $(urlHash).offset().top;
128      setTimeout(function () {
129        $('body,html').animate({ scrollTop: position }, 10);
130      }, 100);
131    }
132  }
133});
134
135
136/*===================================================================
137アコーディオン
138===================================================================*/
139$(function () {
140  $('.js-acc-ttl').on('click', function () {
141    var $wrap = $(this).closest('.js-acc-wrap');
142    if ($wrap.length) {
143      // .js-acc-wrap 内の他の .js-acc-contents を閉じる
144      $wrap.find('.js-acc-contents').not($(this).siblings('.js-acc-contents')).slideUp();
145    }
146
147    // クリックされた要素の兄弟 .js-acc-contents を表示・非表示
148    $(this).siblings('.js-acc-contents').stop(true).slideToggle();
149    $(this).toggleClass('cur');
150  });
151});
152
153
154/* ===================================================================
155 * fade action
156=================================================================== */
157function jsAction(target) {
158  scrollTop = $(window).scrollTop();
159  var winHeight = $(window).height();
160  var scrollPos = scrollTop + winHeight - 200;
161  if (scrollPos > target.offset().top) {
162    target.addClass('is-show');
163  }
164}
165$(window).on('load scroll', function () {
166  $('.js-action').each(function (i) {
167    $(this).attr('data-action', 'js-action' + (i + 1));
168    target = $(this).attr('data-action');
169    jsAction($('.js-action[data-action=' + target + ']'));
170  });
171  $('.js-action-wrap').each(function () {
172    var $parent = $(this);
173    var $child = $parent.find('.js-action-child');
174    if ($parent.hasClass('is-show')) {
175      $child.each(function (i) {
176        var $this = $(this);
177        setTimeout(function () {
178          $this.addClass('is-show');
179        }, 150 * i);
180      });
181    }
182  });
183});
184/*
185$(window).on('load', function(){
186  $('.js-mv-img').addClass('is-show')
187});
188*/
189
190/* ===================================================================
191 * slider
192=================================================================== */
193$(function () {
194  if ($('.slide-logo-wrap').length) {
195    new Splide('.slide-logo-1st-row', {
196      type: 'loop',
197      autoWidth: true,
198      gap: 0,
199      arrows: false,
200      pagination: false,
201      autoScroll: {
202        speed: 1,
203        pauseOnHover: false,
204        pauseOnFocus: false
205      }
206    }).mount(window.splide.Extensions);
207    new Splide('.slide-logo-2nd-row', {
208      type: 'loop',
209      autoWidth: true,
210      gap: 0,
211      arrows: false,
212      pagination: false,
213      autoScroll: {
214        speed: 1,
215        pauseOnHover: false,
216        pauseOnFocus: false
217      }
218    }).mount(window.splide.Extensions);
219  }
220  if ($('.news-slider-wrap').length) {
221    var newsSplide = new Splide('.news-slider-wrap', {
222      type: 'loop',
223      perPage: 3,
224      perMove: 1,
225      gap: 0,
226      pagination: true,
227      focus: 0,
228      autoplay: true,
229      interval: 4000,
230      pauseOnHover: true,
231      pauseOnFocus: true,
232      speed: 700,
233      breakpoints: {
234        767: {
235          perPage: 1,
236          arrows: false
237        }
238      }
239    });
240    newsSplide.on('overflow', function (isOverflow) {
241      newsSplide.options = {
242        arrows: isOverflow,
243        pagination: isOverflow,
244        drag: isOverflow,
245      };
246    });
247    newsSplide.mount();
248  }
249  if ($('.blog-slider-wrap').length) {
250    var blogSplide = new Splide('.blog-slider-wrap', {
251      type: 'loop',
252      perPage: 3,
253      perMove: 1,
254      gap: 0,
255      pagination: true,
256      focus: 0,
257      autoplay: true,
258      interval: 4000,
259      pauseOnHover: true,
260      pauseOnFocus: true,
261      speed: 700,
262      breakpoints: {
263        767: {
264          perPage: 1,
265          arrows: false
266        }
267      }
268    });
269    blogSplide.on('overflow', function (isOverflow) {
270      blogSplide.options = {
271        arrows: isOverflow,
272        pagination: isOverflow,
273        drag: isOverflow,
274      };
275    });
276    blogSplide.mount();
277  }
278  if ($('.case-study-slider-wrap').length) {
279    var caseSplide = new Splide('.case-study-slider-wrap', {
280      type: 'loop',
281      perPage: 3,
282      perMove: 1,
283      gap: 0,
284      pagination: true,
285      focus: 0,
286      autoplay: true,
287      interval: 4000,
288      pauseOnHover: true,
289      pauseOnFocus: true,
290      speed: 700,
291      breakpoints: {
292        767: {
293          perPage: 1,
294          arrows: false
295        }
296      }
297    });
298    caseSplide.on('overflow', function (isOverflow) {
299      caseSplide.options = {
300        arrows: isOverflow,
301        pagination: isOverflow,
302        drag: isOverflow,
303      };
304    });
305    caseSplide.mount();
306  }
307  if ($('.js-img-slider-wrap-pc').length) {
308    new Splide('.js-img-slider-wrap-pc', {
309      type: 'loop',
310      perPage: 1,
311      perMove: 1,
312      gap: 0,
313      arrows: false,
314      pagination: false,
315      autoplay: true,
316      pauseOnHover: false,
317      pauseOnFocus: false
318    }).mount();
319  }
320  if ($('.js-img-slider-wrap-sp').length) {
321    new Splide('.js-img-slider-wrap-sp', {
322      type: 'loop',
323      perPage: 1,
324      perMove: 1,
325      gap: 0,
326      arrows: false,
327      pagination: false,
328      autoplay: true,
329      pauseOnHover: false,
330      pauseOnFocus: false
331    }).mount();
332  }
333});
334
335/* ===================================================================
336 * sp menu
337=================================================================== */
338$(function () {
339  var scroll = 0;
340  $('.js-sp-menu').on('click', function () {
341    if ($(this).hasClass('is-opened')) {
342      $('body').removeClass('is-fixed');
343      $('#wrap').css({ top: '' });
344      $('html, body').scrollTop(scroll);
345      $(this).removeClass('is-opened');
346      $('.js-sp-nav').removeClass('is-show is-fixed').css({ top: '' });
347    } else {
348      scroll = $(window).scrollTop();
349      $(this).addClass('is-opened');
350      $('.js-sp-nav').addClass('is-show');
351      $('body').addClass('is-fixed');
352      $('#wrap').css({ top: -scroll });
353      if (scroll > $('#header').outerHeight()) {
354        $('.js-sp-nav').addClass('is-fixed');
355      } else {
356        var posi = $('#header').outerHeight() - scroll + $('.js-gnav').outerHeight();
357        $('.js-sp-nav').css({ top: posi });
358      }
359    }
360  });
361});
362
363/* ===================================================================
364 * top animation
365=================================================================== */
366document.addEventListener('DOMContentLoaded', function () {
367  if ($('.js-concept-img-wrap').length) {
368    const videoElement = document.getElementById('concept-img');
369    const sourceElement = videoElement.querySelector('source');
370
371    function updateVideoSource() {
372      const isMobile = window.innerWidth <= 768; // SP: 768px以下を想定
373      const newSource = isMobile ? '/assets/mov/bg_concept_sp.mp4' : '/assets/mov/bg_concept.mp4';
374
375      if (sourceElement.src !== location.origin + '/' + newSource) {
376        sourceElement.src = newSource; // ソースを変更
377        videoElement.load(); // ソースを再読み込み
378      }
379    }
380
381    updateVideoSource(); // 初期ロード時に呼び出し
382    // window.addEventListener('resize', updateVideoSource); // リサイズ時に切り替え
383  }
384});
385$(window).on('load scroll', function () {
386  if ($('.js-concept-img-wrap').length) {
387    if ($('.js-concept-img-wrap').hasClass('is-show') && !$('.js-concept-img-wrap').hasClass('has-animated')) {
388      $('.js-concept-img-wrap').addClass('has-animated');
389      setTimeout(function () {
390        $('#concept-img')[0].play();
391      }, 250);
392    }
393    $('#concept-img').on('timeupdate', function () {
394      var currentTime = this.currentTime;
395      if (currentTime >= 2) {
396        var $child = $('.js-concept-txt .js-concet-child');
397        $child.each(function (i) {
398          var $this = $(this);
399          setTimeout(function () {
400            $this.addClass('is-show');
401          }, 250 * i);
402        });
403      }
404    });
405  }
406  if ($('.js-service-img-wrap').length) {
407    if ($('.js-service-img-wrap').hasClass('is-show') && !$('.js-service-img-wrap').hasClass('has-animated')) {
408      if (window.matchMedia('(max-width:767px)').matches) {
409        var serviceAnimation = lottie.loadAnimation({
410          container: document.getElementById("service-img"), //呼び出し位置の要素に入れたIDを指定
411          renderer: "svg", // svg・canvas・htmlの3種類から機能に応じて指定(省略可、デフォルトはsvg)
412          loop: false, // ループの有無を指定(省略可、デフォルトはtrue)
413          autoplay: false, // 自動再生の有無を指定(省略可、デフォルトはtrue)
414          path: "/assets/json/service_sp/data.json" //使用するJSONファイルがある実際のディレクトリ名・ファイル名を入れる
415        });
416      } else {
417        var serviceAnimation = lottie.loadAnimation({
418          container: document.getElementById("service-img"),
419          renderer: "svg",
420          loop: false,
421          autoplay: false,
422          path: "/assets/json/service/data.json"
423        });
424      }
425      $('.js-service-img-wrap').addClass('has-animated');
426      setTimeout(function () {
427        serviceAnimation.play();
428      }, 250);
429    }
430  }
431});
432var winW;
433$(window).on('load', function () {
434  if ($('.js-top-mv-mov').length) {
435    if (window.matchMedia('(max-width:767px)').matches) {
436      $('body').addClass('is-sp');
437      var mvAnimation = lottie.loadAnimation({
438        container: document.getElementById("top-mv-mov"),
439        renderer: "svg",
440        loop: false,
441        autoplay: false,
442        path: "/assets/json/mv_sp/data.json"
443      });
444    } else {
445      $('body').addClass('is-pc');
446      var mvAnimation = lottie.loadAnimation({
447        container: document.getElementById("top-mv-mov"),
448        renderer: "svg",
449        loop: false,
450        autoplay: false,
451        path: "/assets/json/mv/data.json"
452      });
453    }
454    setTimeout(function () {
455      mvAnimation.play();
456      $('.js-top-mv-mov').addClass('is-animate');
457      setTimeout(function () {
458        $('.js-top-mv-txt-01').addClass('is-show');
459        setTimeout(function () {
460          $('.js-top-mv-txt-02').addClass('is-show');
461        }, 750);
462      }, 2000);
463    }, 250);
464  }
465});
466$(window).on('resize', function () {
467  if ($('.js-top-mv-mov').length) {
468    if (window.matchMedia('(max-width:767px)').matches) {
469      if (!$('body').hasClass('is-sp')) {
470        $('body').removeClass('is-pc').addClass('is-sp');
471        $('.js-top-mv-txt-01, .js-top-mv-txt-02').removeClass('is-show');
472        $('#top-mv-mov').html('');
473        var mvAnimation = lottie.loadAnimation({
474          container: document.getElementById("top-mv-mov"),
475          renderer: "svg",
476          loop: false,
477          autoplay: false,
478          path: "/assets/json/mv_sp/data.json"
479        });
480        setTimeout(function () {
481          mvAnimation.play();
482          $('.js-top-mv-mov').addClass('is-animate');
483          setTimeout(function () {
484            $('.js-top-mv-txt-01').addClass('is-show');
485            setTimeout(function () {
486              $('.js-top-mv-txt-02').addClass('is-show');
487            }, 750);
488          }, 2000);
489        }, 250);
490      }
491    } else {
492      if (!$('body').hasClass('is-pc')) {
493        $('body').removeClass('is-sp').addClass('is-pc');
494        $('.js-top-mv-txt-01, .js-top-mv-txt-02').removeClass('is-show');
495        $('#top-mv-mov').html('');
496        var mvAnimation = lottie.loadAnimation({
497          container: document.getElementById("top-mv-mov"),
498          renderer: "svg",
499          loop: false,
500          autoplay: false,
501          path: "/assets/json/mv/data.json"
502        });
503        setTimeout(function () {
504          mvAnimation.play();
505          $('.js-top-mv-mov').addClass('is-animate');
506          setTimeout(function () {
507            $('.js-top-mv-txt-01').addClass('is-show');
508            setTimeout(function () {
509              $('.js-top-mv-txt-02').addClass('is-show');
510            }, 750);
511          }, 2000);
512        }, 250);
513      }
514    }
515  }
516});
517
518
519
520
521/* ===================================================================
522 * 満足度
523=================================================================== */
524/* ===================================================================
525 * ドーナツチャート作成処理
526=================================================================== */
527function createCircle(
528  score,
529  option = {
530    strokeWidth: 3
531  }
532) {
533  const r = 100 / (2 * Math.PI);
534
535  const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
536  svg.setAttribute("viewBox", "0 0 40 40");
537
538  // Define the gradient
539  const defs = document.createElementNS("http://www.w3.org/2000/svg", "def
539s");
540  const linearGradient = document.createElementNS(
541    "http://www.w3.org/2000/svg",
542    "linearGradient"
543  );
544  linearGradient.setAttribute("id", "circle-gradient");
545  linearGradient.setAttribute("x1", "0");
546  linearGradient.setAttribute("x2", "1");
547  linearGradient.setAttribute("y1", "0");
548  linearGradient.setAttribute("y2", "0");
549
550  // Gradient stops
551  const stop1 = document.createElementNS(
552    "http://www.w3.org/2000/svg",
553    "stop"
554  );
555  stop1.setAttribute("offset", "0%");
556  stop1.setAttribute("stop-color", "#3fa9f5");
557  linearGradient.appendChild(stop1);
558
559  const stop2 = document.createElementNS(
560    "http://www.w3.org/2000/svg",
561    "stop"
562  );
563  stop2.setAttribute("offset", "100%");
564  stop2.setAttribute("stop-color", "#00ffff");
565  linearGradient.appendChild(stop2);
566
567  defs.appendChild(linearGradient);
568  svg.appendChild(defs);
569
570  // Background path
571  const backgroundPath = document.createElementNS(
572    "http://www.w3.org/2000/svg",
573    "path"
574  );
575  backgroundPath.setAttribute(
576    "d",
577    `M20 ${(40 - (r + r)) / 2}
578    a ${r} ${r} 0 0 1 0 ${r + r}
579    a ${r} ${r} 0 0 1 0 -${r + r}`
580  );
581  backgroundPath.setAttribute("fill", "none");
582  backgroundPath.setAttribute("stroke", "#F2F2F2");
583  backgroundPath.setAttribute("stroke-width", option.strokeWidth);
584  backgroundPath.setAttribute("stroke-dasharray", "100");
585  svg.appendChild(backgroundPath);
586
587  // Foreground path
588  const foregroundPath = document.createElementNS(
589    "http://www.w3.org/2000/svg",
590    "path"
591  );
592  foregroundPath.setAttribute(
593    "d",
594    `M20 ${(40 - (r + r)) / 2}
595    a ${r} ${r} 0 0 1 0 ${r + r}
596    a ${r} ${r} 0 0 1 0 -${r + r}`
597  );
598  foregroundPath.setAttribute("fill", "none");
599  foregroundPath.setAttribute("stroke", "url(#circle-gradient)");
600  foregroundPath.setAttribute("stroke-width", option.strokeWidth);
601  foregroundPath.setAttribute("stroke-dasharray", `${score} 100`);
602  foregroundPath.setAttribute("class", "circle");
603  svg.appendChild(foregroundPath);
604
605  return svg;
606}
607
608/* ===================================================================
609 * カウントアップ処理
610=================================================================== */
611function startCountUp(counterElement, targetNumber, duration) {
612  const intervalTime = (duration * 1500) / targetNumber; // 各ステップの時間を計算 (ms)
613  let count = 0;
614
615  const interval = setInterval(() => {
616    count++;
617    counterElement.textContent = count;
618
619    // 最終数値に到達したら停止
620    if (count >= targetNumber) {
621      clearInterval(interval);
622    }
623  }, intervalTime);
624}
625
626/* ===================================================================
627 * Lottieアニメーションの初期化
628=================================================================== */
629function initLottieAnimations(container) {
630  const animations = [];
631
632  container.querySelectorAll(".js-result-animation").forEach((element) => {
633    const isUp = element.classList.contains("up");
634    const path = isUp
635      ? "/assets/json/up/data.json"
636      : "/assets/json/down/data.json";
637
638    const animation = lottie.loadAnimation({
639      container: element,
640      renderer: "svg",
641      loop: false,
642      autoplay: false,
643      path: path,
644    });
645
646    animations.push({ element, animation });
647  });
648
649  return animations;
650}
651
652/* ===================================================================
653 * アニメーション発火処理
654=================================================================== */
655function createDonutChartTask(chart) {
656  const chart_num = chart.getAttribute("data-chart-num");
657  const chartBox = chart.querySelector(".js-donut-chart-box");
658  const counterText = chart.querySelector(".js-counter-text");
659  const counterWrap = chart.querySelector(".js-counter-wrap");
660
661  const option = {
662    strokeWidth: 3,
663  };
664  const circle = createCircle(chart_num, option);
665  chartBox.appendChild(circle);
666
667  // `%` を追加
668  if (counterWrap) {
669    counterWrap.append("%");
670  }
671
672  // カウントアップ処理
673  startCountUp(counterText, chart_num, 1);
674}
675
676function playLottieAnimation(animation) {
677  animation.animation.play();
678}
679
680function handleIntersection(entry, observer) {
681  const result = entry.target;
682
683  if (entry.isIntersecting) {
684    const donutChart = result.querySelector(".js-donut-chart-wrap");
685    const lottieAnimations = initLottieAnimations(result);
686
687    if (donutChart) {
688      createDonutChartTask(donutChart);
689    }
690
691    if (lottieAnimations.length > 0) {
692      lottieAnimations.forEach((animation) => {
693        playLottieAnimation(animation);
694      });
695    }
696
697    // 一度アニメーションを発火したら監視を停止
698    observer.unobserve(result);
699  }
700}
701
702/* ===================================================================
703 * IntersectionObserverで個別発火を監視
704=================================================================== */
705function observeResults() {
706  const results = document.querySelectorAll(".js-result");
707
708  const observer = new IntersectionObserver(
709    (entries, observer) => {
710      entries.forEach((entry) => handleIntersection(entry, observer));
711    },
712    {
713      root: null, // ビューポートをルートとして使用
714      rootMargin: "0px", // 画面の下 100px の位置で発火
715      threshold: 0.3, // 少しでも見えたら発火
716    }
717  );
718
719  results.forEach((result) => observer.observe(result));
720}
721
722/* ===================================================================
723 * 初期化
724=================================================================== */
725document.addEventListener("DOMContentLoaded", () => {
726  observeResults();
727});
728
729
730/* ===================================================================
731 * modal
732=================================================================== */
733var tag = document.createElement('script');
734tag.src = "https://www.youtube.com/iframe_api";
735var firstScriptTag = document.getElementsByTagName('script')[0];
736firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
737
738var player;
739var playerReady = false;
740
741// YouTube Iframe APIが読み込まれたときに呼ばれる関数
742function onYouTubeIframeAPIReady() {
743  player = new YT.Player('youtube-player', {
744    events: {
745      'onReady': function () {
746        playerReady = true; // プレイヤーが準備完了したことをマーク
747      }
748    }
749  });
750}
751$(function () {
752  var scroll;
753  /* img modal */
754  $(document).on('click', '.js-img-modal', function (e) {
755    e.preventDefault();
756    var tar = $(this).attr('href');
757    scroll = $(window).scrollTop();
758    $('body').addClass('is-fixed');
759    $('#wrap').css({ top: - scroll });
760    $(tar).find('.modal-img').scrollTop(0);
761    $(tar + ', .js-img-modal-overlay').addClass('is-show');
762  });
763  $('.js-img-modal-close').on('click', function () {
764    $('.js-img-modal-win, .js-img-modal-overlay').removeClass('is-show');
765    $('#wrap').css({ top: '' });
766    $('body').removeClass('is-fixed');
767    $('html, body').scrollTop(scroll);
768  });
769  /* movie modal */
770  $('.js-movie-start').on('click', function () {
771    scroll = $(window).scrollTop();
772    var winW = $(window).width();
773    var winH = window.innerHeight;
774    if ((winW / 16) > (winH / 9)) {
775
776    }
777    var movieH = $('.movie-wrap').outerHeight() + 40;
778    if (movieH > winH) {
779      var width = ((winH - 128) / 9) * 16;
780      $('.js-movie-modal-win').css({ width: width });
781    }
782    $('body').addClass('is-fixed');
783    $('#wrap').css({ top: -scroll });
784    $('.js-movie-modal-win, .js-movie-modal-overlay').addClass('is-show');
785
786    // YouTube動画を再生
787    if (playerReady && player) {
788      player.playVideo();
789    } else if($(this).hasClass('js-video-start')){
790      var tarID = $(this).data('movie');
791      var $video = $(tarID);
792      if ($video.length) {
793        $video[0].currentTime = 0; // 先頭に戻す
794        $video[0].play();
795      }
796    } else {
797      console.error('YouTube player is not ready yet.');
798    }
799  });
800
801  $('.js-movie-modal-close').on('click', function () {
802    $('.js-movie-modal-win, .js-movie-modal-overlay').removeClass('is-show');
803    $('#wrap').css({ top: '' });
804    $('body').removeClass('is-fixed');
805    $('html, body').scrollTop(scroll);
806    $('.js-movie-modal-win').css({ width: '' });
807
808    // YouTube動画を停止
809    if (player && typeof player.stopVideo === 'function') {
810      player.stopVideo();
811    }
812    $('.js-video').each(function() {
813      this.pause();         // 停止
814      this.currentTime = 0; // 再生位置リセット
815    });
816  });
817});
818
819/* ===================================================================
820 * 問い合わせ系必須入力
821=================================================================== */
822$(function () {
823  if (!$('.js-form-required').length) return false;
824
825
826  $('.js-required').find('input, select, textarea').each(function () {
827    let val = $(this).is(':checkbox, :radio') ? $(this).is(':checked') : $(this).val();
828
829    if (!$(this).is(':checkbox')) {
830      //チェックボックス以外
831      if (val != '' && val != false) {
832        $(this).closest('.js-required').addClass('js-is-input');
833      } else {
834        $(this).closest('.js-required').removeClass('js-is-input');
835      }
836    } else {
837      //チェックボックスの場合
838      let check_flg = false;
839      $(this).closest('.js-required').find('input').each(function () {
840        if ($(this).prop('checked')) {
841          check_flg = true
842          return false;
843        }
844      });
845      if (check_flg) {
846        $(this).closest('.js-required').addClass('js-is-input');
847      } else {
848        $(this).closest('.js-required').removeClass('js-is-input');
849      }
850    }
851
852    let input_count = $('.js-is-input').length
853    let required_count = $('.js-required').length
854    $('.required-count').find('.count').text(0 + required_count - input_count);
855
856  });
857
858
859  $('.js-required').find('input, select, textarea').on('input change', function () {
860    let val = $(this).is(':checkbox, :radio') ? $(this).is(':checked') : $(this).val();
861
862    if (!$(this).is(':checkbox')) {
863      //チェックボックス以外
864      if (val != '' && val != false) {
865        $(this).closest('.js-required').addClass('js-is-input');
866      } else {
867        $(this).closest('.js-required').removeClass('js-is-input');
868      }
869    } else {
870      //チェックボックスの場合
871      let check_flg = false;
872      $(this).closest('.js-required').find('input').each(function () {
873        if ($(this).prop('checked')) {
874          check_flg = true
875          return false;
876        }
877      });
878      if (check_flg) {
879        $(this).closest('.js-required').addClass('js-is-input');
880      } else {
881        $(this).closest('.js-required').removeClass('js-is-input');
882      }
883    }
884
885    let input_count = $('.js-is-input').length
886    let required_count = $('.js-required').length
887    $('.required-count').find('.count').text(0 + required_count - input_count);
888
889  });
890
891
892  $('.js-form-required form').on('submit', function (e) {
893    if ($('.required-count').find('.count').text() != 0) {
894      e.preventDefault();
895    }
896
897  });
898
899
900});
901
902/* ===================================================================
903 * カレントナビ
904=================================================================== */
905$(function () {
906  const currentPath = window.location.pathname;
907  $('.nav>
907li>a').each(function () {
908    const href = $(this).attr('href');
909    // TOPメニュー以外で、現在のパスがhrefで始まる場合にcurクラスを付与
910    if (href !== '/' && currentPath.startsWith(href)) {
911      $(this).addClass('cur');
912    }
913  });
914});
915
916// パンくずリストのテキスト反映処理
917$(function () {
918  const $breadcrumbs = $('.breadcrumbs');
919  if ($breadcrumbs.length) {
920    const lastText = $breadcrumbs.find('ol li:last-child [itemprop="name"]').text();
921    if (lastText) {
922      $('.topic-path').append('<li>' + lastText + '</li>');
923    }
924  }
925});
926
927
928
929/* ===================================================================
930 * 用語集
931=================================================================== */
932
933$(window).on("load", function () {
934  'use strict';
935
936  var words = [];
937
938  // search word //========//
939  function searchWord() {
940    // sort
941    words.sort(function (a, b) {
942      if (a['ふりがな'] > b['ふりがな']) return -1;
943      if (a['ふりがな'] < b['ふりがな']) return 1;
944      return 0;
945    });
946
947    // 置換
948    $('.word-tip-target').each(function () {
949      if ($(this).closest('a').get(0)) { return; }
950
951      var html = $(this).html();
952      for (var i = 0; i < words.length; i++) {
953        var w = words[i]['タイトル'];
954        w = w.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
955        html = html.replace(new RegExp(w, 'gm'), function (str, offset, s) {
956          var nai = false;
957          var reg = new RegExp('<[^>]*>[^<]*' + w + '[^<]*</[^>]*>|<[^>]*' + w + '[^>]*>', 'gm');
958          var m;
959          while ((m = reg.exec(s)) !== null) {
960            if (offset >= m.index && offset <= m[0].length + m.index - 1) {
961              nai = true;
962            }
963          }
964          return nai ? str : '<span class="elm-word tooltip-trigger js-tooltip-trigger">' + str + '</span>';
965        });
966      }
967      $(this).html(html);
968    });
969
970    // 置換(広範囲版)
971    $('.word-tip-target-wide-text').each(function () {
972      if ($(this).closest('a').get(0)) { return; }
973
974      var html = $(this).html();
975      for (var i = 0; i < words.length; i++) {
976        var w = words[i]['タイトル'];
977        w = w.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
978        html = html.replace(new RegExp(w, 'gm'), function (str, offset, s) {
979          var nai = false;
980          var reg = new RegExp('<[^>]+?' + w + '[^>]*?>|<[^>]*?>' + w + '<\/[^>]*?>', 'gm');
981          var m;
982          while ((m = reg.exec(s)) !== null) {
983            if (offset >= m.index && offset <= m[0].length + m.index - 1) {
984              nai = true;
985            }
986          }
987          return nai ? str : '<span class="elm-word tooltip-trigger js-tooltip-trigger">' + str + '</span>';
988        });
989      }
990      $(this).html(html);
991    });
992  }
993
994  // set mod-word //========//
995  function setWord($target, w) {
996    if (!w) { return; }
997
998    var txt = w['本文'];
999    txt = (txt.length <= 80) ? txt : txt.substr(0, 80) + '...';
1000
1001    var h = `
1002          <div class="mod-word tooltip-wrap js-tooltip-wrap">
1003              <div class="tooltip-contents js-tooltip-contents">
1004                  <div class="inner">
1005                      <dl class="tooltip-dl">
1006                          <dt>${w['タイトル']}</dt>
1007                          <dd>${txt}
1008                          <p><a href="/words/#word_${w['id']}">詳細はこちら</a></p>
1009                          </dd>
1010                      </dl>
1011                  </div>
1012              </div>
1013          </div>        
1014      `;
1015
1016    var $h = $(h);
1017    $('body').append($h);
1018
1019    var pos = $target.offset();
1020    $h.css({
1021      top: pos.top - $h.outerHeight() - 12,
1022      left: pos.left - $h.outerWidth() / 2 + 20
1023    });
1024    $h.fadeIn(400);
1025  }
1026
1027  // click //========//
1028  function setClickWord() {
1029    $(document).on("click", function (e) {
1030      var $target = $(e.target);
1031      $('.mod-word').remove();
1032      $('.elm-word').removeClass('is-active');
1033      //
1034      if ($target.hasClass('elm-word')) {
1035        var w = $target.text();
1036        $target.addClass('is-active');
1037        var obj = words.find(function (v) { return v['タイトル'] === w; });
1038        setWord($target, obj);
1039      }
1040    });
1041  }
1042
1043  // get words //========//
1044  $.ajax({
1045    url: '/mt/mt-data-api.cgi/v6/sites/1/contentTypes/2/data',
1046    method: 'GET',
1047    dataType: 'json',
1048    cache: false,
1049    data: { limit: 10000 }
1050  }).done(function (res) {
1051    if (res.totalResults > 0) {
1052      var items = res.items;
1053      for (let i = 0; i < items.length; i++) {
1054        var item = items[i].data;
1055        var temp = { id: items[i].id };
1056        for (let j = 0; j < item.length; j++) {
1057          var d = item[j];
1058          temp[d.label] = d.data;
1059        }
1060        words.push(temp);
1061      }
1062      searchWord();
1063      setClickWord();
1064    }
1065  });
1066
1067  $(window).on('resize', function () {
1068    $('.mod-word').remove();
1069    $('.elm-word').removeClass('is-active');
1070  });
1071
1072});
1073
1074/* ===================================================================
1075 * newアイコン
1076=================================================================== */
1077window.addEventListener("DOMContentLoaded", () => {
1078  const caseStudySliders = document.querySelectorAll(".top-case-study-sec .case-study-slider .slide-item");
1079  Array.from(caseStudySliders).slice(0, 3).forEach((item => {
1080    item.querySelector(".img-wrap").classList.add("is-new");
1081  }));
1082});

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.