PageSourceSearch

https://www.tus.ac.jp/static/js/app.js?20241202

js tus.ac.jp collected 2026-09-24 08:54:31 UTC 19,601 bytes, 609 lines download raw bytes

1$(window).on('load', function(){
2  setTimeout(function(){
3  /**
4   * Mega menu innerlink
5   */
6  $('a').on('click', function(e) {
7     console.log("pathname:"+location.pathname);
8      console.log("href:"+$(this).attr('href'));
9      var $href=$(this).attr('href');
10      var $hash=$(this).attr('href').replace(location.pathname,'');
11       console.log("hash:"+$hash);
12     if(($href.indexOf('-open') > -1) && ($hash.slice(0,1) === "#")){
13      e.preventDefault();
14          var $show=$hash.replace('-open','');
15          console.log("click:"+$show);
16//          var $tabTop=$('ul.nav-pills').offset().top;
17//          $('html,body').animate({scrollTop: $tabTop}, 500);
18          $('#pills-tabContent1 .tab-pane').each(function() {
19             if($(this).attr("id") === $show.replace("#","")){
20                $(this).removeClass("fade");
21                $(this).addClass("show active");
22                }
23              else{
24                $(this).addClass("fade");
25                $(this).removeClass("show active");
26                }
27          })
28          $('.nav-pills > li a').each(function() {
29            if($(this).attr('href') ===$show){
30                $(this).addClass("active");
31               }
32            else{
33                $(this).removeClass("active");
34               }
35           })
36       }
37    })
38  },1000);
39
40/**
41   * SP
42   */
43  const spMediaQuery = window.matchMedia('(max-width: 767px)')
44
45  /**
46   * Debounce
47   */
48  function debounce(func) {
49    var timer
50    return function(event) {
51      if(timer) clearTimeout(timer)
52      timer = setTimeout(func, 50, event)
53    }
54  }
55
56  /**
57   * Wait for element
58   */
59  function waitForEl(selector) {
60    return new Promise(resolve => {
61      if (document.querySelector(selector)) {
62        return resolve(document.querySelector(selector))
63      }
64      const observer = new MutationObserver(mutations => {
65        if (document.querySelector(selector)) {
66          resolve(document.querySelector(selector))
67          observer.disconnect()
68        }
69      })
70      observer.observe(document.body, {
71        childList: true,
72        subtree: true
73      })
74    })
75  }
76
77  /**
78   * Mega menu toggle
79   */
80  $('[data-toggle-next]').on('click', function() {
81    $(this).toggleClass('is-active')
82    $(this).next().slideToggle()
83  })
84
85  // Open when there's not link
86  if($('.header-main__mega').length) {
87    $('.header-main__mega [data-toggle-next]').each(function() {
88      const $a = $(this).prev('a')
89      const $button = $(this)
90      if($a.attr('href')==='#') {
91        $a.on('click', function(e) {
92          e.preventDefault()
93          $button.click()
94        })
95      }
96    })
97  }
98
99
100/**
101   * PC Header scroll (2024/04/23 修正)
102   */
103  $(window).scroll(debounce(function() {
104    if ($(this).scrollTop() >= $(window).innerHeight()+80) {
105      if($('.header-buttons__mega--search').is(':hidden')){
106         $('.header').addClass('is-scrolled');
107     }
108   } else {
109     if ($(this).scrollTop() <= $(window).innerHeight()) {
110       $('.header').removeClass('is-scrolled');
111      }
112   }
113  }))
114
115  /**
116   * PC Header toggles
117   */
118  if($('[data-toggle-pc-btn]').length) {
119      $('main').on('click', function() {
120            $('[data-toggle-pc-btn]').removeClass('is-active');
121            $('[data-toggle-pc-btn]').next().slideUp();
122            $('.toggle-disable').css('pointer-events', 'auto').attr('tabindex', 0);
123      })
124
125    $('[data-toggle-pc-btn]').each(function() {
126      $(this).on('click', function() {
127        // Close others
128          if($(this).is('.is-active')) {
129            $(this).removeClass('is-active');
130            $(this).next().slideUp();
131            $('.toggle-disable').css('pointer-events', 'auto').attr('tabindex', 0);
132          }
133        // Open this
134          else{
135           $(this).toggleClass('is-active')
136           $(this).next().slideToggle()
137           $('.toggle-disable').css('pointer-events', 'none').attr('tabindex', -1);
138           $('.header-buttons__search').css('pointer-events', 'auto').attr('tabindex', 0);
139           $('.header-buttons__search input').val('');
140           $('.header-buttons__search input').focus();
141          }
142      })
143    })
144  }
145
146/**
147   * SP Header toggles
148   */
149  if($('[data-toggle-sp-btn]').length) {
150    $('[data-toggle-sp-btn]').each(function() {
151      $(this).on('click', function() {
152        // Close others
153        $('[data-toggle-sp-btn]').not($(this)).each(function() {
154          if($(this).is('.is-active')) {
155            $(this).removeClass('is-active')
156            $(this).next().slideUp()
157          }
158        })
159
160        // Open this
161        $(this).toggleClass('is-active')
162        $(this).next().slideToggle()
163      })
164    })
165  }
166
167  /**
168   * Emergency news
169   */
170  if($('[data-toggle-emergency]').length) {
171    const $emergency = $('.emergency__news')
172
173    $('[data-toggle-emergency]').on('click', function() {
174      $(this).toggleClass('is-active')
175      $emergency.find('.sys-info').slideToggle()
176    })
177
178    $('[data-hide-emergency]').on('click', function() {
179      $emergency.slideUp()
180    })
181
182  }
183
184  /**
185   * Top hero
186   */
187  if($('[data-top-hero-button]').length) {  
188    $('[data-top-hero-button]').click(function() {
189      if($(this).hasClass('is-paused')) {
190        $('#youtube')[0].contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*')
191      } else {
192        $('#youtube')[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*')
193      }
194      $('.top-hero__bg').toggleClass('is-paused')
195      $(this).toggleClass('is-paused')
196    })
197  }
198
199  /**
200   * Highlight slider
201   */
202  if($('[data-highlight-slider]').length) {
203    $('[data-highlight-slider]').each(function() {
204      const numberOfSlides = $(this).find('.swiper-slide').length
205      if(numberOfSlides < 4) {
206        $(this).addClass('pc-hide-nav')
207      }
208      const swiper = new Swiper($(this).find('.swiper')[0], {
209        // loop: true,
210        slidesPerView: 1,
211        navigation: {
212          nextEl: $(this).find('.highlight-slider__next')[0],
213          prevEl: $(this).find('.highlight-slider__prev')[0],
214        },
215        breakpoints: {
216          768: {
217            slidesPerView: 3,
218          },
219        }
220      })
221    })
222  }
223
224  /**
225   * News slider
226   */
227  if($('[data-top-news-slider]').length) {
228    $('[data-top-news-slider]').each(function() {
229      const numberOfSlides = $(this).find('.swiper-slide').length
230      const $pagination = $('.top-event__slider-pagination')
231      if(numberOfSlides < 5) {
232        $pagination.hide()
233      }
234      const numberOfPages = numberOfSlides % 4 === 0 ? numberOfSlides / 4 : Math.floor(numberOfSlides / 4) + 1
235      
236      // Generate pagination
237      for(let i = 0; i < numberOfPages; i++) {
238        $pagination.append(`<button></button>`)
239      }
240
241      // Init slider
242      const swiper = new Swiper($(this).find('.swiper')[0], {
243        slidesPerView: 1,
244        spaceBetween: 15,
245        navigation: {
246          nextEl: $(this).find('.top-event__slider-next')[0],
247          prevEl: $(this).find('.top-event__slider-prev')[0],
248        },
249        scrollbar: {
250          el: $(this).find('.swiper-scrollbar')[0],
251          draggable: true,
252          hide: false,
253        },
254        breakpoints: {
255          768: {
256            // loop: true,
257            slidesPerView: 4,
258            spaceBetween: 20,
259          },
260        },
261        on: {
262          init(swiper) {
263            const currentSlideIndexOne = swiper.realIndex + 1
264            const currentPage = currentSlideIndexOne % 4 === 0 ? currentSlideIndexOne / 4 : Math.floor(currentSlideIndexOne / 4) + 1
265            $pagination.find('button').removeClass('is-active')
266            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active')
267          },
268          slideChange(swiper) {
269            const currentSlideIndexOne = swiper.realIndex + 1
270            const currentPage = currentSlideIndexOne % 4 === 0 ? currentSlideIndexOne / 4 : Math.floor(currentSlideIndexOne / 4) + 1
271            $pagination.find('button').removeClass('is-active')
272            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active')
273          }
274        }
275      })
276
277      // Custom pagination click
278      $pagination.find('button').each(function() {
279        $(this).on('click', function() {
280          const index = $(this).index()
281          const slideTo = (index+1) * 4 - 4
282          swiper.slideToLoop(slideTo)
283        })
284      })
285    })
286  }
287
288  /**
289   * Awards slider
290   */
291  if($('[data-top-awards-slider]').length) {
292    $('[data-top-awards-slider]').each(function() {
293      const numberOfSlides = $(this).find('.swiper-slide').length
294      const $pagination = $('.top-awards__slider-pagination')
295      if(numberOfSlides < 4) {
296        $pagination.hide()
297      }
298      const numberOfPages = numberOfSlides % 3 === 0 ? numberOfSlides / 3 : Math.floor(numberOfSlides / 3) + 1
299      
300      // Generate pagination
301      for(let i = 0; i < numberOfPages; i++) {
302        $pagination.append(`<button></button>`)
303      }
304
305      // Init slider
306      const swiper = new Swiper($(this).find('.swiper')[0], {
307        // loop: true,
308        slidesPerView: 1,
309        spaceBetween: 15,
310        navigation: {
311          nextEl: $(this).find('.top-awards__slider-next')[0],
312          prevEl: $(this).find('.top-awards__slider-prev')[0],
313        },
314        scrollbar: {
315          el: $(this).find('.swiper-scrollbar')[0],
316          draggable: true,
317          hide: false,
318        },
319        breakpoints: {
320          768: {
321            slidesPerView: 3,
322            spaceBetween: 20,
323          },
324        },
325        on: {
326          init(swiper) {
327            const currentSlideIndexOne = swiper.realIndex + 1
328            const currentPage = currentSlideIndexOne % 3 === 0 ? currentSlideIndexOne / 3 : Math.floor(currentSlideIndexOne / 3) + 1
329            $pagination.find('button').removeClass('is-active')
330            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active')
331          },
332          slideChange(swiper) {
333            const currentSlideIndexOne = swiper.realIndex + 1
334            const currentPage = currentSlideIndexOne % 3 === 0 ? currentSlideIndexOne / 3 : Math.floor(currentSlideIndexOne / 3) + 1
335            $pagination.find('button').removeClass('is-active')
336            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active')
337          }
338        }
339      })
340
341      // Custom pagination click
342      $pagination.find('button').each(function() {
343        $(this).on('click', function() {
344          const index = $(this).index()
345          const slideTo = (index+1) * 3 - 3
346          swiper.slideToLoop(slideTo)
347        })
348      })
349    })
350  }
351
352  if($('[data-top-hero-fader]').length) {
353    $('[data-top-hero-fader]').each(function() {
354      const $pagination = $('.top-hero__fader-pagination');
355      const swiper = new Swiper($(this).find('.swiper')[0], {
356        loop: true,
357        slidesPerView: 1,
358        allowTouchMove: false,
359        effect: 'fade',
360        speed: 2000,
361        autoplay: { 
362          delay: 5500, 
363          disableOnInteraction: false, 
364         },
365        on: {
366          init(swiper) {
367            const currentPage = swiper.realIndex+1;
368            $pagination.find('button').removeClass('is-active');
369            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active');
370          },
371          slideChange(swiper) {
372            const currentPage = swiper.realIndex+1;
373            $pagination.find('button').removeClass('is-active');
374            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active');
375            console.log("currentpage"+currentPage);
376          }
377        }
378      });
379
380      // Custom pagination click
381      $pagination.find('button').each(function() {
382        $(this).on('click', function() {
383          const index = $(this).index()
384          const slideTo = index
385          swiper.slideToLoop(slideTo)
386        })
387      })
388    })
389  }
390  /**
391   * Hero slider
392   */
393  if($('[data-top-hero-slider]').length) {
394    $('[data-top-hero-slider]').each(function() {
395      const $pagination = $('.top-hero__slider-pagination');
396      const numberOfSlides = $(this).find('.swiper-slide').length
397      // Generate pagination
398      for(let i = 0; i < numberOfSlides; i++) {
399        $pagination.append(`<button></button>`)
400      }
401      const swiper = new Swiper($(this).find('.swiper')[0], {
402        centeredSlides: true,
403        loop: true,
404        slidesPerView: 1.2,
405        allowTouchMove: false,
406        speed: 2000,
407        autoplay: { 
408          delay: 5500, 
409          disableOnInteraction: false, 
410         },
411        navigation: {
412          nextEl: $(this).find('.top-hero__slider-next')[0],
413          prevEl: $(this).find('.top-hero__slider-prev')[0],
414        },
415        breakpoints: {
416          768: {
417            slidesPerView: 1,
418          },
419         },
420        on: {
421          init(swiper) {
422            const currentPage = swiper.realIndex+1;
423            $pagination.find('button').removeClass('is-active');
424            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active');
425          },
426          slideChange(swiper) {
427            const currentPage = swiper.realIndex+1;
428            $pagination.find('button').removeClass('is-active');
429            $pagination.find(`button:nth-child(${currentPage})`).addClass('is-active');
430            console.log("currentpage"+currentPage);
431          }
432        }
433      });
434
435      // Custom pagination click
436      $pagination.find('button').each(function() {
437        $(this).on('click', function() {
438          const index = $(this).index()
439          const slideTo = index
440          swiper.slideToLoop(slideTo)
441        })
442      })
443    })
444  }
445
446  /**
447   * Featured slider
448   */
449  if($('[data-top-featured-slider]').length) {
450    $('[data-top-featured-slider]').each(function() {
451      const swiper = new Swiper($(this).find('.swiper')[0], {
452        // loop: true,
453        navigation: {
454          nextEl: $(this).find('.top-featured__slider-next')[0],
455          prevEl: $(this).find('.top-featured__slider-prev')[0],
456        },
457        pagination: {
458          el: $(this).find('.swiper-pagination')[0],
459          clickable: true,
460        }
461      })
462
463    })
464  }
465
466  /**
467   * Instagram slider
468   */
469   function getMedia(id, max_data, video_style, callback) {
470     $.ajax({
471       url: 'https://www.tus.ac.jp/instagram_media/media.php',
472       type: 'GET',
473       cache: false,
474       dataType: 'json'
475     }).done(function (json) {
476       if (json.status == 'success') {
477         var tag = '<div class="swiper"><div class="swiper-wrapper">';
478         if (json.data) {
479           for (let i = 0; i < json.data.length; i++) {
480             if (i == max_data) break;
481             var row = json.data[i];
482             tag += ('<div class="swiper-slide"><a href="' + row.permalink + '" target="_blank">');
483             if (row.media_type == 'VIDEO') {
484               if (video_style == 1 || row.thumbnail_url === undefined) {
485                 tag += ('<video src="' + row.media_url + '" autoplay muted playsinline loop></video>');
486               } else {
487                 tag += ('<img src="' + row.thumbnail_url + '" />');
488               }
489             } else {
490               tag += ('<img src="' + row.media_url + '" />');
491             }
492             tag += ('</a></div>');
493           }
494         }
495         tag += ('</div></div>');
496         $(id).html(tag);
497
498         callback()
499       } else {
500          $(id).parents('.top-instagram').hide();
501          console.log('取得できません');
502         if (json.instagram_error !== undefined) {
503          console.log(json.instagram_error);
504         } else {
505           if (json.reason == 'curl_init_failed') {
506            console.log('インスタAPIエラー: このサーバーではcURLが使用できません。サーバー管理者にお問合せください。')
507           } else if (json.reason == 'instagram_token_refresh_faild') {
508            console.log('長期アクセストークンの更新に失敗しました。サーバー管理者にお問合せください。');
509           } else {
510            console.log(json.reason);
511           }
512         }
513       }
514     }).fail(function (jqXHR, textStatus, errorThrown) {
515       console.log('[getMedia] jqXHR.status[' + jqXHR.status + '] textStatus[' + textStatus + ']  errorThrowm[' + errorThrown + ']');
516     });
517   }
518
519  function instagramSlider() {
520    const swiper = new Swiper($('[data-top-instagram]').find('.swiper')[0], {
521      // loop: true,
522      slidesPerView: 3,
523      spaceBetween: 10,
524      navigation: {
525        nextEl: $('.top-instagram__slider').find('.top-instagram__slider-next')[0],
526        prevEl: $('.top-instagram__slider').find('.top-instagram__slider-prev')[0],
527      },
528      breakpoints: {
529        768: {
530          slidesPerView: 4,
531          spaceBetween: 20,
532        },
533      },
534    })
535  }
536  instagramSlider()
537
538  if($('[data-top-instagram]').length) {
539    getMedia('[data-top-instagram]', 12, 1, instagramSlider)
540  }
541
542  /**
543   * Plan 2026
544   * /about/features/plan2026/
545   */
546  if($('[data-plan2026-slider]').length) {
547    let plan2026SliderInitialized = false
548    let plan2026SliderSwiper
549    const $plan2026SliderTitle = $('[data-plan2026-slider-ttl]')
550
551    function plan2026Slider() {
552      $('.plan2026-categories').append($plan2026SliderTitle)
553
554      plan2026SliderSwiper = new Swiper('[data-plan2026-slider]', {
555        loop: true,
556        spaceBetween: 12,
557        navigation: {
558          nextEl: '[data-plan2026-slider] .swiper-button-next',
559          prevEl: '[data-plan2026-slider] .swiper-button-prev',
560        },
561      })
562      plan2026SliderInitialized = true      
563    }
564
565    // Init on SP
566    if(spMediaQuery.matches) {
567      plan2026Slider()
568    }
569
570    // Watch media query change
571    spMediaQuery.addEventListener('change', function(e) {
572
573      if(e.matches) {
574        // On SP
575        // Init slider
576        plan2026Slider()
577      } else {
578        // On PC
579        // If slider has been initialized
580        if(plan2026SliderInitialized) {
581          plan2026SliderSwiper.destroy(true, true)
582          $('.plan2026-categories__list').prepend($plan2026SliderTitle)
583        }
584      }
585    })
586  }
587/*アコーディオン全て開閉*/
588 $('dl.plist_type_base').before('<div class="alloc"><button>
588[すべて開く]</button></div>');
589 $('div.alloc button').on('click', function() {
590   if ( $(this).hasClass("opened")){
591       $(this).html('[すべて開く]');
592       $(this).removeClass('opened');
593       $(this).parent().next('dl.plist').find('dt.plist__head > a.plist__head-link').attr('aria-expanded', false);
594       $(this).parent().next('dl.plist').find('dt.plist__head > a.plist__head-link').removeClass('collapse');
595       $(this).parent().next('dl.plist').find('dt.plist__head > a.plist__head-link').addClass('collapsed');
596       $(this).parent().next('dl.plist').find('dd').attr('aria-hidden', true);
597       $(this).parent().next('dl.plist').find('dd').removeClass('show');
598       }
599   else{
600       $(this).html('[すべて閉じる]');
601       $(this).addClass('opened');
602       $(this).parent().next('dl.plist').find('dt.plist__head > a.plist__head-link').attr('aria-expanded', true);
603       $(this).parent().next('dl.plist').find('dt.plist__head > a.plist__head-link').addClass('collapse');
604       $(this).parent().next('dl.plist').find('dt.plist__head > a.plist__head-link').removeClass('collapsed');
605       $(this).parent().next('dl.plist').find('dd').attr('aria-hidden', false);
606       $(this).parent().next('dl.plist').find('dd').addClass('show');
607       }
608    })
609})

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.