PageSourceSearch

https://kurayoshisuika.com/_administrator/css/default/js/contents.js

js kurayoshisuika.com collected 2026-10-05 08:14:12 UTC 173,630 bytes, 4,078 lines download raw bytes

1/* ----------------------------------------------------------------------------------------
2
3https://cdnjs.cloudflare.com/ajax/libs/protonet-jquery.inview/1.1.2/jquery.inview.min.js(カウンターパーツで使用)
4
5---------------------------------------------------------------------------------------- */
6!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function i(){var b,c,d={height:f.innerHeight,width:f.innerWidth};return d.height||(b=e.compatMode,(b||!a.support.boxModel)&&(c="CSS1Compat"===b?g:e.body,d={height:c.clientHeight,width:c.clientWidth})),d}function j(){return{top:f.pageYOffset||g.scrollTop||e.body.scrollTop,left:f.pageXOffset||g.scrollLeft||e.body.scrollLeft}}function k(){if(b.length){var e=0,f=a.map(b,function(a){var b=a.data.selector,c=a.$element;return b?c.find(b):c});for(c=c||i(),d=d||j();e<b.length;e++)if(a.contains(g,f[e][0])){var h=a(f[e]),k={height:h[0].offsetHeight,width:h[0].offsetWidth},l=h.offset(),m=h.data("inview");if(!d||!c)return;l.top+k.height>d.top&&l.top<d.top+c.height&&l.left+k.width>d.left&&l.left<d.left+c.width?m||h.data("inview",!0).trigger("inview",[!0]):m&&h.data("inview",!1).trigger("inview",[!1])}}}var c,d,h,b=[],e=document,f=window,g=e.documentElement;a.event.special.inview={add:function(c){b.push({data:c,$element:a(this),element:this}),!h&&b.length&&(h=setInterval(k,250))},remove:function(a){for(var c=0;c<b.length;c++){var d=b[c];if(d.element===this&&d.data.guid===a.guid){b.splice(c,1);break}}b.length||(clearInterval(h),h=null)}},a(f).bind("scroll resize scrollstop",function(){c=d=null}),!g.addEventListener&&g.attachEvent&&g.attachEvent("onfocusin",function(){d=null})});
7  
8/* ---------------------------------------------------------------------------------------- 
9
10	共通使用可能アニメーションclass(要素に下記のclassをそれぞれ追加するとアニメーションとして動きます)
11
12---------------------------------------------------------------------------------------- */
13
14(function($){
15  
16  // I~Lの疑似要素(::before)に設定された色が伸びて出現するアニメーションを動かすための子要素をJavascripで追加
17	$(function(){
18		$( '.cparts-animation--bgextend' ).each(function(){
19			$(this).wrapInner('<div class="cparts-animation--bgappearTrigger"></div>');
20		});
21	});
22    
23	// 要素を出現させるための様々なアニメーション
24  function fadeAnime(){
25
26    // A:その場でフェードイン
27    $('.cparts-animation--fadeInTrigger').each(function(){ //cparts-animation--fadeInTriggerというクラス名が要素に入っている場合
28      var elemPos = $(this).offset().top-50;
29      var scroll = $(window).scrollTop();
30      var windowHeight = $(window).height();
31      if (scroll >= elemPos - windowHeight){
32      $(this).addClass('cparts-animation--fadeIn');// 画面内に入ったらcparts-animation--fadeInというクラス名をその要素の追記して動かす
33      }
34      });
35
36    // B:下からフェードイン
37    $('.cparts-animation--fadeUpTrigger').each(function(){ //cparts-animation--fadeUpTriggerというクラス名が要素に入っている場合
38      var elemPos = $(this).offset().top-50;
39      var scroll = $(window).scrollTop();
40      var windowHeight = $(window).height();
41      if (scroll >= elemPos - windowHeight){
42      $(this).addClass('cparts-animation--fadeUp');// 画面内に入ったらcparts-animation--fadeUpというクラス名をその要素の追記して動かす
43      }
44      });
45
46    // C:上からフェードイン
47    $('.cparts-animation--fadeDownTrigger').each(function(){ //cparts-animation--fadeDownTriggerというクラス名が要素に入っている場合
48      var elemPos = $(this).offset().top-50;
49      var scroll = $(window).scrollTop();
50      var windowHeight = $(window).height();
51      if (scroll >= elemPos - windowHeight){
52      $(this).addClass('cparts-animation--fadeDown');// 画面内に入ったらcparts-animation--fadeDownというクラス名をその要素の追記して動かす
53      }
54      });
55
56    // D:左からフェードイン
57    $('.cparts-animation--fadeLeftTrigger').each(function(){ //cparts-animation--fadeLeftTriggerというクラス名が要素に入っている場合
58      var elemPos = $(this).offset().top-50;
59      var scroll = $(window).scrollTop();
60      var windowHeight = $(window).height();
61      if (scroll >= elemPos - windowHeight){
62      $(this).addClass('cparts-animation--fadeLeft');// 画面内に入ったらcparts-animation--fadeLeftというクラス名をその要素の追記して動かす
63      }
64      });
65
66    // E:右からフェードイン
67    $('.cparts-animation--fadeRightTrigger').each(function(){ //cparts-animation--fadeRightTriggerというクラス名が要素に入っている場合
68      var elemPos = $(this).offset().top-50;
69      var scroll = $(window).scrollTop();
70      var windowHeight = $(window).height();
71      if (scroll >= elemPos - windowHeight){
72      $(this).addClass('cparts-animation--fadeRight');// 画面内に入ったらcparts-animation--fadeRightというクラス名をその要素の追記して動かす
73      }
74      });
75
76    // F:拡大しながら表示
77    $('.cparts-animation--zoomInTrigger').each(function(){ //cparts-animation--zoomInTriggerというクラス名が要素に入っている場合
78      var elemPos = $(this).offset().top-50;
79      var scroll = $(window).scrollTop();
80      var windowHeight = $(window).height();
81      if (scroll >= elemPos - windowHeight){
82      $(this).addClass('cparts-animation--zoomIn');// 画面内に入ったらcparts-animation--zoomInというクラス名をその要素の追記して動かす
83      }
84      });
85
86    // G:縮小しながら表示
87    $('.cparts-animation--zoomOutTrigger').each(function(){ //cparts-animation--zoomOutTriggerというクラス名が要素に入っている場合
88      var elemPos = $(this).offset().top-50;
89      var scroll = $(window).scrollTop();
90      var windowHeight = $(window).height();
91      if (scroll >= elemPos - windowHeight){
92      $(this).addClass('cparts-animation--zoomOut');// 画面内に入ったらcparts-animation--zoomOutというクラス名をその要素の追記して動かす
93      }
94      }); 
95
96    // H:ぼかしから徐々に表示
97    $('.cparts-animation--blurTrigger').each(function(){ //cparts-animation--blurTriggerというクラス名がが要素に入っている場合
98      var elemPos = $(this).offset().top-50;
99      var scroll = $(window).scrollTop();
100      var windowHeight = $(window).height();
101      if (scroll >= elemPos - windowHeight){
102      $(this).addClass('cparts-animation--blur');// 画面内に入ったらcparts-animation--blurというクラス名を追記
103      }
104      }); 
105
106    // I:疑似要素(::before)に設定された色が左から右に伸びて出現
107    $( '.cparts-animation--bgLRextendTrigger' ).each(function() { //cparts-animation--bgLRextendTriggerというクラス名がが要素に入っている場合
108      var elemPos = $(this).offset().top-50;
109      var scroll = $(window).scrollTop();
110      var windowHeight = $(window).height();
111      if (scroll >= elemPos - windowHeight) {
112        $(this).addClass( 'cparts-animation--bgLRextend' );// 画面内に入ったらcparts-animation--bgLRextendというクラス名を追記
113      }
114    }); 
115
116    // J:疑似要素(::before)に設定された色が右から左に伸びて出現
117    $( '.cparts-animation--bgRLextendTrigger' ).each(function() { //cparts-animation--bgRLextendTriggerというクラス名がが要素に入っている場合
118      var elemPos = $(this).offset().top-50;
119      var scroll = $(window).scrollTop();
120      var windowHeight = $(window).height();
121      if (scroll >= elemPos - windowHeight) {
122        $(this).addClass( 'cparts-animation--bgRLextend' );// 画面内に入ったらcparts-animation--bgRLextendというクラス名を追記
123      }
124    });
125
126    // K:疑似要素(::before)に設定された色が下から上に伸びて出現
127    $( '.cparts-animation--bgDUextendTrigger' ).each(function() { //cparts-animation--bgDUextendTriggerというクラス名がが要素に入っている場合
128      var elemPos = $(this).offset().top-50;
129      var scroll = $(window).scrollTop();
130      var windowHeight = $(window).height();
131      if (scroll >= elemPos - windowHeight) {
132        $(this).addClass( 'cparts-animation--bgDUextend' );// 画面内に入ったらcparts-animation--bgDUextendというクラス名を追記
133      }
134    });
135
136    // L:疑似要素(::before)に設定された色が上から下に伸びて出現
137    $( '.cparts-animation--bgUDextendTrigger' ).each(function() { //cparts-animation--bgUDextendTriggerというクラス名がが要素に入っている場合
138      var elemPos = $(this).offset().top-50;
139      var scroll = $(window).scrollTop();
140      var windowHeight = $(window).height();
141      if (scroll >= elemPos - windowHeight) {
142        $(this).addClass( 'cparts-animation--bgUDextend' );// 画面内に入ったらcparts-animation--bgUDextendというクラス名を追記
143      }
144    }); 
145
146      // I~Lのアニメーションを動かすための文字列を囲う子要素の動き
147      $( '.cparts-animation--bgappearTrigger' ).each(function() { //cparts-animation--bgappearTriggerというクラス名がが要素に入っている場合
148        var elemPos = $(this).offset().top-50;
149        var scroll = $(window).scrollTop();
150        var windowHeight = $(window).height();
151        if (scroll >= elemPos - windowHeight) {
152          $(this).addClass( 'cparts-animation--bgappear' );// 画面内に入ったらcparts-animation--bgappearというクラス名を追記
153        }
154      });
155  }
156  
157	// 画面をスクロールをしたら動かす
158	$(window).scroll(function () {
159		fadeAnime();
160	});
161	
162	// 画面が読み込まれたらすぐに動かす
163	$(window).on('load', function() {
164		fadeAnime();
165	});
166	
167	
168  // -------------------------------------------------
169  // 文字を1文字づつ出すアニメーション
170  // -------------------------------------------------
171  
172  // 文字を1文字づつ出すアニメーションを動かすための子要素をJavascripで追加
173  $(window).on('load', function () {
174    $('.cparts-animation--appeartextchild').each(function () {
175      $(this).children().addClass('cparts-animation--appeartext');
176    });
177  });
178    
179	// eachTextAnimeにcparts-animation--appeartextというクラス名を付ける定義
180  function EachTextAnimeControl() {
181    $('.cparts-animation--appeartext').each(function () {
182      var elemPos = $(this).offset().top - 50;
183      var scroll = $(window).scrollTop();
184      var windowHeight = $(window).height();
185      if (scroll >= elemPos - windowHeight) {
186        $(this).addClass('cparts-animation--appeartext__text');
187
188      }
189    });
190  }
191
192  // 画面をスクロールをしたら動かす
193  $(window).on('scroll',function () {
194    EachTextAnimeControl();
195  });
196
197  // 画面が読み込まれたらすぐに動かす
198  $(window).on('load', function () {
199    $('.cparts-animation--appeartextchild').each(function () {
200      $(this).addClass('cparts-animation--appeartext__text');
201    });
202    //spanタグを追加する
203    var element = $('.cparts-animation--appeartext');
204    element.each(function () {
205      var text = $(this).text();
206      var textbox = "";
207      text.split('').forEach(function (t, i) {
208        if (t !== " ") {
209          if (i < 10) {
210            textbox += '<span style="animation-delay:.' + i + 's;">' + t + '</span>';
211          } else {
212            var n = i / 10;
213            textbox += '<span style="animation-delay:' + n + 's;">' + t + '</span>';
214          }
215
216        } else {
217          textbox += t;
218        }
219      });
220      $(this).html(textbox);
221    });
222
223    EachTextAnimeControl();
224  });
225
226}(jQuery));
227
228
229
230/* ---------------------------------------------------------------------------------------- 
231
232	個別Japascript
233
234---------------------------------------------------------------------------------------- */
235(function($) {$(function(){
236  
237  $(window).on('load', function() {
238    
239    /* -------------------------------------------------------
240      2017年リニューアル
241    -------------------------------------------------------- */
242    // 画像とテキスト(スクロール付き)
243    var boxheight = $('.parts_img_type47_photo').height();
244    $('.parts_img_type47_text_scrBox').css('height', boxheight - 72);
245
246    $(window).resize(function(){
247      var w = $(window).width();
248      var x = 767;
249      var boxheight = $('.parts_img_type47_photo').height();
250
251      if (w <= x) {
252        $('.parts_img_type47_text_scrBox').css('height', '');
253      } else {
254        $('.parts_img_type47_text_scrBox').css('height', boxheight - 72);
255      }
256
257    });
258
259    // よくある質問(クリックで回答を表示)
260    $('.parts_text_type17 dd').css('display', 'none');
261    $('.parts_text_type17 dt').on('click', function() {
262      $(this).next().slideToggle();
263    });
264
265    // Indeed募集一覧
266    $(function(){
267      $('.cms_col_3').eq(0);
268      $('.cms_col_3').eq($('.cms_col_3').length-1);
269
270      for(var i=0; i<$('.cms_col_3').length; i++){
271          if(i%3===0){
272              $('.cms_col_3').eq(i).addClass('rigth_ntn');
273          }else if(i%3===2){
274              $('.cms_col_3').eq(i).addClass('left_ntn');
275          }
276      }
277    });
278    
279    /* -------------------------------------------------------
280      2020年追加
281    -------------------------------------------------------- */
282    // テーブルブロック追加
283    $('.cparts-cell-block').not('.cparts-cell-block + .cparts-cell-block').each(function(){
284      const $targets = $(this).nextUntil(':not(.cparts-cell-block)').addBack(); // 2025年jQueryのバージョンアップに伴う修正
285      if ($targets.length > 1) {
286        $targets.wrapAll('<div class="cparts-table-block"></div>'); // 2025年jQueryのバージョンアップに伴う修正
287      }
288    });
289    $(".cparts-table-block:empty").remove();
290
291    // インライン親ブロック追加
292    $('.cparts-inline-block').not('.cparts-inline-block + .cparts-inline-block').each(function(){
293      const $targets = $(this).nextUntil(':not(.cparts-inline-block)').addBack(); // 2025年jQueryのバージョンアップに伴う修正
294      if ($targets.length > 1) {
295        $targets.wrapAll('<div class="cparts-col-block"></div>'); // 2025年jQueryのバージョンアップに伴う修正
296      }
297    });
298    $(".cparts-col-block:empty").remove();
299
300    // 公開サイトのみ適用
301    if($('#published').length>0){
302      
303      $('html').css('overflow-x','hidden');
304
305      // タイトルをクリックして詳細が開くパーツ
306      $('.cparts-var03-type12a').each(function(){
307          $(this).nextAll().each(function(){
308              if($(this).hasClass('cparts-var03-type12c')) return false;
309              $(this).addClass('cparts-var03-type12b');
310              $(this).hide();
311          });
312      });
313      $('.cparts-var03-type12a').next('.cparts-var03-type12b').addClass('cparts-var03-type12b-first');
314      $('.cparts-var03-type12c').prev('.cparts-var03-type12b').addClass('cparts-var03-type12b-last');
315      $('.cparts-var03-type12c').hide();
316      $('.cparts-var03-type12a').off().on('click', function() {
317          $(this).find('.cparts-icon-block').toggleClass('cparts-icon-block-open');
318          $(this).nextAll().each(function(){
319              if($(this).hasClass('cparts-var03-type12c')) return false;
320              $(this).slideToggle(500);
321              setTimeout(function() {
322              $('.cparts-var03-type12b').css('overflow','visible');
323              }, 2000);
324          $('.cparts-var03-type12a').toggleClass('cparts-var03-type12a-open');
325          });
326      });
327
328
329      // 列1個のコンテンツパーツ
330      var left = 0;
331      var maxHeight = 0;
332      $('.cparts-col2-block').each(function(i, box) {
333          if(i===0){
334              left = $(this).offset().left;
335              start = 0;
336          } else {
337            if(left === $(this).offset().left || $('.cparts-col2-block').length == i+1) {
338                    if( $('.cparts-col2-block').length == i+1 ){
339                        i++;
340                        if(maxHeight < $(this).find('.col2-height').height()) maxHeight = $(this).find('.col2-height').height();
341                    }
342                    var count = i - start;
343                for(ii=(i-1);ii>=start;ii--) {
344                    $('.cparts-col2-block').eq(ii).find('.col2-height').height(maxHeight);
345                    if (window.matchMedia( "(min-width: 992px)" ).matches) {
346                        if(count === 1) $('.cparts-col2-block').eq(ii).addClass('cparts-left-ntn');
347                        if(count === 2) $('.cparts-col2-block').eq(ii).addClass('cparts-rigth-ntn');
348                        count--;
349                    }
350                    if (window.matchMedia( "(max-width: 991px) and (min-width: 768px)" ).matches) {
351                        if(count === 1) $('.cparts-col2-block').eq(ii).addClass('cparts-left-ntn');
352                        if(count === 2) $('.cparts-col2-block').eq(ii).addClass('cparts-rigth-ntn');
353                        count--;
354                    }
355                }
356                maxHeight=0;
357                start = i;
358            }
359        }
360        if(maxHeight < $(this).find('.col2-height').height()) maxHeight = $(this).find('.col2-height').height();
361      });
362
363      var left = 0;
364      var maxHeight = 0;
365      $('.cparts-col3-block').each(function(i, box) {
366        //最初の1つ目
367        if(i===0){
368            left = $(this).offset().left;
369            start = 0;
370        } else {
371            // 1つめと同じLeftt値か最後のエレメントなら
372            if(left === $(this).offset().left || $('.cparts-col3-block').length == i+1) {
373                if (left === $(this).offset().left && $('.cparts-col3-block').length == i+1) $('.cparts-col3-block').eq(i).addClass('cparts-left-ntn');
374                    if( $('.cparts-col3-block').length == i+1 ){
375                        if(maxHeight < $(this).find('.cparts-col3-height').height()) maxHeight = $(this).find('.cparts-col3-height').height();
376                        i++;
377                   }
378                var count = i - start;
379                for(ii=(i-1);ii>=start;ii--) {
380                    $('.cparts-col3-block').eq(ii).find('.cparts-col3-height').height(maxHeight);
381                    if (window.matchMedia( "(min-width: 992px)" ).matches) {
382                        if(count === 1) $('.cparts-col3-block').eq(ii).addClass('cparts-left-ntn');
383                        if(count === 2) $('.cparts-col3-block').eq(ii).addClass('cparts-center-ntn');
384                        if(count === 3) $('.cparts-col3-block').eq(ii).addClass('cparts-rigth-ntn');
385                        count--;
386                    }
387                    if (window.matchMedia( "(max-width: 991px) and (min-width: 768px)" ).matches) {
388                        if(count === 1) $('.cparts-col3-block').eq(ii).addClass('cparts-left-ntn');
389                        if(count === 2) $('.cparts-col3-block').eq(ii).addClass('cparts-rigth-ntn');
390                        count--;
391                    }
392                }
393                maxHeight=0;
394                start = i;
395            }
396        }
397        if(maxHeight < $(this).find('.cparts-col3-height').height()) maxHeight = $(this).find('.cparts-col3-height').height();
398      });
399
400      var left = 0;
401      var maxHeight = 0;
402      $('.cparts-col4-block').each(function(i, box) {
403          if(i===0){
404              left = $(this).offset().left;
405              start = 0;
406          } else {
407            if(left === $(this).offset().left || $('.cparts-col4-block').length == i+1) {
408                    if( $('.cparts-col4-block').length == i+1 ){
409                        i++;
410                        if(maxHeight < $(this).find('.col4-height').height()) maxHeight = $(this).find('.col4-height').height();
411                    }
412                    var count = i - start;
413                for(ii=(i-1);ii>=start;ii--) {
414                    $('.cparts-col4-block').eq(ii).find('.col4-height').height(maxHeight);
415                    if (window.matchMedia( "(min-width: 992px)" ).matches) {
416                        if(count === 1) $('.cparts-col4-block').eq(ii).addClass('cparts-left-ntn');
417                        if(count === 2) $('.cparts-col4-block').eq(ii).addClass('cparts-l-center-ntn');
418                        if(count === 3) $('.cparts-col4-block').eq(ii).addClass('cparts-r-center-ntn');
419                        if(count === 4) $('.cparts-col4-block').eq(ii).addClass('cparts-rigth-ntn');
420                        count--;
421                    }
422                    if (window.matchMedia( "(max-width: 991px) and (min-width: 768px)" ).matches) {
423                        if(count === 1) $('.cparts-col4-block').eq(ii).addClass('cparts-left-ntn');
424                        if(count === 2) $('.cparts-col4-block').eq(ii).addClass('cparts-rigth-ntn');
425                        count--;
426                    }
427                }
428                maxHeight=0;
429                start = i;
430            }
431        }
432        if(maxHeight < $(this).find('.col4-height').height()) maxHeight = $(this).find('.col4-height').height();
433      });
434
435      var left = 0;
436      var maxHeight = 0;
437      $('.cparts-col5-block').each(function(i, box) {
438          if(i===0){
439              left = $(this).offset().left;
440              start = 0;
441          } else {
442            if(left === $(this).offset().left || $('.cparts-col5-block').length == i+1) {
443                    if( $('.cparts-col5-block').length == i+1 ){
444                        i++;
445                        if(maxHeight < $(this).find('.col5-height').height()) maxHeight = $(this).find('.col5-height').height();
446                    }
447                    var count = i - start;
448                for(ii=(i-1);ii>=start;ii--) {
449                    $('.cparts-col5-block').eq(ii).find('.col5-height').height(maxHeight);
450                    if (window.matchMedia( "(min-width: 992px)" ).matches) {
451                        if(count === 1) $('.cparts-col5-block').eq(ii).addClass('cparts-left-ntn');
452                        if(count === 2) $('.cparts-col5-block').eq(ii).addClass('cparts-l-center-ntn');
453                        if(count === 3) $('.cparts-col5-block').eq(ii).addClass('cparts-center-ntn');
454                        if(count === 4) $('.cparts-col5-block').eq(ii).addClass('cparts-r-center-ntn');
455                        if(count === 5) $('.cparts-col5-block').eq(ii).addClass('cparts-rigth-ntn');
456                        count--;
457                    }
458                    if (window.matchMedia( "(max-width: 991px) and (min-width: 768px)" ).matches) {
459                        if(count === 1) $('.cparts-col5-block').eq(ii).addClass('cparts-left-ntn');
460                        if(count === 2) $('.cparts-col5-block').eq(ii).addClass('cparts-rigth-ntn');
461                        count--;
462                    }
463                }
464                maxHeight=0;
465                start = i;
466            }
467        }
468        if(maxHeight < $(this).find('.col5-height').height()) maxHeight = $(this).find('.col5-height').height();
469      });
470
471      if (window.matchMedia( "(max-width: 991px)" ).matches) {
472        $('.cparts-img-type12a').each(function(i, box) {
473                var maxHeight = 0;
474                $(box).find('.cparts-txt-block').each(function() {
475                    if ($(this).height() > maxHeight) maxHeight = $(this).height();
476                });
477                $(box).find('.cparts-txt-block').height(maxHeight);
478        });
479        $('.cparts-img-type12b').each(function(i, box) {
480                var maxHeight = 0;
481                $(box).find('.cparts-txt-block').each(function() {
482                    if ($(this).height() > maxHeight) maxHeight = $(this).height();
483                });
484                $(box).find('.cparts-txt-block').height(maxHeight);
485        });
486      }
487
488      // マウスオーバーでテキスト表示
489      $('.cparts-var03-type19a').children('div').each(function(){
490          var k = $(this).find('.cparts-img-block').height();
491      $(this).find('.cparts-body-block').css('height',k+'px');
492      });
493      $('.cparts-var03-type19b').children('div').each(function(){
494          var k = $(this).find('.cparts-img-block').height();
495      $(this).find('.cparts-body-block').css('height',k+'px');
496      });
497
498      // メインビジュアル
499      $(".cparts-var03-type22").find(".cparts-body-block").each(function(){
500          $(this).addClass('cparts-move');
501          $(this).parents('.cparts-var03-type22').find('.cparts-img-block img').addClass('cparts-img-in');
502      });
503      $(".cparts-var03-type23 .cparts-body-block").each(function(){
504          $(this).addClass('cparts-fade-in');
505      });
506
507    }// 公開サイトのみ適用終了
508    
509    // 流れ(ライン)ブロック追加
510    var connectorBlock = $('<div class="cparts-connector-block"></div>');
511    $('.cparts-connector--curve').not('.cparts-connector--curve+.cparts-connector--curve').each(function(){
512      $(this).nextUntil(':not(.cparts-connector--curve)').addBack() // 2025年jQueryのバージョンアップに伴う修正.wrapAll(connectorBlock);
513    });
514    $(".cparts-connector-block:empty").remove();
515    
516    var $items = $('.cparts-var03-type24');
517    var group = [];
518
519    $items.each(function(i, el) {
520      var $el = $(el);
521
522      // 直前が同じクラスかどうかでグループ判定
523      if (i > 0 && $items.eq(i - 1).next()[0] === el) {
524        group.push($el);
525      } else {
526        // 新しいグループ開始
527        if (group.length) {
528          processGroup(group);
529        }
530        group = [$el];
531      }
532    });
533    // 最後のグループ処理
534    if (group.length) {
535      processGroup(group);
536    }
537    function processGroup(group) {
538      $.each(group, function(idx, $el) {
539        if ((idx + 1) % 2 === 0) {
540          $el.addClass('cparts-curve--even');   // 奇数番目
541        }
542      });
543      group[group.length - 1].addClass('cparts-curve--last'); // 最後
544    }
545    
546    // タブ切り替え
547    // 最初は全部消す
548    $('.cparts-var03-type26b').hide();
549    $('.cparts-var03-type26c').hide();
550    $('.cparts-inner').hide();
551    var edit_site = $('#cms_contents_area').length;
552    if(edit_site === 0) {
553        $('.cparts-var03-type26d').hide()
554        $('.cparts-var03-type26a .cparts-notes-block').hide()
555    };
556    // 見出しの処理
557    $('.cparts-var03-type26a').each(function(){
558        // 自身のliに対して処理を行う
559        $(this).find('ol li').each(function(i){
560            // クラス名を追加する
561            $(this).addClass('cparts-select' + (i+1));
562            var li = $(this).length;
563            $(this).css('width','calc(100% / '+li+')');
564            // 最初の要素にはselect-on
565            if(i === 0) $(this).addClass('cparts-select-on');
566            // クリックイベントを追加
567            $(this).off().on('click', function(event) {
568                // 自分のグループのselect-onを削除
569                $(this).parents('.cparts-var03-type26a').find('.cparts-select-on').removeClass('cparts-select-on');
570                // 自分にselect-onを追加
571                $(this).addClass('cparts-select-on');
572                var show_flag = 0; // 表示フラグ 1の間は表示する
573                var show_class = $(this).attr('class').replace(' cparts-select-on',''); // 表示するクラス名
574                $(this).parents('.cparts-var03-type26a').nextAll().each(function(index, el) {
575                    if($(this).hasClass('cparts-var03-type26d')) return false;
576                    $(this).hide();
577                });
578                $(this).parents('.cparts-var03-type26a').nextAll().each(function(index, el) {
579                    if($(this).hasClass('cparts-var03-type26d')) return false;
580                    if($(this).hasClass('cparts-var03-type26b') && $(this).hasClass(show_class) && show_flag === 0) {
581                        show_flag = 1;
582                        if(edit_site)
583                            $(this).fadeIn(1000);
584                    } else if($(this).hasClass('cparts-var03-type26c') && $(this).hasClass(show_class) && show_flag === 1) {
585                        show_flag = 0;
586                        if(edit_site)
587                            $(this).fadeIn(1000);
588                    } else if(show_flag === 1) {
589                        $(this).fadeIn(1000);
590                    }
591                });
592                return false;
593            });
594        });
595        var index = 1;
596        $(this).nextAll().each(function() {
597            if($(this).hasClass('cparts-var03-type26d')) return false;
598            if($(this).hasClass('cparts-var03-type26b')) {
599                $(this).addClass('cparts-select'+index);
600                $(this).attr('data','cparts-select'+index);
601                if(index === 1 && edit_site) $(this).show();
602                else $(this).hide();
603            } else if($(this).hasClass('cparts-var03-type26c')) {
604                $(this).addClass('cparts-select'+index);
605                $(this).attr('data','cparts-select'+index);
606                if(index === 1 && edit_site) $(this).show();
607                else $(this).hide();
608                index++;
609            } else {
610                $(this).addClass('cparts-inner');
611                if(index === 1) $(this).show();
612                else $(this).hide();
613            }
614        });
615      });
616
617     $('.cparts-var03-type26a .cparts-notes-block p').off().on('click', function() {
618      if($(this).hasClass('cparts-all-open')){
619        $(this).html('タブ内容を展開する(公開サイトには表示されません)');
620        $(this).removeClass('cparts-all-open');
621        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-var03-type26b').hide();
622        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-var03-type26c').hide();
623        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-inner').hide();
624        $(this).parents('.cparts-var03-type26a').next('.cparts-var03-type26b.cparts-select1').nextAll().each(function() {
625            if($(this).hasClass('cparts-var03-type26c')) return false;
626            $(this).show();
627        });
628        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-var03-type26b.cparts-select1').show();
629        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-var03-type26c.cparts-select1').show();
630        $('.cparts-var03-type26a ol li').removeClass('cparts-select-on');
631        $('.cparts-select1').addClass('cparts-select-on');
632      }else{
633        $(this).html('プレビューを表示(公開サイトには表示されません)');
634        $(this).addClass('cparts-all-open');
635        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-var03-type26b').show();
636        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-var03-type26c').show();
637        $(this).parents('.cparts-var03-type26a').nextAll('.cparts-inner').show();
638        }
639      });  
640    
641    /* -------------------------------------------------------
642      2021年追加
643    -------------------------------------------------------- */
644    // 画像/見出し・背景付テキスト_ver.2・見出し・背景付テキスト/画像_ver.2:上余白調整
645    if (window.matchMedia( "(min-width: 768px)" ).matches) {
646      $(window)// .load() 削除(2025年jQueryのバージョンアップに伴う修正)
647$(window).on('load', function () {
648        $('.parts_img_type37').each(function() {
649          var himg = $(this).find('img').height();
650          var h = $(this).find('.parts_img_type37_text').height();
651          var m = h - himg +24;
652          if (himg < h) {
653            $(this).find('img').css('margin-top', m+'px');
654          }
655        });
656
657        $('.parts_img_type36').each(function() {
658          var himgb = $(this).find('img').height();
659          var hb = $(this).find('.parts_img_type36_text').height();
660          var mb = hb - himgb +24;
661          if (himgb < hb) {
662            $(this).find('img').css('margin-top', mb+'px');
663          }
664        });
665      });
666    }
667    
668    // 【共通】スライド
669    //スライド用タグ追加
670    // スライダー構造を追加(毎回HTMLで生成)
671    $('.cparts-slide-block').not('.cparts-slide-block + .cparts-slide-block').each(function () {
672      const $targets = $(this).nextUntil(':not(.cparts-slide-block)').addBack(); // 2025年jQueryのバージョンアップに伴う修正
673      if ($targets.length > 1) {
674        $targets.wrapAll(
675          '<div class="cparts-slideview-block lay-margin-b--3">' +
676            '<div class="cparts-slider-block lay-row lay-flex-nowrap"></div>' +
677            '<span class="cparts-prevbtn-block dec-bg--primary"></span>' +
678            '<span class="cparts-nextbtn-block dec-bg--primary"></span>' +
679          '</div>'
680        ); // 2025年jQueryのバージョンアップに伴う修正
681      }
682    });
683    $('.cparts-slider-block:empty').remove();
684
685    // PCでの列数指定(ラップ後に正しく初期化)
686    $('.cparts-slider-block').each(function () {
687      const $first = $(this).children('.cparts-slide-block:first-child');
688
689      if ($first.hasClass('cparts-pcrow--1')) {
690        $(this).children('.cparts-slide-block').addClass('lay-col12-md-12');
691        $(this).addClass('cparts-sliderow-1');
692      } else if ($first.hasClass('cparts-pcrow--2')) {
693        $(this).children('.cparts-slide-block').addClass('lay-col12-md-6');
694        $(this).addClass('cparts-sliderow-2');
695      } else if ($first.hasClass('cparts-pcrow--3')) {
696        $(this).children('.cparts-slide-block').addClass('lay-col12-md-4');
697        $(this).addClass('cparts-sliderow-3');
698      } else {
699        $(this).children('.cparts-slide-block').addClass('lay-col12-md-3');
700        $(this).addClass('cparts-sliderow-4');
701      }
702    });
703
704    // スライダー移動
705    let cancelFlag = 0;
706
707    $('.cparts-nextbtn-block').on('click', function () {
708      if (cancelFlag === 0) {
709        cancelFlag = 1;
710        const $slider = $(this).siblings('.cparts-slider-block');
711        const slidePW = $(this).parent().width(); // 表示範囲
712        const slideSW = $slider.get(0).scrollWidth - 30; // スライダー全体の幅
713        const slideMW = slidePW - slideSW; // å·®
714        const $firstSlide = $slider.children('.cparts-slide-block:first-child');
715        const slideW = $firstSlide.innerWidth();
716        const slideM = parseInt($firstSlide.css('margin-left'), 10);
717
718        if (slideMW < 0 && slideMW < -slideM) {
719          $firstSlide.animate({ marginLeft: slideM - slideW }, 100, 'linear');
720        }
721
722        setTimeout(() => {
723          cancelFlag = 0;
724        }, 500);
725      }
726    });
727
728    $('.cparts-prevbtn-block').on('click', function () {
729      if (cancelFlag === 0) {
730        cancelFlag = 1;
731        const $slider = $(this).siblings('.cparts-slider-block');
732        const $firstSlide = $slider.children('.cparts-slide-block:first-child');
733        const slideW = $firstSlide.innerWidth();
734        const slideM = parseInt($firstSlide.css('margin-left'), 10);
735
736        if (slideM < 0) {
737          $firstSlide.animate({ marginLeft: slideM + slideW }, 100, 'linear');
738        }
739
740        setTimeout(() => {
741          cancelFlag = 0;
742        }, 500);
743      }
744    });
745
746    // リサイズ時にマージンをリセット(PCだけ)
747    $(window).on('resize', function () {
748      if ($(window).width() >= 768) {
749        $('.cparts-slider-block').children('.cparts-slide-block:first-child').css({ marginLeft: 0 });
750      }
751    });
752    //iPadの横揺れ防止
753      if($('body > div#cms_contents_area').length){
754        $('body').css('overflow-x','');
755      } else if($('.cparts-slide-block').length) {
756        $('body').css('overflow-x','hidden');
757      }
758    
759    // 【共通】リストへのclass追加
760    $('.cparts-list-block > ul').addClass('cparts-list-ul--01');
761    $('.cparts-list-block > * > li > ul').addClass('cparts-list-ul--02');
762    $('.cparts-list-block > * > li > * > li > ul').addClass('cparts-list-ul--03');
763    $('.cparts-list-block > * > li > * > li > * > li > ul').addClass('cparts-list-ul--04');
764    $('.cparts-list-block > * > li > * > li > * > li > * > li > ul').addClass('cparts-list-ul--05');
765    $('.cparts-list-block > * > li > * > li > * > li > * > li > * > li > ul').addClass('cparts-list-ul--06');
766    $('.cparts-list-block > ol').addClass('cparts-list-ol--01');
767    $('.cparts-list-block > * > li > ol').addClass('cparts-list-ol--02');
768    $('.cparts-list-block > * > li > * > li > ol').addClass('cparts-list-ol--03');
769    $('.cparts-list-block > * > li > * > li > * > li > ol').addClass('cparts-list-ol--04');
770    $('.cparts-list-block > * > li > * > li > * > li > * > li > ol').addClass('cparts-list-ol--05');
771    $('.cparts-list-block > * > li > * > li > * > li > * > li > * > li > ol').addClass('cparts-list-ol--06');
772    $('.cparts-list-block > * > li').addClass('cparts-list-li--01');
773    $('.cparts-list-block > * > li > * > li').addClass('cparts-list-li--02');
774    $('.cparts-list-block > * > li > * > li > * > li').addClass('cparts-list-li--03');
775    $('.cparts-list-block > * > li > * > li > * > li > * > li').addClass('cparts-list-li--04');
776    $('.cparts-list-block > * > li > * > li > * > li > * > li > * > li').addClass('cparts-list-li--05');
777    $('.cparts-list-block > * > li > * > li > * > li > * > li > * > li > * > li').addClass('cparts-list-li--06');
778
779    // 【目次】装飾用class追加
780    $('.cparts-id282--02 .cparts-list-li--01, .cparts-id282--03 .cparts-list-li--01').addClass('dec-bg-pe--primary dec-line--grey');
781    $('.cparts-id282--02 ol > .cparts-list-li--02, .cparts-id282--02 ol > .cparts-list-li--03, .cparts-id282--03 ol > .cparts-list-li--02, .cparts-id282--03 ol > .cparts-list-li--03').addClass('dec-txt-pe--dark');
782    $('.cparts-id282--02 ul > .cparts-list-li--02, .cparts-id282--02 ul > .cparts-list-li--03, .cparts-id282--03 ul > .cparts-list-li--02, .cparts-id282--03 ul > .cparts-list-li--03').addClass('dec-line-pe--dark');
783    
784    // テキスト縦書き
785    $('div[class*="cparts-id294"]').each(function() {
786      var w = $(this).parent('div').width();
787      $(this).find('.cparts-txt-block').css('width', w+'px');
788    });
789    window.addEventListener( 'resize', function() {
790      $('div[class*="cparts-id294"]').each(function() {
791        var w = $(this).parent('div').width();
792        $(this).find('.cparts-txt-block').css('width', w+'px');
793      });
794    }, false );
795
796    // ステップリスト
797    $('div[class*="cparts-id297"]').each(function() {
798      $(this).append('<div class="cparts--id295-border dec-bg--light"></div>');  
799    });
800    
801    // タイトル付き枠線
802    if ($('[class*="cparts-id299"]').length) {
803      $('div[class*="cparts-id299"]').each(function() {
804        var height = $(this).find('.cparts-head-block').height();
805        var t = height/2;
806        var m = height/2 + 30;
807        $(this).find('.cparts-body-block').css('padding-top', t + 20 + 'px');
808        $(this).find('.cparts-head-block').css('top', '-'+t+'px');
809        $(this).css('margin-top', m+'px');
810        if ($(this).find('h3').css('color') == 'rgb(255, 255, 255)') {
811          $(this).find('h3').addClass('dec-txt--primary');
812        }
813      });
814    }
815    
816    // バナー01
817    $('div[class*="cparts-id311"]').each(function() {
818      if ($(this).find('.cparts-body-block').outerWidth() < 200) {
819          $(this).addClass('cparts-id311-column');
820      }
821      var height = $(this).find('.cparts-body-block').outerHeight();
822      if(height > 210){
823        $(this).find('.cparts-img-block').find('img').css('height', height+'px');
824        $(this).find('.cparts-img-block').css('height', height+'px');
825      }
826      var color = $(this).find('.dec-bg--primary').css('color');
827      $(this).find('h4').css('color', color);
828    });
829    
830    // バナー02
831    $('.cparts-id315--02').each(function() {
832      var col = $(this).find('.dec-bg--dark').css('background-color');
833      var c = String(col).slice(0,-1);
834      var color = String(c).slice(3);
835      $(this).find('.cparts-body-block').css({'cssText': 'background-color: rgba'+color+',.75) !important'});
836    });
837    $('.cparts-id315--01').each(function() {
838      var color = $(this).find('.dec-bg--primary').css('color');
839      $(this).find('h4').css('color', color);
840    });
841    $('div[class*="cparts-id315"]').each(function() {
842      if ($(this).find('.cparts-img-block').outerWidth() < 300) {
843          $(this).addClass('cparts-id315-column');
844      }
845      var height = $(this).find('.cparts-body-block').outerHeight() +30;
846        $(this).find('.cparts-img-block').find('img').css('height', height+'px');
847        $(this).find('.cparts-img-block').css('height', height+'px');
848      if ($(this).find('h4').css('color') == $(this).find('.dec-bg--primary').css('background-color')) {
849        $(this).find('h4').css('color','#fff');
850      }
851    });
852
853    // バナー03
854    $('div[class*="cparts-id317"]').each(function() {
855      if ($(this).find('.cparts-txt-block').outerWidth() < 150) {
856          $(this).addClass('cparts-id317-column');
857      }
858      var height = $(this).find('.cparts-txt-block').outerHeight();
859      // if(height > 250){
860        $(this).find('.cparts-img-block').find('img').css('height', height+'px');
861        $(this).find('.cparts-img-block').css('height', height+'px');
862      // }
863      var color = $(this).find('.dec-bg--primary').css('color');
864      $(this).find('h4').css('color', color);
865    });
866
867    // バナー04
868    $('div[class*="cparts-id318"]').each(function() {
869      if ($(this).children('div').outerWidth() < 250) {
870          $(this).addClass('cparts-id318-column');
871      }
872    });
873    $('.cparts-id318--01').each(function() {
874      $(this).find('.cparts-body-block').attr('style', '');
875    });
876    
877    /* -------------------------------------------------------
878      2022年追加
879    -------------------------------------------------------- */
880    // メイン画像_ver.19
881    var partscol1 = $('.cparts-id402').find('.dec-bg--primary').css('background-color');
882    (function () {
883      var unit = 100,
884          canvasList,
885          drawInfo = {},
886          colorList = [],
887          innerFontColorList = [],
888          innerBgColorList = [];
889
890      /**
891       * Init function.
892       * 
893       * Initialize variables and begin the animation.
894       */
895      function init() {
896        drawInfo.seconds = 0;
897        drawInfo.t = 0;
898
899        // Get all canvas elements
900        canvasList = document.querySelectorAll('.cparts-dec--wavebar');
901
902        // Initialize each canvas
903        Array.prototype.forEach.call(canvasList, 
904          function(canvas, index){
905            var canvasDataSet = canvas.dataset,
906                inner = canvas.nextElementSibling,
907                innerDataSet;
908            canvas.style.height = String(canvas.height / devicePixelRatio) + "px";
909
910            if ($(canvas).hasClass('dec-wavebar__01')) {
911            canvas.width = document.documentElement.clientWidth;
912            canvas.width *= devicePixelRatio;
913            canvas.height = canvas.width * .04;
914            canvas.height *= devicePixelRatio;
915
916            } else if ($(canvas).hasClass('dec-wavebar__02')){
917              canvas.width = document.documentElement.clientWidth;
918              canvas.width *= devicePixelRatio;
919              canvas.height = canvas.width * .04;
920              canvas.height = canvas.height * devicePixelRatio +75;
921            } else if ($(canvas).hasClass('dec-wavebar__03')){
922              canvas.width = document.documentElement.clientWidth;
923              canvas.width = canvas.width * devicePixelRatio / 2;
924              canvas.height = canvas.width * .04 + 20;
925              canvas.height = canvas.height * devicePixelRatio +150;
926            }
927            canvas.contextCache = canvas.getContext("2d");
928
929            // Add color
930            if ($(canvas).hasClass('cparts-dec--wavebar')) {
931            colorList.push([partscol1]);
932            }
933          }
934        );
935        update();
936      }
937      var timer = null;
938      function update() {
939        // Each canvas
940        Array.prototype.forEach.call(canvasList, 
941          function(canvas, index){
942            draw(canvas, colorList[index]);
943          }
944        );
945        // 共通の描画情報の更新
946        drawInfo.seconds = drawInfo.seconds + .014;
947        drawInfo.t = drawInfo.seconds*Math.PI;
948        // Re-call
949        if ($('.siteblock-header').find('.sitedesign-canvas-animetion').hasClass('sitedesign-canvas-animetion-on')){
950        timer = setTimeout(update, 50);
951        }
952      }
953      clearTimeout(timer);
954      /**
955       * Draw animation function.
956       * 
957       * This function draws one frame of the animation, waits 20ms, and then calls
958       * itself again.
959       */
960      function draw(canvas, color) {
961        // 対象のcanvasのコンテキストを取得
962        var context = canvas.contextCache;
963        // キャンバスの描画をクリア
964        context.clearRect(0, 0, canvas.width, canvas.height);
965
966        //波を描画
967        if ($(canvas).hasClass('cparts-dec--wavebar')) {
968          if ($(canvas).hasClass('dec-wavebar__01')) {
969            drawWave(canvas, color[0], 1, 1, 800);
970          } else if ($(canvas).hasClass('dec-wavebar__02')){
971            drawWave(canvas, color[0], 0.3, 1.2, 300);
972            drawWave(canvas, color[2], 0.4, 1.4, 100);
973          } else if ($(canvas).hasClass('dec-wavebar__03')){
974            drawWave(canvas, color[0], 0.6, 0.9, 100);
975          }
976        }
977      }
978      /**
979      * 波を描画
980      * drawWave(キャンバス, 色, 不透明度, 波の幅のzoom, 波の開始位置の遅れ)
981      */
982      function drawWave(canvas, color, alpha, zoom, delay) {
983        var context = canvas.contextCache;
984        context.fillStyle = color;
985        context.globalAlpha = alpha;
986
987        context.beginPath(); //パスの開始
988        drawSine(canvas, drawInfo.t / 0.5, zoom, delay);
989        context.lineTo(canvas.width + 10, canvas.height + 10); //パスをCanvasの右下へ
990        context.lineTo(0, canvas.height); //パスをCanvasの左下へ
991        context.closePath() //パスを閉じる
992        context.fill(); //塗りつぶす
993      }
994      /**
995       * Function to draw sine
996       * 
997       * The sine curve is drawn in 10px segments starting at the origin. 
998       * drawSine(キャンバス, 時間, 波の幅のzoom, 波の開始位置の遅れ)
999       */
1000      function drawSine(canvas, t, zoom, delay) {
1001        var xAxis = Math.floor(canvas.height/2);
1002        var yAxis = 0;
1003        var context = canvas.contextCache;
1004        // Set the initial x and y, starting at 0,0 and translating to the origin on
1005        // the canvas.
1006        var x = t; //時間を横の位置とする
1007        var y = Math.sin(x)/zoom;
1008        context.moveTo(yAxis, unit*y+xAxis); //スタート位置にパスを置く
1009
1010        // Loop to draw segments (横幅の分、波を描画)
1011        for (i = yAxis; i <= canvas.width + 10; i += 10) {
1012          if ($(canvas).hasClass('dec-wavebar__01')) {
1013          x = t+(-yAxis+i)/unit/zoom+40;
1014          y = Math.sin(x - delay)/4;
1015          } else if ($(canvas).hasClass('dec-wavebar__02')){
1016          x = t+(-yAxis+i)/unit/zoom+10;
1017          y = Math.sin(x - delay)/2;
1018          } else if ($(canvas).hasClass('dec-wavebar__03')){
1019          x = t+(-yAxis+i)/unit/zoom+1000;
1020          y = Math.sin(x - delay)/1;
1021          }
1022          context.lineTo(i, unit*y+xAxis);
1023
1024        }
1025      }
1026      init();
1027    // });
1028    })();
1029    
1030    /* -------------------------------------------------------
1031      2023年追加
1032    -------------------------------------------------------- */
1033    // id457の斜線時の色変更
1034    $('.cparts-id457.cparts-h2decoration--linediagonal').each(function(index) {
1035      var uniqueid457Class = 'id457-addclass-' + index;
1036      $(this).addClass(uniqueid457Class);
1037
1038      var col = $(this).css('border-color');
1039      var styleHtml = '<style>.' + uniqueid457Class + '::before {background-image: repeating-linear-gradient(45deg, ' + col + ' 0, ' + col + ' 1px, transparent 0, transparent 50%);}</style>';
1040      $('head').append(styleHtml);
1041    });
1042
1043    /* ▼ セレクタに .cparts-h2decoration--dot を追加(カンマ区切り) */
1044$('.cparts-id457.cparts-h2decoration--lineanimation, .cparts-id457.cparts-h2decoration--dot').each(function(index) {
1045  const $el = $(this);
1046
1047  /* ===============================
1048     ▼ クラス書き換え処理(共通)
1049     =============================== */
1050
1051  // dec-line--grey → dec-bg--primary
1052  if ($el.hasClass('dec-line--grey')) {
1053    $el.removeClass('dec-line--grey');
1054  }
1055
1056  // dec-line-pe--grey → dec-bg-pe--primary
1057  if ($el.hasClass('dec-line-pe--grey')) {
1058    $el.removeClass('dec-line-pe--grey').addClass('dec-bg-pe--primary');
1059  }
1060
1061  /* ===============================
1062     ▼ 元のラインカラー処理(共通)
1063     =============================== */
1064
1065  // span内のcolorを取得(なければh2自身のcolor)
1066  const $span = $el.find('span[style*="color"]');
1067  const color = $span.length ? $span.css('color') : $el.css('color');
1068
1069  // CSS変数を設定(currentColorに対å¿
1069œï¼‰
1070  this.style.setProperty('--line-color', color);
1071
1072  /* ===============================
1073     ▼ text-align に応じた margin 自動付与(共通)
1074     =============================== */
1075  const textAlign = $el.css('text-align');
1076
1077  if (textAlign === 'right') {
1078    this.style.setProperty('margin-left', 'auto', 'important');
1079  } else if (textAlign === 'left') {
1080    this.style.setProperty('margin-right', 'auto', 'important');
1081  } else if (textAlign === 'center') {
1082    this.style.setProperty('margin-left', 'auto', 'important');
1083    this.style.setProperty('margin-right', 'auto', 'important');
1084  }
1085
1086  /* ===============================
1087     ▼ IntersectionObserver でアニメ付与
1088     ※ lineanimation クラスを持っている場合のみ実行
1089     =============================== */
1090  if ($el.hasClass('cparts-h2decoration--lineanimation')) {
1091  
1092    const observer = new IntersectionObserver(function(entries) {
1093      entries.forEach(function(entry) {
1094        if (entry.isIntersecting) {
1095          if (!$el.hasClass('cparts-h2decoration--lineanimation-active')) {
1096            setTimeout(function() {
1097              $el.addClass('cparts-h2decoration--lineanimation-active');
1098            }, 800);
1099          }
1100          observer.unobserve(entry.target);
1101        }
1102      });
1103    }, { threshold: 0.1 });
1104
1105    observer.observe(this);
1106    
1107  } // if end
1108});
1109      
1110    // $('.cparts-id457.cparts-h2decoration--lineanimation').each(function(index) {
1111    //   const $el = $(this);
1112  
1113    //   /* ===============================
1114    //      ▼ クラス書き換え処理を追加
1115    //      =============================== */
1116  
1117    //   // dec-line--grey → dec-bg--primary
1118    //   if ($el.hasClass('dec-line--grey')) {
1119    //     $el.removeClass('dec-line--grey');
1120    //   }
1121  
1122    //   // dec-line-pe--grey → dec-bg-pe--primary
1123    //   if ($el.hasClass('dec-line-pe--grey')) {
1124    //     $el.removeClass('dec-line-pe--grey').addClass('dec-bg-pe--primary');
1125    //   }
1126  
1127    //   /* ===============================
1128    //      ▼ ここから元のラインカラー処理
1129    //      =============================== */
1130  
1131    //   // span内のcolorを取得(なければh2自身のcolor)
1132    //   const $span = $el.find('span[style*="color"]');
1133    //   const color = $span.length ? $span.css('color') : $el.css('color');
1134  
1135    //   // CSS変数を設定(currentColorに対応)
1136    //   this.style.setProperty('--line-color', color);
1137  
1138    //   /* ===============================
1139    //      ▼ text-align に応じた margin 自動付与
1140    //      =============================== */
1141    //   const textAlign = $el.css('text-align');
1142  
1143    //   if (textAlign === 'right') {
1144    //     this.style.setProperty('margin-left', 'auto', 'important');
1145    //   } else if (textAlign === 'left') {
1146    //     this.style.setProperty('margin-right', 'auto', 'important');
1147    //   } else if (textAlign === 'center') {
1148    //     this.style.setProperty('margin-left', 'auto', 'important');
1149    //     this.style.setProperty('margin-right', 'auto', 'important');
1150    //   }
1151  
1152    //   /* ===============================
1153    //      ▼ IntersectionObserver でアニメ付与
1154    //      =============================== */
1155    //   const observer = new IntersectionObserver(function(entries) {
1156    //     entries.forEach(function(entry) {
1157    //       if (entry.isIntersecting) {
1158    //         if (!$el.hasClass('cparts-h2decoration--lineanimation-active')) {
1159    //           setTimeout(function() {
1160    //             $el.addClass('cparts-h2decoration--lineanimation-active');
1161    //           }, 800);
1162    //         }
1163    //         observer.unobserve(entry.target);
1164    //       }
1165    //     });
1166    //   }, { threshold: 0.1 });
1167  
1168    //   observer.observe(this);
1169    // });
1170    
1171
1172      
1173    
1174    //新規ヘッダー用コンテンツパーツ
1175    // 特定のコンテンツパーツ(ロゴのみなど)以外のヘッダー用コンテンツパーツの幅
1176    $('.cparts-header-block:not(.cparts-id468--01)').each(function() {
1177      $(this).parents('[class*="free_parts"]').addClass('sitedesign-headerparts__full');
1178      $(this).parents('.freeParts').not('[class*="free_parts"] .freeParts').addClass('sitedesign-headerparts__full');
1179    });
1180    $('.cparts-header-block.cparts-id468--01').each(function() {
1181      $(this).parents('[class*="free_parts"]').addClass('sitedesign-headerparts__nofull');
1182      $(this).parents('.freeParts').not('[class*="free_parts"] .freeParts').addClass('sitedesign-headerparts__nofull');
1183    });
1184    
1185    // htmlのフォントサイズを抜き出す
1186    var baseSize = $('html').css('font-size')
1187    baseSize = parseInt(baseSize);
1188
1189    // フォントサイズ変更ボタンが押された時
1190    $('.cparts-header-block__fontsize').find('button').on('click', function() {
1191
1192      // 標準
1193      if ($(this).hasClass('cparts-btn-fontsize__sm')) {
1194        $('html').css('font-size', baseSize);
1195        $(this).addClass('cparts-btn-fontsize__active')
1196        $(this).siblings('button').removeClass('cparts-btn-fontsize__active')
1197        
1198      // 大
1199      } else if ($(this).hasClass('cparts-btn-fontsize__md')) {
1200        $('html').css('font-size', baseSize * 1.2 + 'px');
1201        $(this).addClass('cparts-btn-fontsize__active')
1202        $(this).siblings('button').removeClass('cparts-btn-fontsize__active')
1203        
1204      // 特大
1205      } else if ($(this).hasClass('cparts-btn-fontsize__xl')) {
1206        $('html').css('font-size', baseSize * 1.4 + 'px');
1207        $(this).addClass('cparts-btn-fontsize__active')
1208        $(this).siblings('button').removeClass('cparts-btn-fontsize__active')
1209      }
1210    });
1211    
1212    // ギミック系一覧パーツ
1213    if($('#published').length > 0){ //公開サイトのみ
1214      //リンク生成
1215      $('.cparts-overlink-block').each(function() {
1216        if ($(this).find('.cparts-img-block').find('a').length > 0) {
1217          var url = $(this).find('.cparts-img-block').find('a').attr('href');
1218          $(this).append('<a href="'+url+'" class="cparts-overlink-block-url"> </a>');
1219        }
1220      });
1221      // マウスオーバー時のアニメーション
1222      $('[class*="cparts-id472--"]').find('.cparts-overlink-block-url').on('mouseover', function() {
1223        let back = $(this).parents('.cparts-hover--full').find('.dec-bg--primary').css('background-color');
1224        if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--resize') || $(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1225          if (window.matchMedia( "(min-width: 768px)" ).matches) {
1226            $(this).parents('.lay-row').children('div').removeClass('cparts-hover--resize-hover');
1227            $(this).parents('.lay-row').children('div').addClass('cparts-hover--resize-hover-off');
1228            $(this).parent('.cparts-body-block').parent('div').addClass('cparts-hover--resize-hover');
1229            $(this).parent('.cparts-body-block').parent('div').removeClass('cparts-hover--resize-hover-off');
1230            $(this).parents('.lay-row').children('div').find('.cparts-txt-block').hide();
1231            let th = $(this);
1232            $(function(){ setTimeout(function(){ // 0.5秒後に概要表示
1233              th.parents('.lay-row').children('div').find('.cparts-txt-block').fadeIn(500);
1234            }, 500 ); }); 
1235            // マウスオーバーで全画面サイズ
1236            if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1237              let img = $(this).parent('.cparts-body-block').find('.cparts-img-block').find('a').html();
1238              $(this).parents('.lay-row').css('background-color', back);
1239              $(this).parents('.lay-row').append(img);
1240            }
1241          }
1242        }
1243      });
1244      // カーソルが要素から外れた時のアニメーション
1245      $('[class*="cparts-id472--"]').find('.cparts-overlink-block-url').on('mouseleave', function() {
1246        if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--resize') || $(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1247          if (window.matchMedia( "(min-width: 768px)" ).matches) {
1248            $(this).parents('.lay-row').children('div').removeClass('cparts-hover--resize-hover');
1249            $(this).parents('.lay-row').children('div').removeClass('cparts-hover--resize-hover-off');
1250            // マウスオーバーで全画面サイズ
1251            if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1252              $(this).parents('.lay-row').css('background-color', 'transparent');
1253              $(this).parents('.lay-row').children('img').remove();
1254            }
1255          }
1256        }
1257      });
1258    } else { //編集サイトのみ
1259      // マウスオーバー時のアニメーション
1260      $('[class*="cparts-id472--"]').find('.cparts-img-block').find('img').on('mouseover', function() {
1261        let back = $(this).parents('.cparts-hover--full').find('.dec-bg--primary').css('background-color');
1262        if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--resize') || $(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1263          if (window.matchMedia( "(min-width: 768px)" ).matches) {
1264            $(this).parents('.lay-row').children('div').removeClass('cparts-hover--resize-hover');
1265            $(this).parents('.lay-row').children('div').addClass('cparts-hover--resize-hover-off');
1266            $(this).parents('.cparts-body-block').parent('div').addClass('cparts-hover--resize-hover');
1267            $(this).parents('.cparts-body-block').parent('div').removeClass('cparts-hover--resize-hover-off');
1268            $(this).parents('.lay-row').children('div').find('.cparts-txt-block').hide();
1269            let th = $(this);
1270            $(function(){ setTimeout(function(){ // 0.5秒後に概要表示
1271              th.parents('.lay-row').children('div').find('.cparts-txt-block').fadeIn(500);
1272            }, 500 ); }); 
1273            // マウスオーバーで全画面サイズ
1274            if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1275              let img = $(this).parents('.cparts-body-block').find('.cparts-img-block').find('a').html();
1276              $(this).parents('.lay-row').css('background-color', back);
1277              $(this).parents('.lay-row').append(img);
1278            }
1279          }
1280        }
1281      });
1282      // カーソルが要素から外れた時のアニメーション
1283      $('[class*="cparts-id472--"]').find('.cparts-img-block').find('img').on('mouseleave', function() {
1284        if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--resize') || $(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1285          if (window.matchMedia( "(min-width: 768px)" ).matches) {
1286            $(this).parents('.lay-row').children('div').removeClass('cparts-hover--resize-hover');
1287            $(this).parents('.lay-row').children('div').removeClass('cparts-hover--resize-hover-off');
1288            if ($(this).parents('[class*="cparts-id472--"]').hasClass('cparts-hover--full')) {
1289              $(this).parents('.lay-row').css('background-color', 'transparent');
1290              $(this).parents('.lay-row').children('img').remove();
1291            }
1292          }
1293        }
1294      });
1295    }
1296
1297    if (window.matchMedia( '(min-width: 768px)' ).matches) {
1298      $('[class*="cparts-id472--"].cparts-hover--resize').each(function() {
1299        var bodyHight01 = $(this).find('.cparts-txt-block').outerHeight(true);
1300        $(this).find('.lay-padding-x--0').css('height', bodyHight01);
1301      });
1302      $('[class*="cparts-id472--"].cparts-hover--full').each(function() {
1303        var bodyHight02 = $(this).find('.lay-row').outerHeight(true);
1304        $(this).find('.lay-row').css({'height':bodyHight02, 'overflow':'hidden'});
1305        $(this).find('.lay-padding-x--0').css('height', bodyHight02);
1306        var bodyWidth = $(this).find('.lay-row').outerWidth();
1307        $(this).find('.cparts-img-block img').css('width', bodyWidth);
1308      });
1309    }
1310    
1311    // 流れるライン系画像、テキスト
1312    $('.cparts-decoslider-block.cparts-current--rightleft,.cparts-decoslider-block.cparts-current--leftright').each(function(){
1313      var loopslider = $(this).find('ul').clone(true);
1314      var loopsliderW = $(this).find('ul').width();
1315      var loopsliderH = $(this).find('ul').height();
1316      var self = $(this);
1317      $(this).find('.cparts-txt-block').append(loopslider).css({display: 'flex', height: loopsliderH+'px'});
1318      $(this).find('ul').wrapAll('<div class="cparts-loopslider--wrap"></div>');
1319      $(this).find('.cparts-loopslider--wrap').css({width: (loopsliderW*2)+'px'});
1320
1321
1322      if ($(this).hasClass('cparts-current--rightleft')) { // 右から左へ
1323        function loopMove(){ // ループ
1324          self.find('.cparts-loopslider--wrap').animate({left: '-'+loopsliderW+'px'},25000,'linear',function(){
1325            self.find('.cparts-loopslider--wrap').css({left:'0'});
1326            loopMove();
1327          });
1328        };
1329        loopMove();
1330      } else if ($(this).hasClass('cparts-current--leftright')) { // 左から右へ
1331        function loopMove(){ // ループ
1332          self.find('.cparts-loopslider--wrap').animate({right: '-'+loopsliderW+'px'},25000,'linear',function(){
1333            self.find('.cparts-loopslider--wrap').css({right:'0'});
1334            loopMove();
1335          });
1336        };
1337        loopMove();
1338      }
1339    }); 
1340
1341    if ($('.cparts-decoslider-block').length) {
1342      var timer = false;
1343      var prewidth = $(window).width();
1344      $(window).resize(function() {
1345      if (timer !== false) {
1346      clearTimeout(timer);
1347      }
1348      timer = setTimeout(function() {
1349      var nowWidth = $(window).width();
1350      if(prewidth !== nowWidth){
1351      // リロード
1352      location.reload();
1353      }
1354      prewidth = nowWidth;
1355      }, 10);
1356      });
1357    }
1358    
1359    // メイン画像_ver.21
1360    $('.cparts-id504').each(function() {
1361      var p = $(this).css('padding-top');
1362      $(this).find('.cparts-head-block').css('height','calc( '+p+' + 150px)');
1363    });
1364    $(window).on('load', function(){
1365
1366      // HEADERブロックにメイン画像系のコンテンツパーツが配置されたフリーパーツがある場合
1367      if (window.matchMedia( '(min-width: 768px)' ).matches) {
1368        $('.siteblock-header .freeParts,.siteblock-header [id*="EDIT-free_parts"]').has('.cparts-id504').css('width','100%');
1369      }
1370
1371      $('.cparts-id504').each(function() {
1372        // テキスト量に合わせて画像の高さ調整
1373        if ($(this).find('.cparts-txt-block').find('.cparts-id504__ttl').outerHeight() > $(this).find('.cparts-img-block').height()) {
1374          var d = $(this).find('.cparts-txt-block').find('.cparts-id504__ttl').outerHeight();
1375          $(this).find('.cparts-img-block').height(d);
1376          $(this).find('.cparts-id504__ttl-span').height(d - 150);
1377        }
1378        $(this).find('.cparts-id504__ttl').parent('.h1-canvas').find('canvas').hide();
1379        $(this).find('.cparts-id504__ttl').parent('.h1-canvas').removeClass();
1380        // HEADER・UPPERメインビジュアルのみ
1381        if (
1382          $(this).parents('#upper').length > 0 ||
1383          $(this).parents('.siteblock-upper').length > 0 ||
1384          $(this).parents('.upper').length > 0 ||
1385          $(this).parents('#header').length > 0 ||
1386          $(this).parents('.siteblock-header').length > 0 ||
1387         $(this).parents('.header').length > 0 ||
1388          $(this).parents('.cms-contentsparts-parts-preview').length > 0
1389        ) {
1390          // H1横幅
1391          if ($(this).outerWidth() == $(window).width() || $(this).outerWidth() > $(window).width()) {
1392            $(this).find('.cparts-txt-block').find('.cparts-id504__ttl').attr('style', 'width:70vw !important;');
1393          } else {
1394            $(this).find('.cparts-id504__ttl').addClass('dec-txt--primary');
1395          }
1396        }
1397      });
1398      
1399    });
1400
1401    // スクロールダウン
1402    $('.cparts-id504').each(function() {
1403      const before = $(this).find('.cparts-notes-block > div.dec-txt--primary');
1404      const text = before.text();
1405      const textArray = text.split('');
1406      let after = '';
1407      $.each(textArray,function(index,val){
1408        after += "<span>" + val + "</span>";
1409      });  
1410      before.html(after);
1411      const textcnt = textArray.length;
1412      const circleR = ($(this).find('.cparts-notes-block').height()) / 2;
1413      const fontH = ($(this).find('.cparts-notes-block > div.dec-txt--primary').height());
1414      const dist = circleR - fontH;
1415      $(this).find('.cparts-notes-block > div span').each(function(index) {
1416        const num = index + 1;
1417        const radX = Math.sin(360 / textcnt * num * (Math.PI / 180));
1418        const radY = Math.sin((90 - (360 / textcnt * num)) * (Math.PI / 180));
1419        $(this).css('transform', 'translate(' + dist * radX + 'px, ' + -(dist * radY) + 'px) rotate(' + 360 / textcnt * num + 'deg)');
1420      });
1421    });
1422    
1423    // 中抜き文字
1424    if($('div[class*="cparts-id527"]').length){
1425      function rgbtohex(orig){
1426       var rgb = orig.replace(/\s/g,'').match(/^rgba?\((\d+),(\d+),(\d+)/i);
1427       return (rgb && rgb.length === 4) ? "#" +
1428        ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
1429        ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
1430        ("0" + parseInt(rgb[3],10).toString(16)).slice(-2) : orig;
1431      }
1432      
1433      $('div[class*="cparts-id527"]').each(function(){
1434        var colorTxt = $(this).parents().css('color');
1435        let hexColor = rgbtohex(colorTxt);
1436        if (window.matchMedia( '(min-width: 768px)' ).matches) {
1437          $(this).find('.cparts-id527-01__ttl,.cparts-id527-02__ttl').css({'-webkitTextStroke':'2px ' + hexColor,'textStroke':'2px ' + hexColor});
1438        } else {
1439          $(this).find('.cparts-id527-01__ttl,.cparts-id527-02__ttl').css({'-webkitTextStroke':'1px ' + hexColor,'textStroke':'1px ' + hexColor});
1440        }
1441      });
1442    }
1443    
1444    // メイン画像_ver.23
1445    if($('.cparts-id539').length){
1446      $('.cparts-id539').each(function(){
1447        var primaryC539 = $(this).find('.cparts-body-block > .dec-bg--primary').css('background-color');
1448        console.log(primaryC539);
1449        var contentsC539 = primaryC539.replace('rgb(', 'rgba(').replace(')', ',');
1450        console.log(contentsC539);
1451        $(this).find('.cparts-body-block > .dec-bg--primary').css({'cssText':'background: linear-gradient(to bottom, ' + contentsC539 + '1) 0%,' + contentsC539 + '0) 80%) !important;'});
1452      });
1453    }
1454    $('body:not(.column1) #contents #upper .cparts-id539,.column2 #contents #upper .cparts-id539,.column2 .row .upper .cparts-id539,#main .cparts-id539 ,#bottom .cparts-id539 ,#side .cparts-id539 ,#right .cparts-id539 ,#opt1 .cparts-id539 ,#opt2 .cparts-id539 ,#opt3 .cparts-id539 ,#footer .cparts-id539 ,.main .cparts-id539 ,.bottom .cparts-id539 ,.side .cparts-id539 ,.right .cparts-id539 ,.opt1 .cparts-id539 ,.opt2 .cparts-id539 ,.opt3 .cparts-id539 ,.footer .cparts-id539 ,.siteblock-main .cparts-id539 ,.siteblock-bottom .cparts-id539 ,.siteblock-side .cparts-id539 ,.siteblock-right .cparts-id539 ,.siteblock-opt1 .cparts-id539 ,.siteblock-opt2 .cparts-id539 ,.siteblock-opt3 .cparts-id539 ,.siteblock-footer .cparts-id539').each(function() {
1455      $(this).find('.cparts-caption-block').remove();
1456    });
1457    
1458    // 新・クリックで開く
1459    if ($('[class*="cparts-id170"]').length) {
1460      $('.cparts-id170__head-block').each(function(){
1461          $(this).nextUntil('.cparts-id170__foot-block').wrapAll('<div class="cparts-id170__body-block cparts-id170__body-block-first cparts-id170__body-block-last"></div>');
1462          $(this).nextAll().each(function(){
1463              if($(this).hasClass('cparts-id170__foot-block')) return false;
1464              $(this).hide();
1465              $('.cparts-id170__foot-block p').remove();
1466          });
1467      });
1468      $('.cparts-id170__head-block').off().on('click', function() {
1469          $(this).find('.cparts-icon-block').toggleClass('cparts-icon-block-open');
1470          $(this).nextUntil('.cparts-id170__foot-block', '.cparts-id170__body-block').slideToggle(500);
1471          setTimeout(function() {
1472              $('.cparts-id170__body-block').css({'overflow':'visible'});
1473          }, 2000);
1474          });
1475    }
1476
1477    // 新・ステップリスト
1478    $('[class*="cparts-id289"]').each(function(){
1479      $(this).find('ul li:nth-child(2n+1)').addClass('dec-bg--light dec-bg-pe--primary');
1480      $(this).find('ul li:nth-child(2n+1)').append('<span class="dec-bg--light"></span>');
1481      $(this).find('ul li:nth-child(2n)').addClass('dec-line-pe--primary');
1482    });
1483  
1484    // 新・よくあるご質問(クリックで回答を表示)
1485    $('.cparts-id045--02').each(function(){
1486      $(this).find('.cparts-click-block').on('click',function(){
1487        $($(this).next('dd')).slideToggle(500);
1488      });
1489    });
1490    
1491    // カウンターパーツ
1492    $('[class*="cparts-id544--"].box .cparts-count-block, [class*="cparts-id546--"].box .cparts-count-block').one('inview', function(event, isInView){
1493      if (isInView) {
1494      //要素が見えたときに実行する処理
1495        $(this).find('.cparts-no-block').each(function(){
1496          $(this).prop('Counter',0).animate({//0からカウントアップ
1497                Counter: $(this).text()
1498            }, {
1499          // スピードやアニメーションの設定
1500                duration: 2000,//数字が大きいほど変化のスピードが遅くなる。2000=2秒
1501                easing: 'swing',//動きの種類。他にもlinearなど設定可能
1502                step: function (now) {
1503                    $(this).text(Math.ceil(now));
1504                }
1505            });
1506        });
1507      }
1508    });
1509    
1510    // 新:タブ切り替え
1511    // タグ削除・非表示
1512    $('.cparts-id177__tabstart-block p,.cparts-id177__tablast-block p,.cparts-id177__foot-block p').remove();
1513    $('.cparts-id177__body-block,.cparts-id177__inner-block,.cparts-id177__note-block').hide();
1514
1515    // 追加したコンテンツパーツを囲う
1516    $('.cparts-id177__tabstart-block').each(function() {
1517    	$(this).nextUntil('.cparts-id177__tablast-block').wrapAll('<div class="cparts-id177__body-block"></div>');
1518    });
1519
1520    // 公開サイトの処理
1521    var edit_site = $('#cms_contents_area').length;
1522    if(edit_site === 0) {
1523        $('.cparts-id177__tabstart-block, .cparts-id177__tablast-block, .cparts-id177__foot-block').hide()
1524    };
1525
1526    $('.cparts-id177__head-block').each(function(){
1527        // 自身のliに対して処理を行う
1528        $(this).find('li > span').each(function(i){
1529            // クラス名を追加する
1530            $(this).addClass('cparts-tab-block__0' + (i+1));
1531            var li = $(this).length;
1532            // 最初の要素にはselect-on
1533            if(i === 0) $(this).addClass('cparts-select-on');
1534
1535            // クリックイベントを追加
1536            $(this).off().on('click', function(event) {
1537
1538                // 自分のグループのselect-onを削除
1539                $(this).parents('.cparts-id177__head-block').find('.cparts-select-on').removeClass('cparts-select-on');
1540                $(this).parent('li').siblings('li').find('span > span').addClass('dec-bg--light').removeClass('dec-bg--primary dec-line-pe--primary');
1541
1542                // 自分にselect-onを追加
1543                $(this).addClass('cparts-select-on');
1544                $(this).find('span').removeClass('dec-bg--light').addClass('dec-bg--primary dec-line-pe--primary');
1545                var show_flag = 0; // 表示フラグ 1の間は表示する
1546                var show_class = $(this).attr('class').replace(' cparts-select-on',''); // 表示するクラス名
1547                $(this).parents('.cparts-id177__head-block').nextAll().each(function(index, el) {
1548                    if($(this).hasClass('cparts-id177__foot-block')) return false;
1549                    $(this).hide();
1550                });
1551                $(this).parents('.cparts-id177__head-block').nextAll().each(function(index, el) {
1552                    if($(this).hasClass('cparts-id177__foot-block')) return false;
1553                    if($(this).hasClass('cparts-id177__tabstart-block') && $(this).hasClass(show_class) && show_flag === 0) {
1554                        show_flag = 1;
1555                        if(edit_site)
1556                            $(this).fadeIn(1000);
1557                    } else if($(this).hasClass('cparts-id177__tablast-block') && $(this).hasClass(show_class) && show_flag === 1) {
1558                        show_flag = 0;
1559                        if(edit_site)
1560                            $(this).fadeIn(1000);
1561                    } else if(show_flag === 1) {
1562                        $(this).fadeIn(1000);
1563                    }
1564                });
1565                return false;
1566            });
1567        });
1568        var index = 1;
1569        $(this).nextAll().each(function() {
1570            if($(this).hasClass('cparts-id177__foot-block')) return false;
1571            if($(this).hasClass('cparts-id177__tabstart-block')) {
1572                $(this).addClass('cparts-tab-block__0'+index);
1573                $(this).attr('data','cparts-tab-block__0'+index);
1574                if(index === 1) $(this).show();
1575                else $(this).hide();
1576            } else if($(this).hasClass('cparts-id177__tablast-block')) {
1577                $(this).addClass('cparts-tab-block__0'+index);
1578                $(this).attr('data','cparts-tab-block__0'+index);
1579                if(index === 1) $(this).show();
1580                else $(this).hide();
1581                index++;
1582            } else {
1583                $(this).addClass('cparts-tab-block__0'+index);
1584                $(this).attr('data','cparts-tab-block__0'+index);
1585                if(index === 1) $(this).show();
1586                else $(this).hide();
1587            }
1588        });
1589      });
1590    
1591      // フレックス親ブロック追加
1592      $('.cparts-flexinline-block').not('.cparts-flexinline-block+.cparts-flexinline-block').each(function(){
1593          $(this).nextUntil(':not(.cparts-flexinline-block)').addBack().wrapAll('<div class="cparts-flex-block"><div class="lay-row"></div></div>');
1594      }).parent('.cparts-flex-block:empty').remove();
1595
1596      // 新・プラン別価格表(横並び)
1597      $('.cparts-id113 .cparts-caption-block h4').addClass('dec-bg-pe--primary');
1598    
1599    /* -------------------------------------------------------
1600      2024年追加
1601    -------------------------------------------------------- */
1602    // 新・一覧パーツ_ver.1
1603    $('.cparts-id35').each(function() {
1604      $(this).find('.cparts-notes-block li').addClass('dec-bg--primary');
1605    });
1606    
1607    // メイン画像_ver.26
1608    $('.cparts-id568').each(function() {
1609      var h1text = $(this).find('.cparts-id568__ttl').text();
1610      var bgColor = $(this).css('background-color');
1611      var rgbValues = bgColor.match(/\d+/g); // RGBの値を抽出
1612      var rgbString = rgbValues.join(','); // カンマ区切りの文字列に変換
1613      var h1fontFamily = $(this).find('h1').css('font-family');
1614      // ダブルクォートをエスケープする
1615      h1fontFamily = h1fontFamily.replace(/"/g, '');
1616      $(this).find('h1').after('<p class="cparts-notes-block cparts-animation--blurTrigger cparts-animation__duration-time08 cparts-animation__delay-time06 dec-txt--primary"><span style="font-family: ' + h1fontFamily + ';">' + h1text + '</span><span style="background: linear-gradient(to bottom, rgba(' + rgbString + ',0) 0%,rgba(' + rgbString + ',1) 75%);"></span></p>');
1617      $(this).css('background-color', 'transparent');
1618    });
1619
1620    // メイン画像_ver.29
1621    if ($('.cparts-id576').length) {
1622        $('.cparts-id576').each(function() {
1623            var primaryC579 = $(this).find('.cparts-body-block').css('background-color'); // 実際の要素の背景色を取得
1624            if (primaryC579) {
1625                // RGB形式をRGBA形式に変換
1626                var contentsC579 = primaryC579.replace('rgb(', 'rgba(').replace(')', ',');
1627                // スタイルを追加
1628                $('<style>')
1629                    .prop('type', 'text/css')
1630                    .html('.cparts-id576 .cparts-body-block.dec-bg--primary.dec-bg-pe--primary::before { background: linear-gradient(65deg,' + contentsC579 + '1) 0%,' + contentsC579 + ' 0) 60%) !important; }')
1631                    .appendTo('head'); // headに追加
1632            }
1633        });
1634      }
1635    
1636    // メイン画像_ver.31
1637    if ($('.cparts-id580').length) {
1638        $('.cparts-id580').each(function() {
1639          var backgroundImage = $(this).css('background-image'); // 親要素の背景画像
1640          var backgroundSize = $(this).css('background-size'); // 親要素のbackground-size
1641
1642          // 背景画像が設定されている場合
1643          if (backgroundImage !== 'none') {
1644              // 存在するstyle属性を削除
1645              $(this).removeAttr('style');
1646
1647              // 孫要素のcparts-body-blockにcparts-add-afterクラスを追加
1648              $(this).find('.cparts-body-block').each(function() {
1649                  $(this).addClass('cparts-add-after'); // cparts-add-afterクラスを追加
1650
1651                  var style = 'background-image: ' + backgroundImage + '; background-size: ' + backgroundSize + ';';
1652
1653                  // 疑似要素にスタイルを適用
1654                  $(this).append('<style>.cparts-id580 .cparts-body-block.cparts-add-after::after { background-color: transparent !important; content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; ' + style + ' }</style>');
1655              });
1656          }
1657        });
1658      }
1659
1660      
1661    // フローティングバナーが存在する場合、ページトップボタンのz-indexを変更
1662    if ($('.cparts-id582, .cparts-id583, .cparts-id584').length) {
1663      $('.sitedesign-pagetopbtn').each(function () {
1664        this.style.setProperty('z-index', '999', 'important');
1665      });
1666    }
1667    
1668    // フローティングバナー_ver.1&2
1669    if ($('.cparts-id582, .cparts-id583').length) {
1670      var $floatingBanner = $('.cparts-id582, .cparts-id583');
1671      var $footerBlock = $('body');
1672      var $pageTopBtn = $('.sitedesign-pagetopbtn, .pageTop a');
1673      
1674      // メディアクエリをチェック
1675      var mediaQuery = window.matchMedia('(max-width: 767px)');
1676
1677      function adjustPageTopBtnPosition() {
1678        if (!mediaQuery.matches) return;
1679        var bannerHeight = $floatingBanner.outerHeight();
1680
1681        if ($floatingBanner.is(':visible')) {
1682            $pageTopBtn.css({
1683              bottom: (bannerHeight + 10) + 'px', // 高さ分 + 10px を追加
1684              zIndex: 999 // z-indexを101に設定
1685          });
1686        } else {
1687            $pageTopBtn.css({
1688              bottom: '', // 高さ分 + 10px を追加
1689              zIndex: 2 // z-indexを101に設定
1690          });
1691        }
1692      }
1693
1694      function handleResize() {
1695        if (!mediaQuery.matches) return;
1696        
1697        var windowHeight = window.innerHeight;
1698        var scrollBottom = window.scrollY + windowHeight;
1699        var footerOffsetTop = $footerBlock.offset().top;
1700        var bannerHeight = $floatingBanner.outerHeight();
1701    
1702        if (scrollBottom >= footerOffsetTop) {
1703            if ($footerBlock.css('padding-bottom') !== bannerHeight + 'px') {
1704                $footerBlock.css('padding-bottom', bannerHeight + 'px');
1705            }
1706        } else {
1707            if ($footerBlock.css('padding-bottom') !== '') {
1708                $footerBlock.css('padding-bottom', '');
1709            }
1710        }
1711      }
1712
1713      // 初期設定とウィンドウサイズ変更時のイベントリスナー
1714      adjustPageTopBtnPosition();
1715      handleResize();
1716      mediaQuery.addListener(handleResize);
1717
1718      $(document).ready(function() {
1719        // .cparts-id583 を子要素として含む親要素を特定
1720        $('.siteblock-header, .siteblock-bottom, .siteblock-opt1').has('.cparts-id583').
1720css({
1721            position: 'relative',
1722            zIndex: 100
1723        });
1724      });
1725
1726    }
1727      
1728    // フローティングバナー_ver.3
1729    if ($('.cparts-id584').length) {
1730      $(document).ready(function () {
1731          $('.cparts-icon-block').on('click', function () {
1732              var $parent = $(this).closest('.cparts-id584');
1733              if ($parent.length) {
1734                  $parent.css({
1735                      'transition': 'opacity 0.5s ease',
1736                      'opacity': '0'
1737                  });
1738                  setTimeout(function () {
1739                      $parent.css('display', 'none');
1740                  }, 500); // 0.5秒後に完全に非表示に
1741              }
1742          });
1743      });
1744    }
1745
1746    // フローティングバナー_ver.1&2&3
1747    if ($('.cparts-id582, .cparts-id583, .cparts-id584').length) {
1748      $(document).ready(function() {
1749        // 対象となる親要素のセレクターを定義
1750        const parentSelectors = [
1751            '#header', '#upper', '#main', '#bottom', '#side', '#right', '#opt1', '#opt2', '#opt3', '#footer',
1752            '.header', '.upper', '.main', '.bottom', '.side', '.right', '.opt1', '.opt2', '.opt3', '.footer',
1753            '.siteblock-header','.siteblock-upper', '.siteblock-main', '.siteblock-bottom', '.siteblock-side', '.siteblock-right',
1754            '.siteblock-opt1', '.siteblock-opt2', '.siteblock-opt3', '.siteblock-footer'
1755        ];
1756    
1757        // チェック対象の子要素セレクターを定義
1758        const childSelectors = '.cparts-id582, .cparts-id583, .cparts-id584';
1759    
1760        // 指定された親要素の中に子要素が存在する場合にスタイルを適用
1761        $(parentSelectors.join(',')).has(childSelectors).css({
1762            position: 'relative',
1763            zIndex: 200
1764        });
1765      });
1766    };
1767
1768  });
1769  
1770  $(window).on('load resize' , function() {
1771    
1772    // 公開サイトで左右スライドバリエーション時のbodyの横揺れを防止する
1773    if($('body:not(#header,#upper,#bottom,#main,#side,#right,#opt1,#opt2,#opt3,#footer) > div#cms_contents_area').length){
1774      $('body').css('overflow-x','');
1775    } else if($('.cparts-animate--slideInLeft,cparts-animate--slideInRIght').length) {
1776      $('body').css('overflow-x','hidden');
1777    }
1778    
1779    // メイン画像_ver.21
1780    $('.cparts-id504 .cparts-notes-block').on('click',function(){
1781      // スクロールダウンクリックアニメーション
1782      if ($(this).parents('#upper').length > 0 || $(this).parents('.siteblock-upper').length > 0 || $(this).parents('.upper').length > 0) {
1783        if ($('body').find('.siteblock-header').length > 0) {
1784          var targetY = $('.siteblock-header').height() + $('.cparts-id504').outerHeight();
1785        }else if ($('body').find('#header').length > 0) {
1786          var targetY = $('#header').height() + $('.cparts-id504').outerHeight();
1787        }else if ($('body').find('.header').length > 0) {
1788          if ($('body').hasClass('column2')) {
1789            var targetY = $('.cparts-id504').outerHeight();
1790          }else if ($('body').hasClass('column1')) {
1791            var targetY = $('.header').height() + $('.cparts-id504').outerHeight();
1792          }
1793        }
1794      }else if ($(this).parents('#header').length > 0 || $(this).parents('.siteblock-header').length > 0 || $(this).parents('.header').length > 0) {
1795        if ($('body').find('.siteblock-header').length > 0) {
1796          var targetY = $('.siteblock-header').height();
1797        }else if ($('body').find('#header').length > 0) {
1798          var targetY = $('#header').height();
1799        }else if ($('body').find('.header').length > 0){
1800          var targetY = $('.header').height();
1801        }
1802      }
1803      if (window.matchMedia( "(min-width: 768px)" ).matches) {
1804        $("html, body").stop().animate({scrollTop: targetY}, 500, 'swing');
1805        return false;
1806      }
1807    });
1808    
1809    /* -------------------------------------------------------
1810      2021年追加
1811    -------------------------------------------------------- */
1812    // 【メイン画像_ver.8】アニメーション用class追加
1813    $('.cparts-id285 .cparts-txt-block').each(function(){
1814      var imgPos = $(this).offset().top;
1815      var scroll = $(window).scrollTop();
1816      var windowHeight = $(window).height();
1817      if (scroll > imgPos - windowHeight + windowHeight/5){
1818        $(this).addClass('cparts-fadeIn--id285');
1819      }
1820    });
1821
1822    // 【ブロークングリッドレイアウト】アニメーション用class追加
1823    $('.cparts-id286--01 .cparts-js-block,.cparts-id286--02 .cparts-js-block').each(function(){
1824      var imgPos = $(this).offset().top;
1825      var scroll = $(window).scrollTop();
1826      var windowHeight = $(window).height();
1827      if (scroll > imgPos - windowHeight + windowHeight/5){
1828        $(this).addClass('cparts-fadeIn--id286');
1829      }
1830    });
1831
1832    //目次パーツ 高さ合わせる
1833    if (window.matchMedia( "(min-width: 768px)" ).matches) {
1834      $('.cparts-var03-type18').each(function() {
1835          var maxHeight = 0;
1836          $(this).find('.cparts-body-block').each(function() {
1837              if ($(this).height() > maxHeight) maxHeight = $(this).height();
1838          });
1839          $(this).find('.cparts-body-block').height(maxHeight);
1840      });
1841    }
1842
1843    // 【共通】スライド
1844    //全てのスライドがPC非表示、モバイル非表示設定の場合矢印も非表示にする
1845    $('.cparts-slideview-block').each(function() {
1846      if($('#published').length>0){
1847      if (window.matchMedia( "(min-width: 768px)" ).matches) {
1848        if ($(this).find('.cparts-slider-block').children('div').length == $(this).find('.cparts-slider-block').children('.cparts-hide-pc').length) {
1849          $(this).find('.cparts-prevbtn-block').hide();
1850          $(this).find('.cparts-nextbtn-block').hide();
1851        }else{
1852          $(this).find('.cparts-prevbtn-block').show();
1853          $(this).find('.cparts-nextbtn-block').show();
1854        }
1855      }
1856      }
1857      if (window.matchMedia( "(max-width: 767px)" ).matches) {
1858        if ($(this).find('.cparts-slider-block').children('div').length == $(this).find('.cparts-slider-block').children('.cparts-hide-mb').length) {
1859          $(this).find('.cparts-prevbtn-block').hide();
1860          $(this).find('.cparts-nextbtn-block').hide();
1861        }else{
1862          $(this).find('.cparts-prevbtn-block').show();
1863          $(this).find('.cparts-nextbtn-block').show();
1864        }
1865      }
1866    });
1867    
1868    // ステップリスト
1869    if (window.matchMedia('(max-width: 768px)').matches) {
1870      $('div[class*="cparts-id297"]').each(function() {
1871        var hi = $(this).find('.lay-col12-xs-9').find('img').outerHeight();
1872        var h = hi / 2;
1873        if ($(this).next('div').hasClass('cparts-id297--01') || $(this).next('div').hasClass('cparts-id297--02')) {
1874          if (!$(this).prev('div').hasClass('cparts-id297--01') || !$(this).prev('div').hasClass('cparts-id297--02')){
1875            $(this).find('.cparts--id295-border').css('height','calc(100% - '+h+'px)');
1876          }
1877        }
1878        if (!$(this).next('div').hasClass('cparts-id297--01') || !$(this).next('div').hasClass('cparts-id297--02')) {
1879          if ($(this).prev('div').hasClass('cparts-id297--01') || $(this).prev('div').hasClass('cparts-id297--02')){
1880            var hei = h + 40;
1881            $(this).find('.cparts--id295-border').css('height',hei+'px');
1882          }
1883        }
1884      });
1885    }
1886    $('div[class*="cparts-id297"]').each(function() {
1887      if ($(this).next('div').hasClass('cparts-id297--01') || $(this).next('div').hasClass('cparts-id297--02')) {
1888        if ($(this).prev('div').hasClass('cparts-id297--01') || $(this).prev('div').hasClass('cparts-id297--02')) {
1889          $(this).find('.cparts--id295-border').css('height', 'calc(100% + 80px)');
1890        }
1891      }else if ($(this).prev('div').hasClass('cparts-id297--01') || $(this).prev('div').hasClass('cparts-id297--02')) {
1892        }
1893    });
1894    
1895    // メイン画像_ver.15
1896    if($('.cparts-id326').length){
1897      if (window.matchMedia( '(min-width: 992px)' ).matches) {
1898        $('.cparts-id326:not([class*="cparts-mainvisual--"])').each(function(){
1899          var windowH = $(window).height();
1900          var headH = $(this).offset().top;
1901          var txtH = $(this).find('.cparts-txt-block').outerHeight();        
1902          if(windowH - headH > txtH){
1903              $(this).children('.cparts-img-block').css('height',windowH - headH);
1904             }
1905        });
1906      }
1907    }
1908
1909    // メイン画像_ver.16
1910    if($('.cparts-id327').length){
1911      $('.cparts-id327').each(function(){
1912       //タイトル.
1913        var imgH = $(this).find('.cparts-img-block').height();
1914        var footerH = $(this).find('.cparts-foot-block').height();
1915        $(this).find('.cparts-body-block').css('height',imgH - footerH);
1916        $(this).find('.cparts-img-block').css('marginTop',-(imgH - footerH));
1917        $(this).find('.cparts-img-block img').css('opacity','1');
1918
1919       var primaryC = $('.dec-bg--primary').css('background-color');
1920
1921       if (window.matchMedia( '(max-width: 767px)' ).matches) {
1922          var mobileC = primaryC.replace(')', ', 0.85)').replace('rgb', 'rgba');
1923          $('.cparts-id327 .dec-bg--primary').each(function(){
1924            $(this).css({'cssText':'background-color: ' + mobileC + ' !important;'});
1925          });
1926        } else {
1927          if(primaryC != 'rgba(0, 0, 0, 0)')
1928          {
1929            var pcC = primaryC.replace('rgb(', 'rgba(').replace(')', ',');
1930            $('.cparts-id327 .dec-bg--primary').each(function(){
1931              $(this).css({'cssText':'background: linear-gradient(to right, ' + pcC + '0) 0%,' + pcC + '1) 80%,' + pcC + '1) 100%) !important;','display':'block'});
1932            });
1933          }
1934        }
1935        //背景.
1936        var contentsBGC = $(this).find('.dec-bg--contents').css('background-color');
1937        var contentsBGC01 = contentsBGC.replace('rgb(', 'rgba(').replace(')', ',');
1938        $(this).find('.dec-bg--contents').append('<span class="cparts-foot-block" style="background: linear-gradient(to bottom, ' + contentsBGC01 + '0) 0%,' + contentsBGC01 + '1) 75%,' + contentsBGC01 + '1) 100%) !important;"> </span>');
1939
1940        var imgH = $(this).find('.cparts-img-block').height();
1941        var footerH = $(this).find('.cparts-foot-block').height();
1942        $(this).find('.cparts-body-block').css('height',imgH - footerH);
1943        $(this).find('.cparts-img-block').css('marginTop',-(imgH - footerH));
1944        $(this).find('.cparts-img-block img').css('opacity','1');
1945
1946       //タイトル.
1947       var primaryC = $('.dec-bg--primary').css('background-color');
1948       if (window.matchMedia( '(max-width: 767px)' ).matches) {
1949          var mobileC = primaryC.replace(')', ', 0.85)').replace('rgb', 'rgba');
1950          $('.cparts-id327 .dec-bg--primary').each(function(){
1951            $(this).css({'cssText':'background-color: ' + mobileC + ' !important;'});
1952          });
1953        } else {
1954          var pcC = primaryC.replace('rgb(', 'rgba(').replace(')', ',');
1955          $('.cparts-id327 .dec-bg--primary').each(function(){
1956            $(this).css({'cssText':'background: linear-gradient(to right, ' + pcC + '0) 0%,' + pcC + '1) 80%,' + pcC + '1) 100%) !important;','display':'block'});
1957          });
1958        }
1959      });
1960    }
1961    
1962    // メイン画像_ver.17
1963    // if($('.cparts-id328').length){
1964    //   $('#header .cparts-id328,#upper .cparts-id328,.header .cparts-id328,.upper .cparts-id328,.siteblock-header .cparts-id328,.siteblock-upper .cparts-id328').each(function(){
1965    //     var windowW = $(window).width();
1966    //     var windowHW = windowW / 2;
1967    //     var contentsW = $(this).width();
1968    //     var contentsHW = contentsW / 2;
1969    //     if (window.matchMedia( '(min-width: 768px)' ).matches) {
1970    //       $(this).css({'width':windowW,'marginLeft':contentsHW - windowHW,'marginRight':contentsHW - windowHW});
1971    //     } else {
1972    //       $(this).css({'marginLeft':contentsHW - windowHW,'marginRight':contentsHW - windowHW});
1973    //     }
1974        
1975    //     window.addEventListener('resize',function(){
1976    //     //格納しておいた横幅と現在の横幅が異なる時だけ発火させる
1977    //       if(windowW != $(window).width()){
1978    //         windowW = $(window).width();
1979            
1980    //         if (window.matchMedia( '(min-width: 768px)' ).matches) {
1981    //           $(this).css({'width':windowW,'marginLeft':contentsHW - windowHW,'marginRight':contentsHW - windowHW});
1982    //         } else {
1983    //           $(this).css({'marginLeft':contentsHW - windowHW,'marginRight':contentsHW - windowHW});
1984    //         }
1985    //       }
1986    //     });
1987    //   });
1988    // }
1989
1990    if ($('.cparts-id328').length) {
1991      $('#header .cparts-id328, #upper .cparts-id328, .header .cparts-id328, .upper .cparts-id328, .siteblock-header .cparts-id328, .siteblock-upper .cparts-id328').each(function () {
1992        var $this = $(this);
1993        var windowW = $(window).width();
1994        var windowHW = windowW / 2;
1995        var contentsW = $this.width();
1996        var contentsHW = contentsW / 2;
1997    
1998        function setDesktopStyles() {
1999          $this.css({
2000            'width': windowW,
2001            'marginLeft': contentsHW - windowHW,
2002            'marginRight': contentsHW - windowHW
2003          });
2004        }
2005    
2006        function setMobileStyles() {
2007          this.style.setProperty('width', '100vw', 'important');
2008          this.style.setProperty('margin-left', 'calc(50% - 50vw)', 'important');
2009          this.style.setProperty('margin-right', 'calc(50% - 50vw)', 'important');
2010        }
2011    
2012        // 初期設定
2013        if (window.matchMedia('(min-width: 768px)').matches) {
2014          setDesktopStyles();
2015        } else if (window.matchMedia('(max-width: 767px)').matches) {
2016          setMobileStyles.call(this);
2017        }
2018    
2019        // リサイズ時
2020        $(window).on('resize', function () {
2021          if (windowW != $(window).width()) {
2022            windowW = $(window).width();
2023            windowHW = windowW / 2;
2024            contentsW = $this.width();
2025            contentsHW = contentsW / 2;
2026    
2027            if (window.matchMedia('(min-width: 768px)').matches) {
2028              setDesktopStyles();
2029            } else if (window.matchMedia('(max-width: 767px)').matches) {
2030              setMobileStyles.call($this[0]);
2031            }
2032          }
2033        });
2034      });
2035    }
2036    
2037    
2038    
2039
2040    // メイン画像_ver.18
2041    if($('.cparts-id329').length){
2042      if (window.matchMedia( '(min-width: 768px)' ).matches) {
2043        $('#header .cparts-id329,.header .cparts-id329,.siteblock-header .cparts-id329').each(function(){
2044          var headH = $(this).offset().top;
2045          $(this).parents('.freeParts').prevAll().css({zIndex:'200',position:'relative'});
2046          $(this).parents('.freeParts').prevAll('.freeParts').css({backgroundColor:'transparent'});
2047          $(this).parents('.CMS_BLOCK_NAME_HEADER .freeParts').parents().prevAll().css({zIndex:'200',position:'relative'});
2048          $(this).parents('.CMS_BLOCK_NAME_HEADER .freeParts').parents().prevAll().find('.freeParts').css({backgroundColor:'transparent'});
2049          $(this).css({marginTop:-(headH),paddingTop:headH});
2050
2051          // ネガティブマージン対策(type12)
2052          if ($('.CMS_BLOCK_NAME_HEADER').length) {
2053             var nMB01 = $(this).parents('.CMS_BLOCK_NAME_HEADER .freeParts').parents().prevAll().children().css('marginBottom').replace(/[^-\d\.]/g, '');
2054            if (nMB01 < 0){
2055              $('#header .cparts-id329').css({marginTop:'+=' + nMB01 +'px'});
2056            }
2057         } else {
2058            var nMB02 = $(this).parents('.freeParts').prevAll().css('marginBottom').replace(/[^-\d\.]/g, '');
2059            if (nMB02 < 0){
2060              $('#header .cparts-id329').css({marginTop:'+=' + nMB01 +'px'});
2061            }
2062          }
2063
2064          // float対策(type02)
2065          if ($(this).parents('.freeParts').children('.box').css('clear')=='both'){
2066            $(this).parents('.freeParts').children('.box').css('clear','none');
2067            $(this).parents('.freeParts').prepend('<span style="clear: both; display: block; height: 0; overflow: hidden;"></span>');
2068          }
2069
2070          //type14対策
2071          if (window.matchMedia( '(max-width: 991px)' ).matches) {
2072            var headRH = $('.top #headerWrapper').innerHeight();
2073            var upperH = $('.top #headerWrapper #upper').innerHeight();
2074            $(this).css({height:headRH});
2075            $(this).parents('#headerWrapper').find('#upper').css({marginTop:-(upperH),position:'relative'});
2076          }
2077
2078          if (window.matchMedia( '(min-width: 992px)' ).matches) {
2079            var windowH = $(window).height();
2080
2081            if ($('.top #headerWrapper').length) {
2082              $(this).children('.cparts-img-block').css({height:windowH - headH - upperH});
2083            } else {
2084              $(this).children('.cparts-img-block').css({height:windowH - headH});
2085            }
2086          }
2087        });
2088      }
2089    }
2090    
2091    // バナー01
2092    $('.cparts-id311--01').each(function() {
2093      var col = $(this).find('.dec-bg--primary').css('background-color');
2094      $(this).append('<style>.cparts-id311--01 .cparts-img-block:before{background: linear-gradient(to right,rgba(255,255,255,0) 0,'+col+' 80%);}div.cparts-id311--01.cparts-id311-column .cparts-img-block:before{background: linear-gradient(rgba(255,255,255,0) 0, '+col+' 80%);}</style>');
2095    });
2096    $('.cparts-id311--02').each(function() {
2097      var col = $(this).find('.dec-bg--primary').css('background-color');
2098      $(this).append('<style>.cparts-id311--02 .cparts-img-block:before{background: linear-gradient(to left,rgba(255,255,255,0) 0,'+col+' 80%);}div.cparts-id311--02.cparts-id311-column .cparts-img-block:before{background: linear-gradient(to top,rgba(255,255,255,0) 0, '+col+' 80%);}</style>');
2099    });
2100    $('.cparts-id311--03').each(function() {
2101      var col = $(this).find('.dec-bg--primary').css('background-color');
2102      $(this).append('<style>.cparts-id311--03 .cparts-img-block:before{background: linear-gradient(to bottom left,rgba(255,255,255,0) 50%,'+col+' 51%)}.cparts-id311--03 .cparts-img-block:after{background:linear-gradient(to top right,rgba(255,255,255,0) 50%,'+col+' 51%);}div.cparts-id311--03.cparts-id311-column .cparts-img-block:before{background:linear-gradient(to bottom left,'+col+' 51%,rgba(255,255,255,0) 50%);}div.cparts-id311--03.cparts-id311-column .cparts-img-block:after{background:linear-gradient(to bottom left,rgba(255,255,255,0) 50%,'+col+' 51%);}</style>');
2103      if ($(this).find('.cparts-img-block').outerWidth() < 410) {
2104          $(this).find('.cparts-notes-block').css('right', '-70px');
2105      }
2106    });
2107    $('.cparts-id311--04').each(function() {
2108      var col = $(this).find('.dec-bg--primary').css('background-color');
2109      $(this).append('<style>.cparts-id311--04 .cparts-img-block:before{background: linear-gradient(to bottom right,rgba(255,255,255,0) 50%,'+col+' 51%)}.cparts-id311--04 .cparts-img-block:after{background:linear-gradient(to top left,rgba(255,255,255,0) 50%,'+col+' 51%);}div.cparts-id311--04.cparts-id311-column .cparts-img-block:before{background:linear-gradient(to top left,'+col+' 51%,rgba(255,255,255,0) 50%);}div.cparts-id311--04.cparts-id311-column .cparts-img-block:after{background:linear-gradient(to top left,rgba(255,255,255,0) 50%,'+col+' 51%);}</style>');
2110      if ($(this).find('.cparts-img-block').outerWidth() < 410) {
2111          $(this).find('.cparts-notes-block').css('left', '-70px');
2112      }
2113    });
2114    
2115    // バナー04
2116    $('.cparts-id318--01').each(function() {
2117      var col = $(this).find('.dec-bg--dark').css('background-color');
2118      var c = String(col).slice(0,-1);
2119      var color = String(c).slice(3);
2120      $(this).find('.cparts-body-block').css({'cssText': 'background-color: rgba'+color+',.75) !important'});
2121      
2122      var maxHeight = 0;
2123      $(this).find('.cparts-body-block').each(function() {
2124          var bodyHeight = $(this).outerHeight();
2125          // スマホ以外の場合は最大の高さを取得
2126          if ($(window).width() > 768) {
2127              if (bodyHeight > maxHeight) maxHeight = bodyHeight;
2128          } else {
2129              // スマホの場合はそれぞれの高さを設定
2130              $(this).siblings('.cparts-img-block').css('height', bodyHeight + 60 + 'px');
2131          }
2132      });
2133
2134      // スマホ以外の場合、最大の高さを画像ブロックに設定
2135      if ($(window).width() > 768) {
2136          $(this).find('.cparts-body-block').css('height', maxHeight + 'px');
2137          $(this).find('.cparts-img-block').css('height', maxHeight + 60 + 'px');
2138      }
2139    });
2140    setTimeout(function(){
2141      $('.cparts-id318--02').each(function() {
2142        if ($(this).find('h3').css('color') == 'rgb(255, 255, 255)') {
2143          $(this).find('h3').addClass('dec-txt--primary');
2144        }
2145        var height = $(this).find('.cparts-head-block').outerHeight() + 60;
2146        if(height > 200){
2147          $(this).find('.cparts-img-block').find('img').css('height', height+'px');
2148          $(this).find('.cparts-img-block').css('height', height+'px');
2149        }
2150      });
2151    },500);
2152  
2153    /* -------------------------------------------------------
2154      2023年追加
2155    -------------------------------------------------------- */
2156    // id467の疑似要素(::before)の背景色変更
2157    $('.cparts-animation--bgUDextend').each(function() {
2158      var col = $(this).siblings('.dec-bg--primary').css('background-color');
2159      $(this).append('<style>.cparts-animation--bgUDextend::before {background-color: '+col+'}</style>');
2160    });
2161    
2162    // メイン画像_ver.22
2163    $('.cparts-id533.cparts-mainvisual--sm,body:not(.column1) #contents #upper .cparts-id533,.column2 #contents #upper .cparts-id533,.column2 .row .upper .cparts-id533,#main .cparts-id533 ,#bottom .cparts-id533 ,#side .cparts-id533 ,#right .cparts-id533 ,#opt1 .cparts-id533 ,#opt2 .cparts-id533 ,#opt3 .cparts-id533 ,#footer .cparts-id533 ,.main .cparts-id533 ,.bottom .cparts-id533 ,.side .cparts-id533 ,.right .cparts-id533 ,.opt1 .cparts-id533 ,.opt2 .cparts-id533 ,.opt3 .cparts-id533 ,.footer .cparts-id533 ,.siteblock-main .cparts-id533 ,.siteblock-bottom .cparts-id533 ,.siteblock-side .cparts-id533 ,.siteblock-right .cparts-id533 ,.siteblock-opt1 .cparts-id533 ,.siteblock-opt2 .cparts-id533 ,.siteblock-opt3 .cparts-id533 ,.siteblock-footer .cparts-id533').each(function() {
2164      $(this).find('.cparts-caption-block').remove();
2165    });
2166
2167
2168    
2169    // 新・画像/スクロールテキスト
2170    $('.cparts-id88').each(function() {
2171      const $container = $(this);
2172      const $img = $container.find('.cparts-img-block img');
2173    
2174      // 画像が読み込まれているか確認
2175      if ($img[0].complete) {
2176        const h = $img.height();
2177        $container.find('.cparts-txt-block').css('height', h);
2178      } else {
2179        $img.on('load', function () {
2180          const h = $img.height();
2181          $container.find('.cparts-txt-block').css('height', h);
2182        });
2183      }
2184    });
2185    
2186    /* -------------------------------------------------------
2187      2024年追加
2188    -------------------------------------------------------- */
2189    // メイン画像_ver.27
2190    if ($('.cparts-id570').length && $(window).width() >= 768) { // タブレット以上のサイズでチェック
2191        $('.cparts-id570').each(function() {
2192            var id570_imgBlockHeight = $(this).find('.cparts-img-block:nth-child(1)').outerHeight(); // .cparts-img-block:nth-child(1)の高さ(marginを含む)
2193            var id570_headBlockHeight = $(this).find('.cparts-head-block').outerHeight(); // .cparts-head-blockの高さ(marginを含む)
2194            var id570_bodyBlockHeight = $(this).find('.cparts-body-block').outerHeight();
2195
2196            // .cparts-head-blockの高さが.imgBlockよりも大きい場合、親要素の高さを設定
2197            if (id570_bodyBlockHeight > id570_imgBlockHeight + id570_headBlockHeight + 40) {
2198                $(this).css('height', id570_bodyBlockHeight + 'px');
2199            } else {
2200                $(this).css('height', '');
2201            }
2202        });
2203    }
2204    
2205    // メイン画像_ver.28
2206    if ($('.cparts-id575').length) {
2207      $('.cparts-id575').each(function() {
2208        var txtBlock = $(this).find('.cparts-txt-block');
2209        var txtBlockHeight = txtBlock.outerHeight();
2210        var imgBlock = $(this).find('.cparts-img-block');
2211        var imgBlockHeight = imgBlock.outerHeight();
2212
2213        // '.cparts-img-block' 要素が '.cparts-txt-block' よりも小さい場合
2214        if (imgBlockHeight < txtBlockHeight + 180) {
2215          imgBlock.css('height', (txtBlockHeight + 180) + 'px'); // height を設定
2216        }
2217      });
2218    } 
2219
2220    /* -------------------------------------------------------
2221      2025年追加
2222    -------------------------------------------------------- */
2223    // ローディングアニメーション
2224    if ($('.cparts-id592').length) {
2225      const targetSelectors = [
2226        '#header', '#upper', '#main', '#bottom', '#side', '#right', '#opt1', '#opt2', '#opt3', '#footer',
2227        '.header', '.upper', '.main', '.bottom', '.side', '.right', '.opt1', '.opt2', '.opt3', '.footer',
2228        '.siteblock-header', '.siteblock-upper', '.siteblock-main', '.siteblock-bottom', '.siteblock-side', '.siteblock-right',
2229        '.siteblock-opt1', '.siteblock-opt2', '.siteblock-opt3', '.siteblock-footer'
2230      ];
2231    
2232      // スクロール制御関数
2233      function disableScroll() {
2234        $('html, body').css({
2235          overflow: 'hidden',
2236          height: '100%',
2237          'touch-action': 'none',
2238          '-webkit-overflow-scrolling': 'auto'
2239        });
2240      }
2241    
2242      function enableScroll() {
2243        $('html, body').css({
2244          overflow: '',
2245          height: '',
2246          'touch-action': '',
2247          '-webkit-overflow-scrolling': ''
2248        });
2249        setTimeout(() => {
2250          window.scrollTo(window.scrollX, window.scrollY); // iOS対策
2251        }, 50);
2252      }
2253    
2254      let $loadingParts = null;
2255      let $parentBlock = null;
2256    
2257      targetSelectors.some(selector => {
2258        const $rows = $(selector).find('.cparts-body-block').filter(function () {
2259          return $(this).closest('.cparts-id592').length > 0;
2260        });
2261    
2262        if ($rows.length) {
2263          $loadingParts = $rows.first();
2264          $parentBlock = $loadingParts.closest(targetSelectors.join(','));
2265          return true;
2266        }
2267        return false;
2268      });
2269    
2270      if ($loadingParts) {
2271        const $parent = $loadingParts.closest('.cparts-id592');
2272    
2273        if ($parent.hasClass('cparts-loading--fadein')) {
2274          handleFadeAnimation($loadingParts, $parentBlock);
2275        } else if ($parent.hasClass('cparts-loading--slideup')) {
2276          handleSlideUpAnimation($parent, $parentBlock);
2277        } else if ($parent.hasClass('cparts-loading--reveal')) {
2278          handleRevealAnimation($parent, $parentBlock);
2279        } else {
2280          handleFadeAnimation($loadingParts, $parentBlock);
2281        }
2282      }
2283    
2284      // =========================
2285      // 各ローディング処理
2286      // =========================
2287    
2288      function handleFadeAnimation($loadingParts, $zTarget, callback) {
2289        const $blocks = $loadingParts.find('.cparts-txt-block');
2290        const $parent = $loadingParts.closest('.cparts-id592');
2291      
2292        if ($('#cms_contents_area').length) {
2293          $blocks.css({ display: 'block', opacity: 1 });
2294          if (typeof callback === 'function') callback();
2295          return;
2296        }
2297      
2298        disableScroll();
2299      
2300        // 固定レイアウト化
2301        $parent.css({
2302          position: 'fixed',
2303          top: 0,
2304          left: 0,
2305          width: '100%',
2306          height: '100%',
2307          zIndex: 9999
2308        });
2309      
2310        // 強制的に表示+opacityアニメーション
2311        $blocks.css({ display: 'block', opacity: 0 }).animate({ opacity: 1 }, 1500, function () {
2312          setTimeout(() => {
2313            $parent.fadeOut(1500, function () {
2314              $parent.remove(); // display:none ではなく remove()
2315              if ($zTarget) $zTarget.css({
2316                'z-index': '',
2317                'position': ''
2318              });
2319              enableScroll();
2320              if (typeof callback === 'function') callback();
2321            });
2322          }, 1000);
2323        });
2324      }
2325      
2326    
2327      function handleSlideUpAnimation($parent, $zTarget, callback) {
2328        if ($('#cms_contents_area').length) {
2329          $parent.show();
2330          if (typeof callback === 'function') callback();
2331          return;
2332        }
2333    
2334        disableScroll();
2335    
2336        const $content = $parent.find('.cparts-body-block > div');
2337    
2338        $content.css({ display: 'block' }).animate({ opacity: 1 }, 1000, function () {
2339          setTimeout(() => {
2340            $parent.css({
2341              transition: 'transform 1.1s ease-in-out',
2342              transform: 'translateY(-100%)'
2343            });
2344    
2345            setTimeout(() => {
2346              $parent.remove();
2347              if ($zTarget) $zTarget.css({
2348              'z-index': '',
2349              'position': ''
2350            });
2351              enableScroll();
2352              if (typeof callback === 'function') callback();
2353            }, 1000);
2354          }, 1000);
2355        });
2356      }
2357    
2358      function handleRevealAnimation($parent, $zTarget, callback) {
2359        if ($('#cms_contents_area').length) {
2360          if (typeof callback === 'function') callback();
2361          return;
2362        }
2363    
2364        disableScroll();
2365    
2366        const $content = $parent.find('.cparts-body-block > div');
2367    
2368        $parent.css({
2369          'clip-path': 'circle(150% at 50% 50%)',
2370          '-webkit-clip-path': 'circle(150% at 50% 50%)',
2371          'transition': 'clip-path 1.5s ease-in-out, -webkit-clip-path 1.5s ease-in-out',
2372          'overflow': 'hidden',
2373          'z-index': 9999,
2374          'position': 'fixed',
2375          'top': 0,
2376          'left': 0,
2377          'width': '100%',
2378          'height': '100%'
2379        });
2380    
2381        void $parent[0].offsetWidth;
2382    
2383        $content.css({ display: 'block' }).animate({ opacity: 1 }, 1000, function () {
2384          setTimeout(() => {
2385            $parent.css({
2386              'clip-path': 'circle(0% at 50% 50%)',
2387              '-webkit-clip-path': 'circle(0% at 50% 50%)'
2388            });
2389          }, 100);
2390    
2391          setTimeout(() => {
2392            $parent.remove();
2393            if ($zTarget) $zTarget.css({
2394              'z-index': '',
2395              'position': ''
2396            });
2397            enableScroll();
2398            if (typeof callback === 'function') callback();
2399          }, 1700);
2400        });
2401      }
2402    
2403      // =========================
2404      // 初期 z-index セット
2405      // =========================
2406      $(document).ready(function () {
2407        if (!$('#cms_contents_area').length) {
2408          $(targetSelectors.join(',')).has('.cparts-id592').css({
2409            position: 'relative',
2410            zIndex: 999
2411          });
2412        }
2413      });
2414    
2415      // =========================
2416      // 保険:window load 時にも実行
2417      // =========================
2418      $(window).on('load', function () {
2419        const $slideup = $('.cparts-id592.cparts-loading--slideup');
2420        if ($slideup.length) {
2421          handleSlideUpAnimation($slideup, $slideup.closest(targetSelectors.join(',')));
2422        }
2423    
2424        const $reveal = $('.cparts-id592.cparts-loading--reveal');
2425        if ($reveal.length) {
2426          handleRevealAnimation($reveal, $reveal.closest(targetSelectors.join(',')));
2427        }
2428      });
2429    }
2430  });
2431
2432  // テキスト/流れる画像_ver.1
2433  $(window).on('load', function () {
2434    const $targets = $('.cparts-id599--01, .cparts-id599--02');
2435  
2436    if (!$targets.length) return;
2437  
2438    $targets.each(function () {
2439      const $target = $(this);
2440  
2441      // 自身または内部に対象クラスが存在するか判定
2442      const hasAnimationClass =
2443        $target.is('.cparts-animate--slideUpDown, .cparts-animate--slideDownUp, .cparts-animate--slideBothDown') ||
2444        $target.find('.cparts-animate--slideUpDown, .cparts-animate--slideDownUp, .cparts-animate--slideBothDown').length > 0;
2445  
2446        if (!hasAnimationClass && $('#cms_contents_area').length) {
2447          $target.find('.cparts-img-block').css('position', 'static');
2448          $target.find('.cparts-body-block .cparts-body-block').css('display', 'flex');
2449          return;
2450        }
2451  
2452      // 通常処理
2453      const blocks = $target.find('.cparts-img-block');
2454      let globalIndex = 0; // ← グローバルなインデックスで判定
2455  
2456      blocks.each(function () {
2457        const $block = $(this);
2458        const $images = $block.find('img');
2459        const wrapper = $('<div class="scroll-wrapper"></div>');
2460  
2461        // 画像を2回ループして追加
2462        $images.each(function () {
2463          wrapper.append($(this).clone());
2464        });
2465        $images.each(function () {
2466          wrapper.append($(this).clone());
2467        });
2468  
2469        $block.empty().append(wrapper);
2470  
2471        // 最初のブロックだけスクロール方向を変える
2472        const direction = globalIndex === 0 ? 'scroll-up' : 'scroll-down';
2473        wrapper.addClass(direction);
2474  
2475        globalIndex++;
2476      });
2477    });
2478  });
2479  
2480  
2481  
2482  
2483
2484// 流れるライン系画像、テキスト
2485$('.cparts-id594.cparts-decoslider-block02.cparts-current--rightleft').each(function(){
2486  var loopslider = $(this).find('ul').clone(true);
2487  var loopsliderW = $(this).find('ul').width();
2488  var loopsliderH = $(this).find('ul').height();
2489  var self = $(this);
2490
2491  $(this).find('.cparts-copy-block')
2492    .append(loopslider)
2493    .css({ display: 'flex', height: loopsliderH + 'px' });
2494
2495  $(this).find('ul').wrapAll('<div class="cparts-loopslider--wrap02"></div>');
2496  $(this).find('.cparts-loopslider--wrap02').css({ width: (loopsliderW * 2) + 'px' });
2497
2498  if ($(this).hasClass('cparts-current--rightleft')) {
2499    const self = $(this);
2500    const isSp = window.matchMedia('(max-width: 767px)').matches;
2501    const duration = isSp ? 25000 : 45000;
2502  
2503    function loopMove() {
2504      self.find('.cparts-loopslider--wrap02').animate(
2505        { left: '-' + loopsliderW + 'px' },
2506        duration,
2507        'linear',
2508        function () {
2509          self.find('.cparts-loopslider--wrap02').css({ left: '0' });
2510          loopMove();
2511        }
2512      );
2513    }
2514  
2515    loopMove();
2516  }
2517});
2518
2519if ($('.cparts-id594').length) {
2520  $('.cparts-id594 .cparts-img-block > div a').on('click', function (e) {
2521    e.preventDefault();
2522
2523    // クリックされたa要素から最も近い親の.cparts-id594を取得
2524    var $parent = $(this).closest('.cparts-id594');
2525
2526    // 親要素の下端までの位置を取得
2527    var targetOffset = $parent.offset().top + $parent.outerHeight();
2528
2529    $('html, body').animate({
2530      scrollTop: targetOffset
2531    }, 800);
2532  });
2533}
2534if ($('.cparts-decoslider-block02').length) {
2535  var timer = false;
2536  var prewidth = $(window).width();
2537  $(window).resize(function() {
2538  if (timer !== false) {
2539  clearTimeout(timer);
2540  }
2541  timer = setTimeout(function() {
2542  var nowWidth = $(window).width();
2543  if(prewidth !== nowWidth){
2544  // リロード
2545  location.reload();
2546  }
2547  prewidth = nowWidth;
2548  }, 10);
2549  });
2550}
2551
2552// 一覧パーツ_ver.12
2553if ($('.cparts-id291--03').length) {
2554  $(function () {
2555    if ($('#cms_contents_area').length === 0) {
2556      $('.cparts-id291--03').each(function () {
2557        const $container = $(this);
2558        const $icon = $container.find('.cparts-footer-block .cparts-icon-block');
2559        const $txtBlock = $container.find('.cparts-body-block > .cparts-txt-block').first();
2560
2561        // 既に移動済みでないことを確認
2562        if ($icon.length && $txtBlock.length && !$txtBlock.find('.cparts-icon-block').length) {
2563          $icon.appendTo($txtBlock);
2564        }
2565      });
2566    }
2567  });
2568}
2569
2570// 画像横スライド(画像3枚)
2571// 画像横スライド(画像4枚)
2572// 画像横スライド(画像5枚)
2573$(function () {
2574  const isEditor = $('#cms_contents_area').length > 0;
2575  const $blocks = $('.cparts-id605--01, .cparts-id605--02, .cparts-id605--03');
2576
2577  // 対象クラスが存在する場合のみ処理を実行
2578  if ($blocks.length) {
2579    $(window).on('load', function () {
2580      $blocks.each(function () {
2581        const $section = $(this);
2582        const $imgBlock = $section.find('.cparts-img-block');
2583        const $imgs = $imgBlock.find('img');
2584        const imgCount = $imgs.length;
2585
2586        if (isEditor) {
2587          $imgBlock
2588            .addClass('editor-mode')
2589            .css({ display: 'flex', transform: 'none', width: '100%' });
2590
2591          if (imgCount === 3) $imgBlock.addClass('imgcount--3');
2592          if (imgCount === 4) $imgBlock.addClass('imgcount--4');
2593          return;
2594        }
2595
2596        // クローン処理
2597        const clones = [];
2598        if (imgCount === 3) {
2599          for (let i = 0; i < 12; i++) {
2600            clones.push($imgs.eq(i % imgCount).clone()[0]);
2601          }
2602        } else if (imgCount === 4) {
2603          for (let i = 0; i < 16; i++) {
2604            clones.push($imgs.eq(i % imgCount).clone()[0]);
2605          }
2606        } else if (imgCount === 5) {
2607          let totalWidth = $imgBlock[0].scrollWidth;
2608          let cloneIndex = 0;
2609          while (totalWidth < $imgBlock.outerWidth() * 3 && cloneIndex < 30) {
2610            const clone = $imgs.eq(cloneIndex % imgCount).clone();
2611            $imgBlock.append(clone);
2612            totalWidth = $imgBlock[0].scrollWidth;
2613            cloneIndex++;
2614          }
2615        }
2616
2617        if (clones.length) {
2618          $imgBlock.append(clones);
2619        }
2620
2621        // スライドアニメーション(ブロックごと)
2622        if (!isEditor) {
2623          const slideState = {
2624            currentX: null,
2625            lastDirection: null
2626          };
2627
2628          function animateBlock() {
2629            const rect = $section[0].getBoundingClientRect();
2630            const windowHeight = window.innerHeight;
2631
2632            if (rect.top < windowHeight && rect.bottom > 0) {
2633              const scrollRatio = (windowHeight - rect.top) / (windowHeight + rect.height);
2634
2635              // スライド方向を判定
2636              let direction;
2637              if ($section.hasClass('cparts-slide--rightLeft')) {
2638                direction = 'rightLeft';
2639              } else {
2640                // leftRight or クラスなし
2641                direction = 'leftRight';
2642              }
2643
2644              const maxSlide = 140;
2645              const signedRatio = direction === 'rightLeft'
2646                ? scrollRatio * -maxSlide   // 右 → 左 = 負の方向
2647                : scrollRatio * maxSlide;   // 左 → 右 = 正の方向
2648
2649              // 方向が切り替わったら初期化
2650              if (slideState.lastDirection !== direction || slideState.currentX === null) {
2651                slideState.currentX = signedRatio;
2652                slideState.lastDirection = direction;
2653              } else {
2654                slideState.currentX += (signedRatio - slideState.currentX) * 0.2;
2655              }
2656
2657              $imgBlock.css('transform', `translateX(${slideState.currentX}%)`);
2658            }
2659
2660            requestAnimationFrame(animateBlock);
2661          }
2662
2663          requestAnimationFrame(animateBlock);
2664        }
2665      });
2666    });
2667  }
2668});
2669
2670
2671/* パララックスパーツ(画像/見出し・テキスト)/ パララックスパーツ(見出し・テキスト/画像)*/
2672jQuery(function($){
2673  var $win = $(window);
2674
2675  function updateParallax(){
2676    var scrollTop = $win.scrollTop();
2677    var winHeight = $win.height();
2678
2679    // ===== スピード・スタート位置を画面幅で調整 =====
2680    var baseBgSpeed, baseImgSpeed, baseStartY, baseStopY;
2681    var isMobile = window.matchMedia("(max-width: 991px)").matches;
2682
2683    if (isMobile) {
2684      // スマホ用
2685      baseBgSpeed  = 0.1;
2686      baseImgSpeed = 0.25;
2687      baseStartY   = 100;
2688      baseStopY    = 0;
2689    } else {
2690      // PC/タブレット用
2691      baseBgSpeed  = 0.15;
2692      baseImgSpeed = 0.5;
2693      baseStartY   = 200;
2694      baseStopY    = 0;
2695    }
2696
2697    // ===== 対象ブロック =====
2698    $('.cparts-id612--01, .cparts-id612--02').each(function(){
2699
2700      var $container   = $(this);
2701      var containerTop = $container.offset().top;
2702      var containerH   = $container.outerHeight();
2703      var $img         = $container.find('.cparts-img-block img');
2704
2705      // --- 初期値(ベース値から複製) ---
2706      var bgSpeed  = baseBgSpeed;
2707      var imgSpeed = baseImgSpeed;
2708      var startY   = baseStartY;
2709      var stopY    = baseStopY;
2710
2711      // --- slow / fast の調整(スマホ) ---
2712      if (isMobile) {
2713        if ($container.hasClass('cparts-slow')) {
2714          bgSpeed  = baseBgSpeed - 0.05;
2715          imgSpeed = baseImgSpeed - 0.05;
2716          startY   = 100;
2717        } else if ($container.hasClass('cparts-fast')) {
2718          bgSpeed  = baseBgSpeed;
2719          imgSpeed = baseImgSpeed + 3;
2720          startY   = 200;
2721        }
2722      }
2723
2724      // --- slow / fast(PC) ---
2725      if (!isMobile) {
2726        if ($container.hasClass('cparts-slow')) {
2727          bgSpeed  = baseBgSpeed - 0.05;
2728          imgSpeed = baseImgSpeed - 0.15;
2729          startY   = 200;
2730        } else if ($container.hasClass('cparts-fast')) {
2731          bgSpeed  = baseBgSpeed + 0.2;
2732          imgSpeed = baseImgSpeed + 2;
2733          startY   = 200;
2734          stopY    = 0;
2735        }
2736      }
2737
2738      /* ============================================================
2739         ★ 画面内外に関係なく、事前に startY と stopY を上書きする
2740      ============================================================ */
2741      var forceStartStop =
2742        $img.closest('#type2column02 #wrapper #opt').length ||
2743        $img.closest('#type2column02 #side').length ||
2744        $img.closest('#bootstrap_template #side').length ||
2745        $img.closest('#type2column02 #wrapper #contents #opt2').length ||
2746        $img.closest('.pagetemp-column2 .container .row .siteblock-side').length ||
2747        $img.closest('.pagetemp-column2 .lay-container-xl .lay-row .siteblock-side').length;
2748
2749      if (forceStartStop) {
2750        startY = 40;  // 初期位置
2751        stopY  = 0;   // 固定位置
2752      }
2753
2754      /* ============================================================
2755         パララックス処理(背景 + 画像)
2756      ============================================================ */
2757
2758      if (scrollTop + winHeight > containerTop && scrollTop < containerTop + containerH) {
2759
2760        /* ===== 背景画像 ===== */
2761        var diff = (scrollTop + winHeight) - containerTop;
2762        var bgY  = -(diff * bgSpeed);
2763        $container.css('background-position', 'center ' + bgY + 'px');
2764
2765        /* ===== 画像 ===== */
2766        var diffImg = (scrollTop + winHeight) - containerTop;
2767        var moveY   = startY - (diffImg * imgSpeed);
2768
2769        if (moveY <= stopY) moveY = stopY;
2770
2771        $img.css('transform','translateY(' + moveY + 'px)');
2772
2773      } else if (scrollTop + winHeight <= containerTop) {
2774        // ===== 画面外の場合(初期位置へ戻す) =====
2775        $container.css('background-position', 'center 0');
2776        $img.css('transform','translateY(' + startY + 'px)');
2777      }
2778
2779    });
2780  }
2781
2782  $win.on('scroll resize', updateParallax);
2783  updateParallax();
2784
2785});
2786
2787
2788
2789  window.addEventListener('resize', function(){
2790    
2791      // バナー01
2792      $('div[class*="cparts-id311"]').each(function() {
2793        if ($(this).outerWidth() <= 480) {
2794            $(this).addClass('cparts-id311-column');
2795        }else{
2796          $(this).removeClass('cparts-id311-column');
2797        }
2798        var height = $(this).find('.cparts-txt-block').outerHeight() + 60;
2799        $(this).find('.cparts-img-block').find('img').css('height', height+'px');
2800        $(this).find('.cparts-img-block').css('height', height+'px');
2801      });
2802    
2803      // バナー02
2804      $('div[class*="cparts-id315"]').each(function() {
2805        if ($(this).find('.cparts-img-block').outerWidth() < 300) {
2806            $(this).addClass('cparts-id315-column');
2807        }else {
2808          $(this).removeClass('cparts-id315-column');
2809        }
2810        var height = $(this).find('.cparts-body-block').outerHeight() +30;
2811          $(this).find('.cparts-img-block').find('img').css('height', height+'px');
2812          $(this).find('.cparts-img-block').css('height', height+'px');
2813        if ($(this).find('h4').css('color') == $(this).find('.dec-bg--primary').css('background-color')) {
2814          $(this).find('h4').css('color','#fff');
2815        }
2816      });
2817    
2818      // バナー03
2819      $('div[class*="cparts-id317"]').each(function() {
2820        if ($(this).outerWidth() <= 480) {
2821            $(this).addClass('cparts-id317-column');
2822        }else {
2823          $(this).removeClass('cparts-id317-column');
2824        }
2825        var height = $(this).find('.cparts-txt-block').children('div').outerHeight() + 60;
2826          $(this).find('.cparts-img-block').find('img').css('height', height+'px');
2827          $(this).find('.cparts-img-block').css('height', height+'px');
2828      });
2829    
2830      // バナー04
2831      $('div[class*="cparts-id318"]').each(function() {
2832          if ($(this).children('div').outerWidth() < 250) {
2833              $(this).addClass('cparts-id318-column');
2834          }else {
2835              $(this).removeClass('cparts-id318-column');
2836          }
2837      });
2838      setTimeout(function(){
2839        $('.cparts-id318--01').each(function() {
2840          var height = $(this).find('.cparts-body-block').outerHeight() + 60;
2841            $(this).find('.cparts-img-block').find('img').css('height', height+'px');
2842            $(this).find('.cparts-img-block').css('height', height+'px');
2843        });
2844        $('.cparts-id318--02').each(function() {
2845          if ($(this).find('h3').css('color') == 'rgb(255, 255, 255)') {
2846            $(this).find('h3').addClass('dec-txt--primary');
2847          }
2848          var height = $(this).find('.cparts-head-block').outerHeight() + 60;
2849            $(this).find('.cparts-img-block').find('img').css('height', height+'px');
2850            $(this).find('.cparts-img-block').css('height', height+'px');
2851        });
2852      },500);
2853    
2854  });
2855  
2856  $(window).scroll(function () {
2857    
2858    /* -------------------------------------------------------
2859      2021年追加
2860    -------------------------------------------------------- */
2861    // 【ブロークングリッドレイアウト】アニメーション用class追加
2862    $('.cparts-id286--01 .cparts-js-block,.cparts-id286--02 .cparts-js-block').each(function(){
2863      var imgPos = $(this).offset().top;
2864      var scroll = $(window).scrollTop();
2865      var windowHeight = $(window).height();
2866      if (scroll > imgPos - windowHeight + windowHeight/5){
2867        $(this).addClass('cparts-fadeIn--id286');
2868      }
2869    });
2870    
2871  });
2872  
2873  $(document).ready(function() {
2874    
2875    /* -------------------------------------------------------
2876      2024年追加
2877    -------------------------------------------------------- */
2878    // フローティングバナー
2879    function setParentWidth() {
2880      // ウィンドウ幅が768px以上の場合のみ処理を実行
2881      if ($(window).width() >= 768) {
2882      const childWidth = $('.cparts-link-block').width();
2883      $('.cparts-id582').width(childWidth); // 子要素の幅に合わせる
2884      } else {
2885      // 768px未満の場合、親要素の幅をリセットしたい場合は以下を使用
2886      $('.cparts-id582').css('width', ''); // 幅リセット
2887      }
2888    }
2889
2890    // 初回設定
2891    setParentWidth();
2892
2893    // ウィンドウリサイズ時にも幅を再設定
2894    $(window).resize(setParentWidth);
2895  });
2896  
2897});})(jQuery);
2898
2899// jQuery 3.7.1 でも $(window).on('load', fn) を“確実に”動かす最小シム
2900(function ($) {
2901  if (!$.fn || !$.fn.on) return;
2902  var _on = $.fn.on;
2903
2904  $.fn.on = function (types, selector, data, handler) {
2905    try {
2906      // $(window).on('load', fn) パターンを捕捉
2907      if (this.length === 1 && this[0] === window && typeof types === 'string' && types.indexOf('load') !== -1) {
2908        // 渡された引数からハンドラを特定
2909        var fn = (typeof selector === 'function') ? selector
2910               : (typeof data === 'function')     ? data
2911               : (typeof handler === 'function')  ? handler
2912               : null;
2913
2914        // すでに load 済みなら即実行(=取り逃し救済)
2915        if (fn && document.readyState === 'complete') {
2916          try { fn.call(window); } catch (e) {}
2917          // 既存の .on 自体は通常どおり呼んでおく(将来の pageshow 等に備える)
2918        }
2919      }
2920    } catch (e) {}
2921    return _on.apply(this, arguments);
2922  };
2923})(jQuery);
2924  
2925
2926/* -------------------------------------------------------
2927  2026年追加
2928-------------------------------------------------------- */
2929(function () {
2930  function initCurtain() {
2931    var rows = document.querySelectorAll('.cparts-id615 .lay-row');
2932
2933    if (!('IntersectionObserver' in window)) {
2934      rows.forEach(function (row) {
2935        row.classList.add('cparts-curtain--open');
2936      });
2937      return;
2938    }
2939
2940    var observer = new IntersectionObserver(function (entries, obs) {
2941      entries.forEach(function (entry) {
2942        if (entry.isIntersecting) {
2943
2944          setTimeout(function () {
2945            entry.target.classList.add('cparts-curtain--open');
2946            obs.unobserve(entry.target);
2947          }, 300);
2948
2949        }
2950      });
2951    }, { threshold: 0.3 });
2952
2953    rows.forEach(function (row) {
2954      observer.observe(row);
2955    });
2956  }
2957
2958  if (document.readyState === 'loading') {
2959    document.addEventListener('DOMContentLoaded', initCurtain);
2960  } else {
2961    initCurtain();
2962  }
2963})();
2964
2965document.addEventListener('DOMContentLoaded', function () {
2966
2967  document.querySelectorAll('.cparts-id616').forEach(function (parts) {
2968    var ttl = parts.querySelector('.cparts-id616__ttl');
2969    if (!ttl) return;
2970
2971    // いったん全て外す(再実行・data-reload 対策)
2972    ttl.classList.remove(
2973      'dec-line--primary', 'dec-txt--primary',
2974      'dec-line--secondary', 'dec-txt--secondary',
2975      'dec-line--dark', 'dec-txt--dark'
2976    );
2977
2978    if (parts.classList.contains('cparts-hColor--mainColor')) {
2979      ttl.classList.add('dec-line--primary', 'dec-txt--primary');
2980
2981    } else if (parts.classList.contains('cparts-hColor--subColor')) {
2982      ttl.classList.add('dec-line--secondary', 'dec-txt--secondary');
2983
2984    } else if (parts.classList.contains('cparts-hColor--accentColor')) {
2985      ttl.classList.add('dec-line--dark', 'dec-txt--dark');
2986
2987    } else {
2988      // ★ 何も指定がない場合のデフォルト
2989      ttl.classList.add('dec-line--primary', 'dec-txt--primary');
2990    }
2991  });
2992
2993});
2994
2995document.addEventListener('DOMContentLoaded', function () {
2996  // 1. 対象要素の取得(アンダーラインアニメーション対象)
2997  var targets = document.querySelectorAll(
2998    'h3.cparts-id619, h4.cparts-id620, h5.cparts-id621, h6.cparts-id622'
2999  );
3000
3001  if (!targets.length) return;
3002
3003  // --- A. Margin自動調整処理 ---
3004  // 各要素の text-align を見て、margin: auto を付与する
3005  Array.prototype.forEach.call(targets, function (el) {
3006    // 計算済みのスタイルを取得
3007    const textAlign = window.getComputedStyle(el).getPropertyValue('text-align');
3008
3009    if (textAlign === 'right') {
3010      el.style.setProperty('margin-left', 'auto', 'important');
3011    } else if (textAlign === 'left') {
3012      el.style.setProperty('margin-right', 'auto', 'important');
3013    } else if (textAlign === 'center') {
3014      el.style.setProperty('margin-left', 'auto', 'important');
3015      el.style.setProperty('margin-right', 'auto', 'important');
3016    }
3017  });
3018
3019  // --- B. スクロール監視処理 (IntersectionObserver) ---
3020  // 古い環境向けのフォールバック
3021  if (!('IntersectionObserver' in window)) {
3022    Array.prototype.forEach.call(targets, function (el) {
3023      el.classList.add('cparts-underLineAnimation-active');
3024    });
3025    return;
3026  }
3027
3028  var observer = new IntersectionObserver(function (entries) {
3029    entries.forEach(function (entry) {
3030      if (entry.isIntersecting) {
3031        // 画面に入ったらアニメーション用クラスを付与
3032        entry.target.classList.add('cparts-underLineAnimation-active');
3033        // 1回実行したら監視を解除
3034        observer.unobserve(entry.target);
3035      }
3036    });
3037  }, {
3038    root: null,
3039    threshold: 0.1 // 10%見えたら発火
3040  });
3041
3042  // 各要素の監視を開始
3043  Array.prototype.forEach.call(targets, function (el) {
3044    observer.observe(el);
3045  });
3046});
3047// document.addEventListener('DOMContentLoaded', function () {
3048//   // 対象(必要に応じてセレクタ追加OK)
3049//   var targets = document.querySelectorAll(
3050//     'h3.cparts-id619, h4.cparts-id620, h5.cparts-id621, h6.cparts-id622'
3051//   );
3052
3053//   if (!targets.length) return;
3054
3055//   // IntersectionObserver が使えない古い環境向けフォールバック
3056//   if (!('IntersectionObserver' in window)) {
3057//     Array.prototype.forEach.call(targets, function (el) {
3058//       el.classList.add('cparts-underLineAnimation-active');
3059//     });
3060//     return;
3061//   }
3062
3063//   var observer = new IntersectionObserver(function (entries) {
3064//     entries.forEach(function (entry) {
3065//       if (entry.isIntersecting) {
3066//         entry.target.classList.add('cparts-underLineAnimation-active');
3067//         // 1回付与したら監視を外す(繰り返し不要なら)
3068//         observer.unobserve(entry.target);
3069//       }
3070//     });
3071//   }, {
3072//     root: null,          // viewport
3073//     threshold: 0.1       // 10% 見えたら発火(好みで 0 や 0.3 などに)
3074//     // rootMargin: '0px 0px -10% 0px' // 早め/遅め調整したい場合に使う
3075//   });
3076
3077//   Array.prototype.forEach.call(targets, function (el) {
3078//     observer.observe(el);
3079//   });
3080
3081// });
3082
3083document.addEventListener('DOMContentLoaded', function () {
3084
3085  function applyLayoutAdjust() {
3086    // 画面幅が 768px 以上かどうかを判定
3087    const isDesktop = window.matchMedia('(min-width: 768px)').matches;
3088    const rows = document.querySelectorAll('.lay-row');
3089
3090    rows.forEach(function (row) {
3091      const cparts616Elements = Array.from(row.children).filter(el => 
3092        el.classList.contains('cparts-id616')
3093      );
3094
3095      cparts616Elements.forEach(function (el, index) {
3096        // 「768px以上」かつ「4つ目以降」の場合のみ適用
3097        if (isDesktop && index >= 3) {
3098          el.style.setProperty('margin-top', '-3rem', 'important');
3099          el.style.setProperty('border-top', '0', 'important');
3100        } else {
3101          // それ以外(スマホ幅、または最初の3つ)はスタイルを削除
3102          el.style.removeProperty('margin-top');
3103          el.style.removeProperty('border-top');
3104        }
3105      });
3106    });
3107  }
3108
3109  // 初回実行
3110  applyLayoutAdjust();
3111
3112  // 画面のリサイズ時にも実行(スマホ←→PCの切り替え対策)
3113  window.addEventListener('resize', applyLayoutAdjust);
3114
3115  // CMSの動的変更を監視
3116  const observer = new MutationObserver(function () {
3117    applyLayoutAdjust();
3118  });
3119
3120  observer.observe(document.body, { childList: true, subtree: true });
3121});
3122
3123
3124/* ============================================================
3125    スクロールポップアップ
3126============================================================ */
3127document.addEventListener('DOMContentLoaded', () => {
3128  // cparts-id623クラスに対して処理が実行されるよう変更しました
3129  const modalContent = document.querySelector('.cparts-id623');
3130  if (!modalContent) return;
3131
3132  // =========================================
3133  // #cms_contents_areaが存在する場合(編集モード等)の処理
3134  // =========================================
3135  if (document.getElementById('cms_contents_area')) {
3136    // モーダル本体を強制的に表示状態にする
3137    modalContent.style.display = 'block';
3138    // アニメーション用の初期位置ズレ(下に20px)を解除し、正常な位置にする
3139    modalContent.style.transform = 'translateY(0)';
3140    
3141    // ここで処理を終了し、以降の黒いオーバーレイ生成(fixed処理)やイベント登録を行わない
3142    return; 
3143  }
3144
3145  // 1. JSで黒いオーバーレイを生成し、元のDOM階層でmodalContentを囲うように配置する
3146  const overlay = document.createElement('div');
3147  overlay.className = 'cparts-js-modalOverlay';
3148  overlay.id = 'cparts-js-modalOverlay';
3149
3150  // modalContentの親要素内で直前にoverlayを挿入し、中に移動(ラップ)させる
3151  modalContent.parentNode.insertBefore(overlay, modalContent);
3152  overlay.appendChild(modalContent);
3153
3154  // 2. モーダル本体の非表示設定を解除する
3155  modalContent.style.display = 'block';
3156
3157  // Cookie管理用の関数
3158  const cookieName = 'modal_shown';
3159  
3160  function setCookie(name, value, hours) {
3161    let expires = "";
3162    if (hours) {
3163      const date = new Date();
3164      date.setTime(date.getTime() + (hours * 60 * 60 * 1000));
3165      expires = "; expires=" + date.toUTCString();
3166    }
3167    document.cookie = name + "=" + (value || "") + expires + "; path=/";
3168  }
3169
3170  function getCookie(name) {
3171    const nameEQ = name + "=";
3172    const ca = document.cookie.split(';');
3173    for(let i = 0; i < ca.length; i++) {
3174      let c = ca[i];
3175      while (c.charAt(0) === ' ') c = c.substring(1, c.length);
3176      if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
3177    }
3178    return null;
3179  }
3180
3181  // スクロールイベントの処理
3182  function handleScroll() {
3183    // すでにCookieが存在する場合(過去24時間以内に表示済み)は処理しない
3184    if (getCookie(cookieName)) {
3185      window.removeEventListener('scroll', handleScroll);
3186      return;
3187    }
3188
3189    // スクロール量が300pxを超えたら
3190    if (window.scrollY >= 300) {
3191      // オーバーレイを表示(内包されているモーダル本体も一緒に表示される)
3192      overlay.classList.add('cparts-id623-isActive');
3193      
3194      // Cookieをセット(24時間有効)
3195      setCookie(cookieName, 'true', 24);
3196      
3197      // 1度表示したらスクロール監視を解除
3198      window.removeEventListener('scroll', handleScroll);
3199    }
3200  }
3201
3202  // スクロールイベントを登録
3203  window.addEventListener('scroll', handleScroll);
3204
3205
3206  // 閉じる処理の関数
3207  function closeModal() {
3208    overlay.classList.remove('cparts-id623-isActive');
3209  }
3210
3211  // 黒いオーバーレイ(外側)をクリックして閉じる
3212  overlay.addEventListener('click', (e) => {
3213    // オーバーレイ自身がクリックされた場合のみ閉じる
3214    if (e.target === overlay) {
3215      closeModal();
3216    }
3217  });
3218
3219  // 閉じるボタンをクリックして閉じる
3220  const closeBtn = document.getElementById('cparts-js-modal--closeBtn');
3221  if (closeBtn) {
3222    closeBtn.addEventListener('click', closeModal);
3223  }
3224
3225});
3226
3227/* ============================================================
3228    ホバースライドバナー
3229============================================================ */
3230document.addEventListener("DOMContentLoaded", function() {
3231  // 1. #cms_contents_area が存在するかチェック
3232  const hasCmsArea = document.getElementById('cms_contents_area') !== null;
3233  
3234  if (!hasCmsArea) {
3235    
3236    // 1列、2列、3列、4列の対象要素をまとめて取得
3237    const targetCols = document.querySelectorAll('.cparts-id624--01 .lay-col12-12, .cparts-id624--02 .lay-col12-6, .cparts-id624--03 .lay-col12-4, .cparts-id624--04 .lay-col12-3');
3238
3239    targetCols.forEach(col => {
3240      const footBlock = col.querySelector('.cparts-foot-block');
3241      const bodyBlock = col.querySelector('.cparts-body-block');
3242      const linkTag = footBlock ? footBlock.querySelector('a') : null;
3243
3244      if (linkTag && bodyBlock) {
3245        const wrapperLink = document.createElement('a');
3246        wrapperLink.href = linkTag.href;
3247        wrapperLink.className = 'banner-link-wrapper';
3248        if(linkTag.target) wrapperLink.target = linkTag.target;
3249
3250        // bodyBlock直下の子要素をwrapperLinkの中に移動
3251        const childrenToWrap = Array.from(bodyBlock.children);
3252        childrenToWrap.forEach(child => wrapperLink.appendChild(child));
3253
3254        // wrapperLinkをbodyBlockの中に追加
3255        bodyBlock.appendChild(wrapperLink);
3256
3257        // bodyBlockのpaddingを解除してaタグに任せるためのクラスを付与
3258        bodyBlock.classList.add('is-wrapped');
3259
3260        // フッターを非表示
3261        footBlock.style.display = 'none';
3262      }
3263    });
3264
3265  }
3266});
3267
3268/* ============================================================
3269    一覧パーツver.17
3270============================================================ */
3271document.addEventListener('DOMContentLoaded', function() {
3272  // -------------------------------------------------------------------
3273  // 【1. HTML構造の自動補完ロジック】
3274  // -------------------------------------------------------------------
3275  
3276  const slideBlocks = document.querySelectorAll('.cparts-id627');
3277  
3278  if (slideBlocks.length === 0) return;
3279
3280  let currentWrapper = null;
3281  let currentTrack = null;
3282
3283  slideBlocks.forEach((block) => {
3284      if (block.closest('.cparts-carousel-wrapper')) {
3285          return;
3286      }
3287
3288      if (currentWrapper && block.previousElementSibling === currentWrapper) {
3289          currentTrack.appendChild(block);
3290      } else {
3291          currentWrapper = document.createElement('div');
3292          currentWrapper.className = 'cparts-carousel-wrapper';
3293          
3294          currentTrack = document.createElement('div');
3295          currentTrack.className = 'cparts-carousel-track';
3296          
3297          currentWrapper.appendChild(currentTrack);
3298          
3299          const prevBtn = document.createElement('span');
3300          prevBtn.className = 'cparts-carousel-prev dec-bg--primary';
3301
3302          const nextBtn = document.createElement('span');
3303          nextBtn.className = 'cparts-carousel-next dec-bg--primary';
3304          
3305          currentWrapper.appendChild(prevBtn);
3306          currentWrapper.appendChild(nextBtn);
3307
3308          block.parentNode.insertBefore(currentWrapper, block);
3309          currentTrack.appendChild(block);
3310      }
3311  });
3312
3313  // -------------------------------------------------------------------
3314  // #cms_contents_area が存在する場合は、
3315  // ラッパー生成のみ実行し、以降のカルーセル処理は無効化
3316  // -------------------------------------------------------------------
3317  if (document.getElementById('cms_contents_area')) {
3318      return;
3319  }
3320
3321  // -------------------------------------------------------------------
3322  // 【2. カルーセルの動作ロジック】軽量複製版
3323  // -------------------------------------------------------------------
3324  
3325  const sliderViews = document.querySelectorAll('.cparts-carousel-wrapper');
3326  
3327  sliderViews.forEach(view => {
3328      if (view.dataset.carouselInitialized === 'true') return;
3329      view.dataset.carouselInitialized = 'true';
3330
3331      const track = view.querySelector('.cparts-carousel-track');
3332      if (!track) return;
3333      
3334      let slides = Array.from(track.querySelectorAll('.cparts-id627'));
3335      if (slides.length === 0) return;
3336
3337      // 元スライドを保持
3338      const originalSlides = slides.slice();
3339
3340      // 元スライドに連番を付与
3341      // 複製・並び替え後も、次に何番目を複製すべきか判定するために使用
3342      originalSlides.forEach((slide, idx) => {
3343          slide.dataset.carouselOriginalIndex = String(idx);
3344      });
3345
3346      // 初期表示時に、元の1番目のスライドを中央へ配置したかどうか
3347      let isInitialPositionAdjusted = false;
3348
3349      let isAnimating = false;
3350      let itemWidth = 0;
3351      const duration = 400;
3352
3353      function getGap() {
3354          return window.innerWidth >= 768 ? 30 : 20;
3355      }
3356
3357      // 複製時にid重複を避ける
3358      function removeDuplicateIds(element) {
3359          if (element.id) {
3360              element.removeAttribute('id');
3361          }
3362
3363          element.querySelectorAll('[id]').forEach(child => {
3364              child.removeAttribute('id');
3365          });
3366      }
3367
3368      // 必要枚数だけ複製する軽量処理
3369      // 複製は必ず「元スライド1セット単位」で追加する
3370      function normalizeSlideCount() {
3371          if (originalSlides.length === 0 || slides.length === 0) return;
3372
3373          const gap = getGap();
3374          track.style.gap = gap + 'px';
3375
3376          const slideWidth = slides[0].offsetWidth;
3377
3378          // まだ幅が取れない場合は無理に複製しない
3379          if (!slideWidth) return;
3380
3381          const viewWidth = view.offsetWidth || window.innerWidth;
3382          const visibleCount = Math.ceil(viewWidth / (slideWidth + gap));
3383
3384          const originalCount = originalSlides.length;
3385
3386          // 元スライド数に応じて、最低セット数を切り替える
3387          let minSetCount;
3388
3389          if (originalCount === 1) {
3390              minSetCount = 10;
3391          } else if (originalCount === 2) {
3392              minSetCount = 5;
3393          } else if (originalCount <= 4) {
3394              minSetCount = 3;
3395          } else {
3396              minSetCount = 2;
3397          }
3398
3399          // 表示枚数 + 前後の余白分も考慮
3400          const minRequiredCount = Math.max(
3401              originalCount * minSetCount,
3402              visibleCount + 4,
3403              originalCount
3404          );
3405
3406          // 必要枚数を「元スライド数の倍数」に補正
3407          const requiredCount = Math.ceil(minRequiredCount / originalCount) * originalCount;
3408
3409          if (slides.length >= requiredCount) return;
3410
3411          const fragment = document.createDocumentFragment();
3412
3413          while (slides.length < requiredCount) {
3414              const lastSlide = slides[slides.length - 1];
3415              const lastOriginalIndex = Number(lastSlide.dataset.carouselOriginalIndex || 0);
3416
3417              // 最後に追加されているスライドの次の番号を複製
3418              const nextOriginalIndex = (lastOriginalIndex + 1) % originalCount;
3419
3420              const baseSlide = originalSlides[nextOriginalIndex];
3421              const clone = baseSlide.cloneNode(true);
3422
3423              clone.classList.remove('cparts-carousel-active');
3424              clone.setAttribute('aria-hidden', 'true');
3425
3426              // 複製元の番号を保持
3427              clone.dataset.carouselOriginalIndex = String(nextOriginalIndex);
3428
3429              // CMS編集用IDなどが複製で重複しないよう削除
3430              removeDuplicateIds(clone);
3431
3432              // 複製画像はできるだけ軽く扱う
3433              clone.querySelectorAll('img').forEach(img => {
3434                  img.loading = 'lazy';
3435                  img.decoding = 'async';
3436              });
3437
3438              fragment.appendChild(clone);
3439              slides.push(clone);
3440          }
3441
3442          track.appendChild(fragment);
3443      }
3444
3445      // 初期表示時、元の1番目のスライドをtrack内の中央位置へ移動する
3446      function alignFirstSlideToCenter() {
3447          if (isInitialPositionAdjusted) return;
3448          if (slides.length === 0 || originalSlides.length === 0) return;
3449
3450          const centerIdx = Math.floor(slides.length / 2);
3451          const firstOriginalSlide = originalSlides[0];
3452
3453          if (!firstOriginalSlide) return;
3454
3455          let guard = slides.length;
3456
3457          // 中央位置に「元の1番目のスライド」が来るまで配列を回転
3458          while (slides[centerIdx] !== firstOriginalSlide && guard > 0) {
3459              const firstSlide = slides.shift();
3460              slides.push(firstSlide);
3461              guard--;
3462          }
3463
3464          // 配列順に合わせてDOMも並べ替える
3465          const fragment = document.createDocumentFragment();
3466
3467          slides.forEach(slide => {
3468              fragment.appendChild(slide);
3469          });
3470
3471          track.appendChild(fragment);
3472
3473          // activeクラスを一度すべて外し、中央の1番目スライドにだけ付与
3474          slides.forEach(slide => {
3475              slide.classList.remove('cparts-carousel-active');
3476          });
3477
3478          if (slides[centerIdx]) {
3479              slides[centerIdx].classList.add('cparts-carousel-active');
3480          }
3481
3482          isInitialPositionAdjusted = true;
3483      }
3484
3485      // --- 配置の計算と更新 ---
3486      function updateLayout(animate = false) {
3487          if (slides.length === 0) return 0;
3488
3489          const gap = getGap();
3490          track.style.gap = gap + 'px'; 
3491          
3492          const slideWidth = slides[0].offsetWidth;
3493          itemWidth = slideWidth + gap;
3494
3495          const centerIdx = Math.floor(slides.length / 2);
3496          const viewWidth = view.offsetWidth || window.innerWidth;
3497          const centerX = viewWidth / 2;
3498          
3499          const offsetLeft = (centerIdx * itemWidth) + (slideWidth / 2); 
3500          const targetX = centerX - offsetLeft;
3501
3502          track.style.transition = animate ? `left ${duration}ms ease` : 'none';
3503          track.style.left = `${targetX}px`;
3504
3505          slides.forEach((slide, idx) => {
3506              if (idx === centerIdx) {
3507                  slide.classList.add('cparts-carousel-active');
3508              } else {
3509                  slide.classList.remove('cparts-carousel-active');
3510              }
3511          });
3512          
3513          return targetX;
3514      }
3515
3516      // --- 「次へ」スライド処理 ---
3517      function moveNext(e) {
3518          if (e) e.preventDefault();
3519          if (isAnimating) return;
3520
3521          normalizeSlideCount();
3522          alignFirstSlideToCenter();
3523
3524          if (slides.length < 3) return;
3525
3526          isAnimating = true;
3527
3528          const currentX = updateLayout(false); 
3529          track.offsetHeight;
3530
3531          track.style.transition = `left ${duration}ms ease`;
3532          track.style.left = `${currentX - itemWidth}px`;
3533
3534          const centerIdx = Math.floor(slides.length / 2);
3535
3536          if (slides[centerIdx]) {
3537              slides[centerIdx].classList.remove('cparts-carousel-active');
3538          }
3539
3540          if (slides[centerIdx + 1]) {
3541              slides[centerIdx + 1].classList.add('cparts-carousel-active');
3542          }
3543
3544          setTimeout(() => {
3545              const firstElement = slides.shift();
3546              track.appendChild(firstElement);
3547              slides.push(firstElement);
3548              
3549              updateLayout(false);
3550              isAnimating = false;
3551          }, duration);
3552      }
3553
3554      // --- 「前へ」スライド処理 ---
3555      function movePrev(e) {
3556          if (e) e.preventDefault();
3557          if (isAnimating) return;
3558
3559          normalizeSlideCount();
3560          alignFirstSlideToCenter();
3561
3562          if (slides.length < 3) return;
3563
3564          isAnimating = true;
3565
3566          const lastElement = slides.pop();
3567          track.insertBefore(lastElement, slides[0]);
3568          slides.unshift(lastElement);
3569
3570          const currentX = updateLayout(false);
3571          
3572          track.style.transition = 'none';
3573          track.style.left = `${currentX - itemWidth}px`;
3574          track.offsetHeight;
3575
3576          track.style.transition = `left ${duration}ms ease`;
3577          track.style.left = `${currentX}px`;
3578
3579          const centerIdx = Math.floor(slides.length / 2);
3580
3581          slides.forEach(s => s.classList.remove('cparts-carousel-active'));
3582
3583          if (slides[centerIdx]) {
3584              slides[centerIdx].classList.add('cparts-carousel-active');
3585          }
3586
3587          setTimeout(() => {
3588              isAnimating = false;
3589          }, duration);
3590      }
3591
3592      // --- イベントリスナーの登録 ---
3593      const nextBtn = view.querySelector('.cparts-carousel-next');
3594      const prevBtn = view.querySelector('.cparts-carousel-prev');
3595      
3596      if (nextBtn) nextBtn.addEventListener('click', moveNext);
3597      if (prevBtn) prevBtn.addEventListener('click', movePrev);
3598
3599      let resizeTimer = null;
3600
3601      window.addEventListener('resize', () => {
3602          clearTimeout(resizeTimer);
3603
3604          resizeTimer = setTimeout(() => {
3605              normalizeSlideCount();
3606              alignFirstSlideToCenter();
3607              updateLayout(false);
3608          }, 150);
3609      });
3610
3611      // 初期配置
3612      setTimeout(() => {
3613          normalizeSlideCount();
3614          alignFirstSlideToCenter();
3615          updateLayout(false);
3616      }, 100);
3617  });
3618});
3619
3620
3621/* ============================================================
3622    一覧パーツver.18
3623============================================================ */
3624document.addEventListener('DOMContentLoaded', () => {
3625  // #cms_contents_area が存在するかチェック
3626  const hasCmsArea = document.getElementById('cms_contents_area') !== null;
3627  
3628  // 対象パーツを取得
3629  const partsList = Array.from(document.querySelectorAll('.cparts-id629'));
3630
3631  // 1. cparts-id629 が連続する場合にまとめてラップする処理
3632  const groups = [];
3633  let currentGroup = [];
3634
3635  partsList.forEach((part) => {
3636    if (currentGroup.length === 0) {
3637      currentGroup.push(part);
3638    } else {
3639      const lastPart = currentGroup[currentGroup.length - 1];
3640      // DOMツリー上で直前の要素(テキストノード等を除く)が前の対象パーツであれば連続と判定
3641      if (part.previousElementSibling === lastPart) {
3642        currentGroup.push(part);
3643      } else {
3644        // 間に他の要素が挟まっている場合はグループを確定し、新グループへ
3645        groups.push(currentGroup);
3646        currentGroup = [part];
3647      }
3648    }
3649  });
3650  if (currentGroup.length > 0) {
3651    groups.push(currentGroup);
3652  }
3653
3654  // グループごとにラップ用要素を生成して移動
3655  groups.forEach(group => {
3656    const blockWrapper = document.createElement('div');
3657    blockWrapper.className = 'cparts-id629-flex-block cparts-containerwidth-block';
3658    
3659    const rowWrapper = document.createElement('div');
3660    rowWrapper.className = 'lay-row';
3661    
3662    // 横並びレイアウトを維持するためのスタイル設定
3663    rowWrapper.style.display = 'flex';
3664    rowWrapper.style.flexWrap = 'wrap';
3665    rowWrapper.style.width = '100vw';
3666    rowWrapper.style.maxWidth = '100vw';
3667    rowWrapper.style.marginLeft = 'calc(50% - 50vw)';
3668    rowWrapper.style.marginRight = 'calc(50% - 50vw)';
3669    
3670    blockWrapper.appendChild(rowWrapper);
3671    
3672    // グループの最初の要素の直前にラッパーを挿入
3673    const firstPart = group[0];
3674    firstPart.parentNode.insertBefore(blockWrapper, firstPart);
3675    
3676    // グループ内の要素を順番にラッパー内へ移動
3677    group.forEach(part => {
3678      rowWrapper.appendChild(part);
3679    });
3680  });
3681
3682  // 2. リンク化・footer削除の処理
3683  const allParts = Array.from(document.querySelectorAll('.cparts-id629'));
3684  allParts.forEach(part => {
3685    if (!hasCmsArea) {
3686      // --------------------------------------------------
3687      // #cms_contents_area が無い場合 (公開画面の処理)
3688      // --------------------------------------------------
3689      const footerBlock = part.querySelector('.cparts-footer-block');
3690      
3691      if (footerBlock) {
3692        const linkEl = footerBlock.querySelector('a');
3693        const layRowInside = part.querySelector('.lay-row');
3694        
3695        if (linkEl && layRowInside) {
3696          // aタグのhref属性を取得
3697          const hrefUrl = linkEl.getAttribute('href');
3698          
3699          // 新しいラップ用のaタグを作成
3700          const wrapperLink = document.createElement('a');
3701          wrapperLink.setAttribute('href', hrefUrl);
3702          wrapperLink.className = 'cparts-link-wrapper';
3703          
3704          // .lay-row を aタグ で包む
3705          part.insertBefore(wrapperLink, layRowInside);
3706          wrapperLink.appendChild(layRowInside);
3707        }
3708        
3709        // footer-block は不要になるので削除
3710        footerBlock.remove();
3711      }
3712    } else {
3713      // --------------------------------------------------
3714      // #cms_contents_area が有る場合 (CMS編集画面の処理)
3715      // --------------------------------------------------
3716      // 仕様通り、.cparts-footer-block はそのまま表示します(何もしない)
3717    }
3718  });
3719
3720  // 3. 767px以下のスマホ表示時のDOM移動処理(テキストを画像の下に配置)
3721  function handleMobileLayout() {
3722    const isMobile = window.innerWidth <= 767;
3723    const allPartsForMobile = document.querySelectorAll('.cparts-id629');
3724    
3725    allPartsForMobile.forEach(part => {
3726      const layRowInside = part.querySelector('.lay-row');
3727      const bodyBlock = part.querySelector('.cparts-body-block');
3728      const txtBlock = part.querySelector('.cparts-txt-block');
3729      
3730      if (!layRowInside || !bodyBlock || !txtBlock) return;
3731      
3732      if (isMobile) {
3733        // モバイル時:テキストブロックを .cparts-body-block から出し、.lay-row の直下(末尾)に移動
3734        if (txtBlock.parentNode === bodyBlock) {
3735          layRowInside.appendChild(txtBlock);
3736        }
3737      } else {
3738        // PC・タブレット時:テキストブロックを .cparts-body-block の中に戻す
3739        if (txtBlock.parentNode === layRowInside) {
3740          bodyBlock.appendChild(txtBlock);
3741        }
3742      }
3743    });
3744  }
3745  
3746  // リサイズ時のイベント監視と、初回読み込み時の実行
3747  window.addEventListener('resize', handleMobileLayout);
3748  handleMobileLayout(); 
3749});
3750
3751/* ============================================================
3752    画像/見出し・テキスト(リストボタン)
3753    見出し・テキスト(リストボタン)/画像
3754============================================================ */
3755(function () {
3756  function addPrimaryBgClass() {
3757    var hasType01 = document.querySelector('.cparts-id635--01');
3758    var hasType02 = document.querySelector('.cparts-id635--02');
3759    if (!hasType01 && !hasType02) {
3760      return;
3761    }
3762
3763    var links = document.querySelectorAll(
3764      '.cparts-id635--01 > .lay-row > div:first-child > .cparts-txt-block:last-of-type ul li a,' +
3765      '.cparts-id635--02 > .lay-row > .cparts-img-block:first-child + div > .cparts-txt-block:last-of-type ul li a'
3766    );
3767
3768    for (var i = 0; i < links.length; i += 1) {
3769      links[i].classList.add('dec-bg-pe--primary');
3770    }
3771  }
3772
3773  if (document.readyState === 'loading') {
3774    document.addEventListener('DOMContentLoaded', addPrimaryBgClass);
3775  } else {
3776    addPrimaryBgClass();
3777  }
3778})();
3779
3780/* ============================================================
3781    見出し・テキスト/スライド背景
3782============================================================ */
3783(function () {
3784  'use strict';
3785
3786  function getSlideDirection(part) {
3787    if (part.classList.contains('cparts-animate--imageSlideRight')) {
3788      return 'right';
3789    }
3790
3791    return 'left';
3792  }
3793
3794  function moveImageListBlock(parts) {
3795    for (var i = 0; i < parts.length; i += 1) {
3796      var row = parts[i].querySelector('.lay-row');
3797      if (!row) {
3798        continue;
3799      }
3800
3801      var column = row.querySelector('.lay-col12-12');
3802      if (!column) {
3803        continue;
3804      }
3805
3806      var imageListBlock = column.querySelector(
3807        '.parts_h_type16 + .cparts-txt-block + .cparts-txt-block + .cparts-txt-block'
3808      );
3809
3810      if (!imageListBlock || imageListBlock.parentNode === row) {
3811        continue;
3812      }
3813
3814      row.insertBefore(imageListBlock, column.nextSibling);
3815    }
3816  }
3817
3818  function fitVerticalSideText(part) {
3819    var target = part.querySelector(
3820      '.cparts-body-block > .parts_h_type16 + .cparts-txt-block + .cparts-txt-block'
3821    );
3822
3823    if (!target) {
3824      return;
3825    }
3826
3827    var partHeight = part.getBoundingClientRect().height;
3828    if (!partHeight) {
3829      return;
3830    }
3831
3832    var maxSize = 150;
3833    var minSize = 24;
3834    var topPadding = 20;
3835    var bottomPadding = 20;
3836    var availableHeight = Math.max(partHeight - topPadding - bottomPadding, 0);
3837    var low = minSize;
3838    var high = maxSize;
3839    var best = minSize;
3840
3841    target.style.setProperty('position', 'absolute');
3842    target.style.setProperty('top', topPadding + 'px', 'important');
3843    target.style.setProperty('bottom', 'auto', 'important');
3844    target.style.setProperty('font-size', maxSize + 'px', 'important');
3845
3846    for (var i = 0; i < 10; i += 1) {
3847      var middle = (low + high) / 2;
3848      target.style.setProperty('font-size', middle + 'px', 'important');
3849
3850      if (target.getBoundingClientRect().height <= availableHeight) {
3851        best = middle;
3852        low = middle;
3853      } else {
3854        high = middle;
3855      }
3856    }
3857
3858    target.style.setProperty('font-size', Math.floor(best) + 'px', 'important');
3859
3860    var targetHeight = target.getBoundingClientRect().height;
3861    var top = Math.max(topPadding, Math.floor((partHeight - targetHeight) / 2));
3862    var scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
3863
3864    if (window.matchMedia('(min-width: 768px)').matches) {
3865      target.style.setProperty('right', (scrollbarWidth - 18) + 'px', 'important');
3866    } else {
3867      target.style.removeProperty('right');
3868    }
3869
3870    target.style.setProperty('top', top + 'px', 'important');
3871  }
3872
3873  function fitAllVerticalSideText(parts) {
3874    for (var i = 0; i < parts.length; i += 1) {
3875      fitVerticalSideText(parts[i]);
3876    }
3877  }
3878
3879  function getSliderBlock(part) {
3880    var sliderBlock = part.querySelector('.cparts-body-block > .cparts-txt-block:last-of-type');
3881    if (sliderBlock && sliderBlock.querySelector('ul li img')) {
3882      return sliderBlock;
3883    }
3884
3885    sliderBlock = part.querySelector('.lay-row > .lay-col12-12 + .cparts-txt-block');
3886    if (sliderBlock && sliderBlock.querySelector('ul li img')) {
3887      return sliderBlock;
3888    }
3889
3890    return null;
3891  }
3892
3893  function setupSlider(part) {
3894    var sliderBlock = getSliderBlock(part);
3895    if (!sliderBlock || sliderBlock.getAttribute('data-cparts-id631-slider') === 'true') {
3896      return;
3897    }
3898  
3899    var list = sliderBlock.querySelector('ul');
3900    if (!list) {
3901      return;
3902    }
3903  
3904    var items = list.querySelectorAll('li');
3905    if (items.length < 2) {
3906      if (items.length === 1) {
3907        items[0].style.setProperty('width', '100%', 'important');
3908      }
3909      return;
3910    }
3911  
3912    sliderBlock.setAttribute('data-cparts-id631-slider', 'true');
3913  
3914    var isStop = part.classList.contains('cparts-animate--imageSlideStop');
3915    var direction = getSlideDirection(part);
3916    var count = items.length;
3917    var offset = 0;
3918    var lastTime = null;
3919    var loopWidth = 0;
3920    var speed = 34;
3921  
3922    if (!isStop) {
3923      for (var i = 0; i < count; i += 1) {
3924        var clone = items[i].cloneNode(true);
3925        clone.setAttribute('data-cparts-id631-clone', 'true');
3926        list.appendChild(clone);
3927      }
3928    }
3929  
3930    function getSliderHeight() {
3931      var body = part.querySelector('.cparts-body-block');
3932      var height = body ? body.getBoundingClientRect().height : 0;
3933  
3934      if (!height) {
3935        height = part.getBoundingClientRect().height;
3936      }
3937  
3938      return Math.max(height, 1);
3939    }
3940  
3941    function refresh() {
3942      var allItems = list.querySelectorAll('li');
3943      var total = allItems.length;
3944      var sliderWidth = sliderBlock.clientWidth || part.getBoundingClientRect().width || window.innerWidth;
3945      var sliderHeight = getSliderHeight();
3946      var row = part.querySelector('.lay-row');
3947      var itemWidth = isStop
3948        ? (100 / count)
3949        : (window.matchMedia('(max-width: 767px)').matches ? 30 : (100 / total));
3950  
3951      if (row) {
3952        row.style.setProperty('position', 'relative', 'important');
3953      }
3954  
3955      sliderBlock.style.setProperty('position', 'absolute');
3956      sliderBlock.style.setProperty('top', '0', 'important');
3957      sliderBlock.style.setProperty('right', '0', 'important');
3958      sliderBlock.style.setProperty('bottom', 'auto', 'important');
3959      sliderBlock.style.setProperty('left', '0', 'important');
3960      sliderBlock.style.setProperty('z-index', '1', 'important');
3961      sliderBlock.style.setProperty('overflow', 'hidden', 'important');
3962      sliderBlock.style.setProperty('width', '100%', 'important');
3963      sliderBlock.style.setProperty('height', sliderHeight + 'px');
3964      sliderBlock.style.setProperty('margin', '0', 'important');
3965      sliderBlock.style.setProperty('padding', '0', 'important');
3966  
3967      list.style.setProperty('position', 'relative', 'important');
3968      list.style.setProperty('display', 'block', 'important');
3969      list.style.setProperty('overflow', 'hidden', 'important');
3970      list.style.setProperty('width', isStop ? '100%' : ((total * 50) + '%'), 'important');
3971      list.style.setProperty('height', sliderHeight + 'px', 'important');
3972      list.style.setProperty('transition', 'none', 'important');
3973      list.style.setProperty('left', '0px', 'important');
3974      list.style.setProperty('margin', '0', 'important');
3975      list.style.setProperty('padding', '0', 'important');
3976  
3977      for (var i = 0; i < total; i += 1) {
3978        allItems[i].style.setProperty('display', 'block', 'important');
3979        allItems[i].style.setProperty('float', 'left', 'important');
3980        allItems[i].style.setProperty('width', itemWidth + '%', 'important');
3981        allItems[i].style.setProperty('height', sliderHeight + 'px', 'important');
3982        allItems[i].style.setProperty('margin', '0', 'important');
3983        allItems[i].style.setProperty('padding', '0', 'important');
3984        allItems[i].style.setProperty('list-style', 'none', 'important');
3985  
3986        var img = allItems[i].querySelector('img');
3987        if (img) {
3988          img.style.setProperty('display', 'block', 'important');
3989          img.style.setProperty('width', '100%', 'important');
3990          img.style.setProperty('height', '100%', 'important');
3991          img.style.setProperty('max-width', 'none', 'important');
3992          img.style.setProperty('object-fit', 'cover', 'important');
3993          img.style.setProperty('object-position', 'center center', 'important');
3994        }
3995      }
3996  
3997      if (isStop) {
3998        offset = 0;
3999        loopWidth = 0;
4000        lastTime = null;
4001        return;
4002      }
4003  
4004      loopWidth = sliderWidth * count * 0.5;
4005      offset = direction === 'right' ? loopWidth : 0;
4006      lastTime = null;
4007      list.style.setProperty('left', (-offset) + 'px', 'important');
4008    }
4009  
4010    function tick(time) {
4011      if (isStop) {
4012        return;
4013      }
4014  
4015      if (lastTime === null) {
4016        lastTime = time;
4017      }
4018  
4019      if (direction === 'right') {
4020        offset -= ((time - lastTime) / 1000) * speed;
4021      } else {
4022        offset += ((time - lastTime) / 1000) * speed;
4023      }
4024  
4025      lastTime = time;
4026  
4027      if (loopWidth > 0 && offset >= loopWidth) {
4028        offset -= loopWidth;
4029      }
4030  
4031      if (loopWidth > 0 && offset < 0) {
4032        offset += loopWidth;
4033      }
4034  
4035      list.style.setProperty('left', (-offset) + 'px', 'important');
4036      window.requestAnimationFrame(tick);
4037    }
4038  
4039    refresh();
4040    window.addEventListener('load', refresh);
4041    window.addEventListener('resize', refresh);
4042  
4043    if (!isStop) {
4044      window.requestAnimationFrame(tick);
4045    }
4046  }
4047
4048  function startCpartsId631() {
4049    var parts = document.querySelectorAll('.cparts-id631');
4050    if (!parts.length) {
4051      return;
4052    }
4053
4054    if (document.getElementById('cms_contents_area')) {
4055      moveImageListBlock(parts);
4056    }
4057
4058    fitAllVerticalSideText(parts);
4059
4060    window.addEventListener('load', function () {
4061      fitAllVerticalSideText(parts);
4062    });
4063
4064    window.addEventListener('resize', function () {
4065      fitAllVerticalSideText(parts);
4066    });
4067
4068    for (var i = 0; i < parts.length; i += 1) {
4069      setupSlider(parts[i]);
4070    }
4071  }
4072
4073  if (document.readyState === 'loading') {
4074    document.addEventListener('DOMContentLoaded', startCpartsId631);
4075  } else {
4076    startCpartsId631();
4077  }
4078})();

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.