PageSourceSearch

https://namonaki.jp/assets/js/index.js

js namonaki.jp collected 2026-10-05 21:31:44 UTC 16,254 bytes, 663 lines download raw bytes

1/************************************************
2
3@PC - index.js v5.0.0
4
5(c) ULM Co.,Ltd. - https://www.ulm-design.com
6************************************************/
7/*--------------------------
8youtubeサムネイル埋め込みループ
9--------------------------*/
10const _isEnbedLoop = false;
11
12/*******************************************************
13
14varructor
15
16********************************************************/
17const Main = (function(){
18
19  var contentsName = 'top';
20
21  /*--------------------------
22  cookie
23  --------------------------*/
24  var _isVisited = false;
25
26  /*--------------------------
27  loadImg
28  --------------------------*/
29  var _allImgNum = 0;
30  var _imgLoadedNum = 0;
31
32  /*--------------------------
33  params
34  --------------------------*/
35  var _isInit = false;
36  //var _ua;
37  var _isPlayingMovie = false;
38  var _isOpenContents = false;
39
40	//IE
41	var _isIE = false;
42
43  var _stats;
44
45	/*******************************************************
46
47	init
48
49	********************************************************/
50  function init(){
51
52    /*-----------------------------------
53    IE判別
54    ------------------------------------*/
55		const ua = window.navigator.userAgent.toLowerCase();
56		if(ua.indexOf('msie') >= 0 || ua.indexOf('trident') >= 0){
57			_isIE = true;
58		}else{
59			_isIE = false;
60		}
61
62    /*-----------------------------------
63    @globalNavi設定
64    target : appendするid名 or class名
65    id : どのページにいるか(NAVI_DATAで設定した名前)
66    img : ナビを画像にするときはtrueに
67    ------------------------------------*/
68    initNavi({ target: '#nav-container', id: contentsName, img: false, tag: 'li' });
69
70    /*-----------------------------------
71    @drawerNavi設定
72    target : appendするid名 or class名
73    id : どのページにいるか(NAVI_DATAで設定した名前)
74    img : ナビを画像にするときはtrueに
75    ------------------------------------*/
76    initDrawerNavi({ target: "#drawer-nav-container", id: contentsName, img: false, tag: 'li' });
77
78    /*-----------------------------------
79    sns設定
80    ------------------------------------*/
81    initSNS({ target: '.social-container', tag: 'li' });
82
83		/*-----------------------------------
84    banner設定
85    ------------------------------------*/
86    initBanner({ target: '#banner-container', tag: 'li' });
87
88    /*----------------------------------
89    cookie
90    ----------------------------------*/
91    const cookie = $.cookie(COOKIE);
92
93    //指定のcookieがブラウザにある場合
94    if(cookie == COOKIE_VALUE){
95      _isVisited = true;//訪問済みにする
96    }
97
98    /*----------------------------------
99    resize
100    ----------------------------------*/
101    $(window).on('load resize', __resize);
102    __resize();
103
104    /*----------------------------------
105    loadImg
106    ----------------------------------*/
107    var images = $('img');
108    var txt = $('#progress-txt');
109
110    _allImgNum = images.length;
111
112    images.each(function() {
113      $(this).imagesLoaded(function() {
114        _imgLoadedNum++;
115        txt.text(String(Math.floor((_imgLoadedNum/_allImgNum)*100)+'%'));
116      });
117    });
118
119    /*----------------------------------
120    onLoadImg
121    ----------------------------------*/
122    $(window).on('load', function() {
123
124      if(!IS_TEST){
125        //読み込みが完了したらhidePreloaderを呼ぶ。
126        $('#progress-txt').text('100%');
127        hidePreloader();
128      }else{
129        //TESTモードの場合。
130        $('#preloader').css({'display':'none'});
131        setConfig();
132      }
133
134    });//load
135
136	}//init
137
138
139  /*******************************************************
140
141  hidePreloader
142
143  ********************************************************/
144  function hidePreloader() {
145
146    // return false;
147
148    setTimeout(function(){
149      // $("#progress-box").animate({"width":"100%"}, 400, 'easeInCubic');
150      $("#preloader-white").animate({"width":"100%"}, 700, 'easeInQuart', function(){
151        $('#preloader').animate({'opacity':0}, 1000, 'easeInCubic', function(){
152          $('#preloader').remove();
153          setConfig();
154        });
155      });
156      mainVideoPC();
157
158    },1000);
159    mainVideoSP();
160
161  }//hidePreloader
162
163
164  /*******************************************************
165
166  setConfig
167
168  ********************************************************/
169  function setConfig() {
170
171    onInitIndex();
172
173  }//setConfig
174
175
176  /*******************************************************
177
178  onInitIndex
179
180  ********************************************************/
181  function onInitIndex() {
182
183    if(_isVisited == false) {
184
185      //未訪問の場合。
186
187      if(!IS_TEST) {
188        //初回訪問時、動画自動再生。
189        onInit();
190      } else {
191        //TESTモードの場合。
192        onInit();
193      }
194
195    } else {
196
197      //訪問済の場合。
198
199      onInit();
200
201    }
202
203  }//onInitIndex
204
205
206  /*******************************************************
207
208  @showMovie
209
210  ********************************************************/
211  function showMovie(__id) {
212
213    if(_isPlayingMovie){ return; }
214
215    _isPlayingMovie = true;
216
217    if(_isEnbedLoop) {
218			if(!_isIE){
219      	ytPlayer.pauseVideo();
220			}
221		}
222
223    //movieの設定(config.js記載)
224    var params = getMovieParams();
225    var ids = MOVIE_ID_ARR;
226    var url = params.url;
227    if(__id !=null && __id < ids.length) {
228      url += '?id='+__id;
229    }
230
231    //colorbox設定
232    $.colorbox({
233      iframe: true,
234      href: url,
235      scrolling: false,
236      width: params.w,
237      height: params.h,
238      opacity: 0.94,
239      speed: 600,
240			fixed: true,
241			onComplete: function(){
242			},
243      onClosed: function() {
244        onClosedMovie();
245      }
246    });//colorbox
247
248  }//showMovie
249
250
251  /*******************************************************
252
253  @onCompleteMovie
254
255  ********************************************************/
256  function onCompleteMovie() {
257
258    if(_isInit == false && _isVisited == false){
259      //初回自動再生だった場合、自動でcolorboxを閉じる。
260      $.colorbox.close();
261    }
262  }
262//onCompleteMovie
263
264
265  /*******************************************************
266
267  @onClosedMovie
268
269  ********************************************************/
270  function onClosedMovie() {
271
272    _isPlayingMovie = false;
273
274    if(_isEnbedLoop) {
275			if(!_isIE){
276				ytPlayer.playVideo();
277			}
278    }
279
280    if(_isInit == false) {
281      //初回自動再生だった場合。
282      onInit();
283    } else {}
284
285  }//onClosedMovie
286
287
288  /*******************************************************
289
290  ⑤.onInit
291
292  ********************************************************/
293  function onInit() {
294
295    _isInit = true;
296
297    showMain();
298    movieinit();
299    character();
300    staff();
301
302    //config.jsで設定したcookieをブラウザに残す。(7日間)
303    $.cookie(COOKIE, COOKIE_VALUE, { expires: 7 });
304
305    //ナビゲーションスムーススクロール
306    $('.nav-btn').on('click', function(){
307      var id = $(this).attr("href");
308      var position = $(id).offset().top;
309      $("html, body"). animate({
310          "scrollTop": position
311      }, 300);
312      return false;
313    });
314
315  }//onInit
316
317
318	/*******************************************************
319
320	@showMain
321
322	********************************************************/
323  function showMain() {
324
325    //ふわっと表示
326    $('.fadein').on('inview', function() {
327      $(this).addClass('fadein-anime');
328    });
329
330    //スクロールが100に達したら非表示
331    var $scrolldown = $('#scrolldown');
332    $(window).scroll(function () {
333      if ($(this).scrollTop() > 100) {
334          $scrolldown.fadeOut();
335      } else {
336          $scrolldown.fadeIn();
337      }
338    });
339
340    if($(window).width() > 1024){
341      //PC
342
343      $('#top-main')
344      // マウスポインターが画像に乗った時の動作
345      .mouseover(function(e) {
346        //マウスストーカー用のdivを取得
347        const stalker = document.getElementById('btn-trailer');
348        //上記のdivタグをマウスに追従させる処理
349        document.addEventListener('mousemove', function (e) {
350          stalker.style.transform = 'translate(' + e.clientX + 'px, ' + e.clientY + 'px)';
351        });
352      })
353      // マウスポインターが画像から外れた時の動作
354      .mouseout(function(e) {
355
356      });
357
358      $('#header')
359      // マウスポインターが画像に乗った時の動作
360      .mouseover(function(e) {
361        $("#btn-trailer").css({"opacity":0});
362        // console.log('mouseover:' + e.target.id);
363      })
364      // マウスポインターが画像から外れた時の動作
365      .mouseout(function(e) {
366        $("#btn-trailer").css({"opacity":1});
367        // console.log('mouseout:' + e.target.id);
368      });
369
370      $('.top-btn')
371      // マウスポインターが画像に乗った時の動作
372      .mouseover(function(e) {
373        $("#btn-trailer").css({"opacity":0});
374        // console.log('mouseover:' + e.target.id);
375      })
376      // マウスポインターが画像から外れた時の動作
377      .mouseout(function(e) {
378        $("#btn-trailer").css({"opacity":1});
379        // console.log('mouseout:' + e.target.id);
380      });
381
382      $('.btn-play').on('click',function(){
383        showMovie(0);
384      });
385
386    } else {
387      //SP
388      $('.btn-play').on('click',function(){
389        var trailerPos = $('#trailer').offset().top;
390        $("html, body"). animate({
391          "scrollTop": trailerPos
392      }, 300);
393      return false;
394      });
395    }
396
397    $(".ph-container").on('inview', function(event, isInView) {
398      $(".ph-cover").animate({"height":"100%"},300,"easeInCubic",function(){
399        $(".ph-list li img").animate({"opacity":"1"},function(){
400          $(".ph-cover").animate({"height":"0"},300);
401        });
402      });
403
404    });
405
406    let keyword = '<p id="keyword">1日あれば世界は変わる。</p>';
407    $('#footer-roadshow').after(keyword);
408
409    var swiper = new Swiper('#tieup-container', {
410      slidesPerView: 4,
411      spaceBetween: 0,
412      autoplay: {
413        delay: 3000,
414      },
415      pagination: {
416        el: '.swiper-pagination',
417        clickable: true,
418      },
419      breakpoints: {
420        1024: {
421          slidesPerView: 1.2,
422          centeredSlides: true,
423        }
424      }
425    });
426
427  }//showMain
428
429  function mainVideoPC(){
430    if($(window).width() > 1024){
431      var pcv = document.getElementById('main-pc');
432      pcv.play();
433    }
434  }
435
436  function mainVideoSP(){
437    if($(window).width() < 1023){
438      var spv = document.getElementById('main-sp');
439      spv.play();
440    }
441  }
442
443
444
445
446  /*******************************************************
447
448  @movieinit
449
450  ********************************************************/
451  function movieinit(){
452
453    var params = MOVIE_ID_ARR;
454
455    if(params.length >0){
456
457      var html = '';
458
459      html += '';
460
461      for(var _loc2 = 0; _loc2 < params.length; _loc2++){
462        html += '<li><div class="pc"><div class="movie-thumb-box"><a href="javascript:Main.showMovie('+[_loc2]+');"><img src="https://i.ytimg.com/vi/'+ params[_loc2].id +'/maxresdefault.jpg" alt="" class="movie-thumb-img"><i class="play-icon fab fa-youtube"></i></a></div></div><div class="sp"><div class="movie-thumb-box"><iframe class="youtube" src="https://www.youtube.com/embed/'+ params[_loc2].id +'?rel=0" frameborder="0" allowfullscreen></iframe></div></div><p class="movie-cap">' + params[_loc2].name + '</p></li>';
463      }
464
465      html += '';
466
467      $(".movie-thumb-list").html(html);
468    }
469
470    // if(params.length = 8){
471    //   $(".movie-thumb-img:eq(8)").attr('src','https://i.ytimg.com/vi/DOYyolw6-_Q/maxresdefault.jpg');
472    // }
473
474
475
476    $(".movie-thumb-list li").addClass("swiper-slide");
477    var swiper = new Swiper('#movie-container', {
478      slidesPerView: 3,
479      spaceBetween: 0,
480      autoplay: {
481        delay: 3000,
482      },
483      pagination: {
484        el: '.swiper-pagination',
485        clickable: true,
486      },
487      breakpoints: {
488        1024: {
489          slidesPerView: 1.2,
490          centeredSlides: true,
491        }
492      }
493    });
494
495  }
496
497
498/*******************************************************
499
500character
501
502********************************************************/
503
504let charaNav = $('.cast-nav'); //character アイコン
505let charaDetail = $('.cast-overlay'); //character 詳細枠
506let charaBox = $('.cast-detail'); //character 詳細個別
507
508function character(){
509  closebtnInit();
510
511  $(charaNav).each(function(i){
512    $(this).on('click', function(){
513      console.log(i);
514      $(charaDetail).fadeIn();
515      chartOpen(i);
516      chartclose();
517      scrollimPossible();
518    });
519  });
520
521}
522
523function chartOpen(v){
524  _currentNum = v;
525  $(charaBox).each(function(i){
526    if(i == _currentNum){
527      console.log(v);
528      // $(charaDetail).attr('id', 'detail-bg'+v);
529      $(this).delay(100).fadeIn(500);
530      $(charaDetail).scrollTop(0);
531    }else{
532      $(this).hide();
533    }
534  });
535}
536
537function chartclose(){
538  $(".close-btn").click(function(){
539    console.log("close");
540    if($(charaDetail).css('display') == 'block'){
541      // $(charaDetail).children(".close-btn").remove();
542      $(charaDetail).fadeOut();
543      scrollPossible();
544    }
545  });
546}
547
548let closebtn = '<div class="close-btn"><img src="assets/img/common/closebtn.png" alt="close" class="w100"></div>';
549
550function closebtnInit(){
551  $(charaBox).prepend(closebtn);
552  $(staffBox).prepend(closebtn);
553}
554
555/*******************************************************
556
557staff
558
559********************************************************/
560
561let staffNav = $('.staff-nav'); //staff アイコン
562let staffDetail = $('.staff-overlay'); //staff 詳細枠
563let staffBox = $('.staff-detail'); //staff 詳細個別
564
565function staff(){
566
567  $(staffNav).each(function(i){
568    $(this).on('click', function(){
569      console.log(i);
570      $(staffDetail).fadeIn();
571      staffOpen(i);
572      staffclose();
573      scrollimPossible();
574    });
575  });
576
577}
578
579function staffOpen(v){
580  _currentNum = v;
581  $(staffBox).each(function(i){
582    if(i == _currentNum){
583      console.log(v);
584      // $(staffDetail).attr('id', 'detail-bg'+v);
585      $(this).delay(100).fadeIn(500);
586      $(staffDetail).scrollTop(0);
587    }else{
588      $(this).hide();
589    }
590  });
591}
592
593function staffclose(){
594  $(".close-btn").click(function(){
595    console.log("close");
596    if($(staffDetail).css('display') == 'block'){
597      // $(staffDetail).children(".close-btn").remove();
598      $(staffDetail).fadeOut();
599      scrollPossible();
600    }
601  });
602}
603
604 /*******************************************************
605
606 @scrollPossible
607
608 ********************************************************/
609 var pointY;
610 function scrollimPossible(){
611   pointY = $(window).scrollTop();
612   $('body').css({
613     'position': 'fixed',
614     'top': -pointY
615   });
616 }
617
618 function scrollPossible(){
619   $('body').css({
620     'position': 'relative',
621     'top': ''
622   });
623   $(window).scrollTop(pointY);
624 }
625
626  /*******************************************************
627
628  resize
629
630  ********************************************************/
631  function __resize() {
632
633    var w = WINDOW.width();
634    var h = WINDOW.height();
635    w = w > DEF_W ? w : DEF_W;
636    h = h > DEF_H ? h : DEF_H;
637
638    if(w <= DEF_W){
639      $('html').css({'overflow-x':'auto'});
640    }else{
641      $('html').css({'overflow-x':'hidden'});
642    }
643
644    var hSize = $(window).height();
645    $('#top-main').height(hSize); // アドレスバーを除いたサイズを付与
646
647  }//__resize
648
649
650	return {
651		init:init,
652		__resize:__resize,
653		showMovie:showMovie,
654		onCompleteMovie:onCompleteMovie
655	}
656
657})();
658
659
660/*******************
661@ready
662*******************/
663Main.init();

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.