PageSourceSearch

https://taiari-anime.com/assets/js/top.js

js taiari-anime.com collected 2026-09-25 04:06:53 UTC 13,802 bytes, 486 lines download raw bytes

1const $body = $('body,html');
2const hs = location.hash;
3const skiped = hs === '#skip';//loading,スクロールアニメーションのスキップ
4let _default_ytid_fv = '5PAsOIcot7I';
5
6/*-----------------------------------------------
7 * LOADING
8-------------------------------------------------*/
9$(window).on('load', function () {
10	if ( skiped ) {
11	  // hash(#skip)
12	  $("#loading").remove();
13	  $("body").addClass('-loaded');
14	  $(".kv_logo").addClass('-view');
15	  $(".header").addClass('-view');
16	} else if ( !(skiped) && $(hs)[0] ) {
17		// hash(#skip)以外
18		if(spOnly.matches){
19			var loffset = $(hs).offset().top - 100;
20		}
21		else{
22			var loffset = $(hs).offset().top - 250;
23		}
24		$('body,html').animate({scrollTop:loffset}, 0, 'easeOutQuart');
25
26		$(".js-scrani").addClass('is-ani');
27		$(".kv_logo").addClass('-view');
28		setTimeout(function(){
29			setTimeout(function(){
30				$("#loading").fadeOut(600);
31				setTimeout(function(){
32					$("body").addClass('-loaded');
33					$("body").css({'overflow':''});
34					setTimeout(function(){
35						$(".header").addClass('-view');
36					},400);
37
38				},200);
39			},0);
40		},1200);
41
42
43	} else {
44		setTimeout(function(){
45			setTimeout(function(){
46				$("#loading").fadeOut(600);
47				setTimeout(function(){
48					$("body").addClass('-loaded');
49					$("body").css({'overflow':''});
50				},200);
51			},0);
52		},1200);
53	  // hashなし
54	  loadSclTop();
55	}
56	
57  });
58/*-----------------------------------------------
59 * VISUAL
60----------------------------------------------- */
61function loadSclTop() {
62	let TopH = $(".js-visual").outerHeight();
63	let scrollPos = TopH * .7;
64	const easing = 'easeInOutExpo';
65	let scrollPosEnd = TopH * .24;
66
67	var windowHeight = $(window).height();
68	// PC
69	if(pcOnly.matches){
70		$('#fullWrap').css({ 'height': scrollPos, 'overflow': 'hidden' });
71		$body.animate({ scrollTop: windowHeight }, 10, easing);
72	}
73
74	setTimeout(function () {
75		if(pcOnly.matches){//PC
76			// ページトップまで自動スクロール
77			if(TopH >= windowHeight* 1.3){
78				$body.animate({ scrollTop: 0 },1500, easing);
79			}
80			setTimeout(function() {
81				$('#fullWrap').css({ 'height': 'auto', 'overflow': 'unset' });
82				$(".kv_logo").addClass('-view');
83				$(".kv_movie, .fv__bnr, .kv__changeBtn-listsBoxWrap").addClass('-view');
84				setTimeout(function() {
85					$(".header").addClass('-view');
86				}, 	1000);	
87			}, 	1600);
88		}else{//SP
89			$(".kv_logo").addClass('-view');
90			$(".header").addClass('-view');
91			$(".kv_movie, .fv__bnr, .kv__changeBtn-listsBoxWrap").addClass('-view');
92		}
93	  }, 2400)
94}
95/*-----------------------------------------------
96 * NAV
97----------------------------------------------- */
98sections=['news','introduction','character','staffcast','books'];
99const section_option = {
100	threshold: 0,
101	rootMargin: '-49% 0px -50%',
102}
103const nSections = [];
104sections.forEach(section=>{
105	const section_target = document.querySelector('#'+section);
106	const section_observer = new IntersectionObserver(([{isIntersecting}]) => {
107		if (isIntersecting) {
108			$("body").addClass('in-'+section);
109			$(".js-anchor[data-nav!='#"+section+"']").parent().removeClass('is-active');
110			$("[data-nav='#"+section+"']").parent().addClass('is-active');
111		}else{
112			$("body").removeClass('in-'+section);
113			$(".js-anchor[data='data-nav']").parent().removeClass('is-active');
114		}
115	},section_option);
116	section_observer.observe(section_target);
117});
118
119/*-----------------------------------------------
120 * YouTube API
121-------------------------------------------------*/
122var tag = document.createElement('script');
123tag.src = "https://www.youtube.com/iframe_api";
124var firstScriptTag = document.getElementsByTagName('script')[0];
125firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
126
127var players = {}; 
128var ytIDs = {
129    fv: [_default_ytid_fv], 
130};
131var ytNow = { fv: 0};
132var ytSize = 'large';
133// Iframe APIが準備完了した時に呼ばれる
134function onYouTubeIframeAPIReady() {
135    createPlayer('fv', ytIDs.fv[ytNow.fv]);
136}
137// プレイヤーを作成する共通関数
138function createPlayer(area, videoId) {
139    players[area] = new YT.Player(`js-${area}-yt-autoplay`, {
140        height: '100%',
141        width: '100%',
142        videoId: videoId,
143        events: {
144            'onReady': onPlayerReady,
145            'onStateChange': onPlayerStateChange,
146            'onError': onPlayerError
147        },
148        playerVars: {
149            rel: 0,
150            controls: 0,
151            disablekb: 1,
152            fs: 0,
153            iv_load_policy: 3,
154            showinfo: 0,
155            modestbranding: 1,
156            playsinline: 1,
157        }
158    });
159}
160// プレイヤーが準備完了したら再生を開始
161function onPlayerReady(event) {
162    event.target.mute();
163    event.target.playVideo();
164}
165// プレイヤーの状態が変わった時の処理
166function onPlayerStateChange(event) {
167    const player = event.target;
168    const playerId = player.getIframe().id;  // プレイヤーのIDを取得
169    const area = playerId.replace('js-', '').replace('-yt-autoplay', '');  // IDからエリア名を取得
170
171    if (event.data == YT.PlayerState.ENDED) {
172        ytNow[area]++;
173        if (ytNow[area] >= ytIDs[area].length) ytNow[area] = 0;
174        player.loadVideoById(ytIDs[area][ytNow[area]], 0, ytSize);
175        player.playVideo();
176    }
177}
178function onPlayerError(event) {
179    //console.log(event);
180}
181// 動画停止関数
182function stopVideo(player) {
183    if (player && typeof player.stopVideo === 'function') {
184        player.stopVideo();
185    }
186}
187// 動画再生関数
188function playVideo(player) {
189    if (player && typeof player.playVideo === 'function') {
190        player.playVideo();
191    }
192}
193
194/*-----------------------------------------------
195 * STAFF COMMENT
196----------------------------------------------- */
197function comment(_comment, _cid, _option) {
198	// HTML RESET
199	$("#js-commentModalCont").html('');
200	$("#js-commentModalCont").removeClass();
201
202	// commentParts Setting
203	let commentParts;
204	if (_comment == 'staff') {
205		commentParts = staff[_cid];
206	} else if (_comment == 'cast') {
207		commentParts = cast[_cid];
208	}
209	if (!commentParts) {
210		return;
211	}
212
213	// OPTION
214	if (_option) {
215		$("#js-commentModalCont").addClass(_option);
216	}
217
218	//option Check
219	let commentOption = '';
220	if (commentParts.option) {
221		commentOption += ' ' +commentParts.option;
222	}
223
224	// IMG CHACK 
225	let commentImg = '';
226	let commentImgClass = '';
227	if (commentParts.img) {
228		commentImg += '<div class="commentCont__img"><div class="commentCont__imgIn"><img src="' + root + 'assets/img/top/staff_comment/' + commentParts.img + '" alt="' + commentParts.name + '" class="-ndlimg"></div></div>';
229		commentImgClass += '_img';
230	}
231
232	//HTML
233	$("#js-commentModalCont").append('<div class="commentCont '+ commentOption +'"><div class="comment-titleWrap"><h3 class="commentCont__h3"><small class="commentCont__h3_job">' + commentParts.job + '</small><span class="commentCont__h3_name">' + commentParts.name + '</span></h3></div><div class="commentContBox">' + commentImg + '<div class="commentCont__txt ' + commentImgClass + '">' + commentParts.comment + '</div></div></div>');
234
235	// MODALOPEN
236	$('#commentModal').fadeIn(500);
237	$('.modalBox').fadeIn(500);
238	$('body').css({ 'overflow': 'hidden' });
239}
240
241/*-----------------------------------------------
242 * CHARACTER DETAIL
243----------------------------------------------- */
244var charaNum_right = $(".js-charaBtn[data-box='_right']:first-child").data('chara');
245var charaNum_left = $(".js-charaBtn[data-box='_left']:first-child").data('chara');
246
247$(".js-charaBtn").on('click',function(){
248	var charaBox = $(this).data('box');
249	var charaNum = $(this).data('chara');
250	//activeなキャラ
251	if(charaBox == '_left'){
252		charaNum_left = $(this).data('chara');
253	}else{
254		charaNum_right = $(this).data('chara');
255	}
256
257	if(spOnly.matches){
258		var charaContainer = '_left';
259		$(".js-charaBtn").removeClass('is-active');
260	}else{
261		var charaContainer = charaBox;
262		$('[data-box="'+charaContainer+'"]').removeClass('is-active');
263	}
264
265	$(this).addClass('is-active');
266
267	$(".js-charaDetail."+charaContainer+"Block").removeClass('-view');
268	
269	$(".js-charaDetail."+charaContainer+"Block").load('./character/'+charaNum+'.html',function(){
270		setTimeout(function(){
271			$(".js-charaDetail."+charaContainer+"Block").addClass('-view')
272        },100);
273
274	});
275
276	if(spOnly.matches){
277		var chara_pos = $("#character").offset().top;
278		$('body,html').animate({scrollTop:chara_pos}, 1000, 'easeOutQuart');
279		return false;
280	}
281});
282
283$(window).on('load',function(){
284	if(spOnly.matches){
285		d_sp=true;
286	}else{
287		d_sp=false;
288	}
289
290	charaSetting();
291});
292$(window).on('resize',function(){
293	if(d_sp == false || pcOnly.matches){
294		charaSetting();
295	}
296});
297var d_sp = false;
298
299function charaSetting() {
300	$('.js-charaBtn').removeClass('is-active');
301	setTimeout(function () {
302		$(".js-charaDetail._leftBlock").load('./character/'+charaNum_left+'.html');
303		if(pcOnly.matches){
304			$(".js-charaDetail._rightBlock").load('./character/'+charaNum_right+'.html');
305		}
306	}, 	10);
307	$(".js-charaDetail").addClass('-view');	
308	$(".js-charaBtn[data-chara='"+ charaNum_left +"'").addClass("is-active");
309	if(spOnly.matches){
310		$('._rightBlock').css({ 'display': 'none' });
311		if(d_sp == false){
312			$('[data-box="_right"]').removeClass('is-active');			
313			d_sp=true;
314		}
315	}else{
316		d_sp =false;
317		$('._rightBlock').css({ 'display': 'flex' });
318		$(".js-charaBtn[data-chara='"+ charaNum_right +"'").addClass("is-active");
319
320	}
321}
322
323/*-----------------------------------------------
324 * COMICS
325-------------------------------------------------*/
326let speed = 3000;
327var comicsSwiper = null;
328if (document.querySelector('#js-comics__swiper')) {
329	comicsSwiper = new Swiper("#js-comics__swiper", {
330		slidesPerView: 'auto',
331		loop: true,
332		speed: 3000,
333		autoplay: {
334			delay: 0,
335		},
336		watchSlidesProgress: true,
337		preloadImages: false,
338		lazy: {
339			loadPrevNext: true,
340			loadPrevNextAmount: 6,
341			loadOnTransitionStart: true,
342		},
343	});
344	(function preloadComicsWhenBooksNearViewport() {
345		var books = document.getElementById('books');
346		if (!books || !comicsSwiper || !comicsSwiper.lazy || typeof IntersectionObserver === 'undefined') {
347			return;
348		}
349		var io = new IntersectionObserver(function (entries, observer) {
350			for (var i = 0; i < entries.length; i++) {
351				if (!entries[i].isIntersecting) continue;
352				observer.disconnect();
353				var lz = comicsSwiper.lazy;
354				if (typeof lz.load === 'function') {
355					lz.load();
356				}
357				var max = Math.min(comicsSwiper.slides.length, 12);
358				for (var s = 0; s < max; s++) {
359					if (typeof lz.loadInSlide === 'function') {
360						lz.loadInSlide(s);
361					}
362				}
363				break;
364			}
365		}, { root: null, rootMargin: '0px 0px 45% 0px', threshold: 0 });
366		io.observe(books);
367	})();
368}
369let getTranslate;
370(function () {
371	var comicsEl = document.querySelector('#js-comics__swiper');
372	if (!comicsEl || !comicsSwiper) return;
373	comicsEl.addEventListener('mouseenter', function () {
374		getTranslate = comicsSwiper.getTranslate();
375		comicsSwiper.setTranslate(getTranslate);
376		comicsSwiper.setTransition(0);
377	});
378	comicsEl.addEventListener('mouseleave', function () {
379		getTranslate = comicsSwiper.getTranslate();
380		var active = document.querySelector('#js-comics__swiper .swiper-slide-active');
381		if (!active) return;
382		var getSlideWidthMgLeft = active.style.marginLeft;
383		if (getSlideWidthMgLeft) {
384			getSlideWidthMgLeft = parseFloat(getSlideWidthMgLeft);
385		} else {
386			getSlideWidthMgLeft = 0;
387		}
388		var getSlideWidthMgRight = active.style.marginRight;
389		if (getSlideWidthMgRight) {
390			getSlideWidthMgRight = parseFloat(getSlideWidthMgRight);
391		} else {
392			getSlideWidthMgRight = 0;
393		}
394		var getSlideWidth = active.offsetWidth;
395		var getTotalSlideWidth = getSlideWidthMgLeft + getSlideWidthMgRight + getSlideWidth;
396		var diff = -getTotalSlideWidth - (getTranslate % getTotalSlideWidth);
397		var diffTime = diff / -getSlideWidth;
398		comicsSwiper.setTranslate(getTranslate + diff);
399		comicsSwiper.setTransition(speed * diffTime);
400	});
401})();
402
403/*-----------------------------------------------
404 * VISUAL
405-------------------------------------------------*/
406const kvSwiper = new Swiper('#js-kvListsWrap', {
407  loop: false,
408  speed: 500,
409  initialSlide: 1,	
410  //effect: 'fade',
411  allowTouchMove: false, 
412
413  on: {
414    slideChange: function () {
415      updateKvBtn(this.realIndex);
416    }
417  }
418});
419function KvSelect(index) {
420  kvSwiper.slideTo(index);
421}
422function updateKvBtn(index) {
423  $('.js-KvSelect').removeClass('is-active');
424  $('#js-KvSelect' + index).addClass('is-active');
425  $('.hdArea').attr('data-visnum',index);
426}
427$(window).on('load', function () {
428  updateKvBtn(1);
429});
430
431/*-----------------------------------------------
432 * TOP BANNER
433-------------------------------------------------*/
434var topBnrSwiper = null;
435var topBnrSwiperChk = 0;
436
437function initTopBnrSwiper(mm) {
438	var topBnrLists = document.getElementById('js-topBnrLists');
439	if (!topBnrLists) return;
440
441	var topBnrCount = topBnrLists.childElementCount;
442
443	if (topBnrSwiperChk === 1 && topBnrSwiper) {
444		topBnrSwiper.destroy(false, true);
445		topBnrSwiper = null;
446		topBnrSwiperChk = 0;
447	}
448
449	if (mm.matches && topBnrCount >= 2) {
450		topBnrSwiper = new Swiper('.js-topBnrSwiper', {
451			slidesPerView: 'auto',
452			loop: true,
453			pagination: {
454				el: '.js-topBnr-pagination',
455				clickable: true,
456			},
457			centeredSlides: true,
458		});
459		topBnrSwiperChk = 1;
460	} else if (!mm.matches && topBnrCount >= 4) {
461		topBnrSwiper = new Swiper('.js-topBnrSwiper', {
462			slidesPerView: 'auto',
463			loop: true,
464			pagination: {
465				el: '.js-topBnr-pagination',
466				clickable: true,
467			},
468			breakpoints: {
469				0: {
470					centeredSlides: true,
471				},
472				768: {
473					centeredSlides: false,
474				},
475			},
476		});
477		topBnrSwiperChk = 1;
478	}
479}
480
481if (document.getElementById('js-topBnrLists')) {
482	initTopBnrSwiper(spOnly);
483	spOnly.addEventListener('change', function () {
484		initTopBnrSwiper(spOnly);
485	});
486}

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.