PageSourceSearch

https://www.cotocoto.jp/shared/js/shared.js

js cotocoto.jp collected 2026-10-02 06:41:45 UTC 8,770 bytes, 356 lines download raw bytes

1var TargetPos =  $('section.nav-target').offset().top;
2var offsetY;
3var page = $('body').attr('id') || '';
4
5$(function() {
6	$('body').removeClass('navOpen');
7	$('#ft_fixed').removeClass('hide');
8	
9	switch (page) {
10		case 'index':
11			indexPg();
12			break;
13		case 'about':
14			aboutPg();
15			break;
16		case 'dinner':
17			dinnerPg();
18			break;
19		case 'party':
20			partyPg();
21			break;
22		case 'takeout':
23			takeoutPg();
24			break;
25		default:
26			break;
27	}
28
29	if($('.nav-fixed[scroll-active]').length && $('.nav-fixed').attr('scroll-active') === "true")
30		$(document).on('scroll', onScroll)
31
32	// BEGIN: Menu toggle
33	$(".hamburger").click(function() {
34		if ($('body').hasClass('navOpen')) {
35			$('body').addClass('navClose');
36			$('body').removeClass('navOpen');
37			$('body').css('position','static');
38			$('#ft_fixed').removeClass('hide');
39			$(".hamburger").removeClass('is-active');
40      $(window).scrollTop(offsetY);
41		} else {
42			$('body').addClass('navOpen');
43			$('body').removeClass('navClose');
44			$("body").removeClass('has_nav');
45			$('#ft_fixed').addClass('hide');
46			$("#pagetop").removeClass("visible");
47			$(".hamburger").addClass('is-active');
48      offsetY = window.pageYOffset;
49      $('body').css({
50        position: 'fixed',
51        width: '100%',
52        'top': -offsetY + 'px'
53      });
54		}
55		return false;
56	});
57	// END: Menu toggle
58
59	$("#menu_toggle a").click(function() {
60		$('body').removeClass('navOpen');
61		$('body').css('position','static');
62		$(window).scrollTop(offsetY);
63		$('#ft_fixed').removeClass('hide');
64		$('.hamburger').removeClass('is-active');
65	});
66
67	$('.nav-fixed a[href^="#"], #menu_toggle a[href^="#"]').on('click', function () {
68		var e = $(this).attr('href');
69		var h = $(window).width() > 767 ? $('.nav-fixed').outerHeight() : 0;
70		var b = $(e).length ? $(e).offset().top : 0;
71		$('html, body').animate({
72			scrollTop: (b + 1 - h)
73		}, 500);
74		//return false;
75	})
76
77  $('.unsmooth').click(function() {
78    if ($('body').hasClass('navOpen')) {
79			$('body').css('position','static');
80      $(window).scrollTop(offsetY);
81      $('body').removeClass('navOpen');
82    } else {
83      offsetY = window.pageYOffset;
84      $('body').css({
85        position: 'fixed',
86        width: '100%',
87        'top': -offsetY + 'px'
88      });
89		}
90  });
91
92	$('[data-remodal-action="close"]').click(function(){
93		$('body').css('position','static');
94    $(window).scrollTop(offsetY);
95	})
96
97	// BEGIN: scroll to top
98	$("body").on("click", "#pagetop", function() {
99		if (!$(this).hasClass("in-scroll")) {
100			$(this).addClass("in-scroll");
101
102			var $scrollDuration = $.inArray($(this).attr("data-duration"), ["slow", "normal", "fast"]) >= 0 || parseInt($(this).attr("data-duration")) > 0 ? $(this).attr("data-duration") : "slow";
103
104			$("html, body").stop().animate({
105				scrollTop: 0
106			}, $scrollDuration, function() {
107				$("#pagetop").removeClass("in-scroll");    
108				$("#pagetop").removeClass("visible"); 
109			});
110		}
111	});
112	// END: scroll to top
113
114	$('.slider').on('touchstart', function() {
115		$('.slider').slick('slickPlay');
116	});
117});
118
119$(window).scroll(function () {
120	let ScrollPos = $(window).scrollTop();
121	if (ScrollPos > TargetPos) {
122		$("body").addClass('has_nav');
123	} else {
124		$("body").removeClass('has_nav');
125	}
126});
127
128// BEGIN: scroll down hidden pagetop
129var lastScrollTop = 0;
130$(window).scroll(function(){
131	var st = $(this).scrollTop();
132	if (lastScrollTop != 0)	{
133		if (st < lastScrollTop){
134			$("#pagetop").addClass("visible");
135			if(st < 10){
136				$("#pagetop").removeClass("visible");
137			}
138		} 
139		else if (st > lastScrollTop){
140			$("#pagetop").removeClass("visible");
141		}
142	}
143	lastScrollTop = st;
144});
145// END: scroll down hidden pagetop
146
147function onScroll() {
148	let scroll = $(window).scrollTop();
149	let header = $('.nav-fixed').outerHeight() + 2;
150	$('.nav-fixed .nav a[href^="#"]').each(function() {
151		var el = $(this).attr('href')
152		var offset = $(el).length ? $(el).offset().top : 0
153		if($(this).find('img').length){
154			var _src_ = $(this).find('img').attr("src");
155			_src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2");
156			$(this).find('img').attr("src", _src_)
157			$(this).find('img').addClass('btn')
158		}
159		if((scroll + header) >= offset && ($(el).outerHeight() + offset) > (scroll + header)){
160			$('.nav-fixed .nav a[href^="#"]').removeClass('active')
161			$(this).addClass('active')
162			if($(this).find('img').length){
163				//$('.nav-fixed a[href^="#"] img').addClass('btn')
164				$(this).find('img').removeClass('btn')
165
166				$('.nav-fixed .nav a[href^="#"] img').each(function(){
167					var src = $(this).attr('src')
168					var newSrc = src.replace('_on', '')
169					$(this).attr('src', newSrc)
170				})
171
172				$(this).find('img').attr("src").match(/^(.*)(\.{1}.*)/g);
173				var newSrc = RegExp.$1 + "_on" + RegExp.$2;
174
175				$(this).find('img').attr("src", newSrc); // update src
176			}
177		}
178	})
179}
180
181function indexPg() {
182	$('#s5Slide').slick({
183		arrows: false,
184		dots: true,
185		autoplay: false,
186		pauseOnFocus:false,
187		pauseOnHover: false,
188		centerMode: true,
189		centerPadding: '8%'
190	});
191
192	var controller = new ScrollMagic.Controller();
193	new ScrollMagic.Scene({
194		triggerElement: "#s5Slide",
195		triggerHook: 0.5,
196		duration: $("#s5Slide").height(), // chieu cao slide
197	}).addTo(controller).on("enter", function (e) {
198		$('#s5Slide').slick('slickPlay');
199	}).on("leave", function (e) {
200		$('#s5Slide').slick('slickPause');
201	});
202
203	$('#s5Tabs .accordion').on('click', '.ttl', function(){
204		var $this = $(this);
205		var $txtbox = $this.next();
206		var $siblings = $this.closest('.item').siblings();
207		if (!$txtbox.is(':animated')) {
208			$siblings.find('.txtbox').slideUp();
209			$txtbox.slideToggle();
210		}
211	})
212}
213
214function aboutPg() {
215	$('.slider').slick({
216		arrows: false,
217		dots: true,
218		autoplay: false,
219		pauseOnFocus:false,
220		pauseOnHover: false,
221	});
222	var controller = new ScrollMagic.Controller();
223	new ScrollMagic.Scene({
224		triggerElement: "#s4Slide",
225		triggerHook: 0.5,
226		duration: $("#s4Slide").height(), // chieu cao slide
227	}).addTo(controller).on("enter", function (e) {
228		$('#s4Slide').slick('slickPlay');
229	}).on("leave", function (e) {
230		$('#s4Slide').slick('slickPause');
231	});
232}
233
234function dinnerPg() {
235	createSlick();
236	$(window).on('resize', createSlick);
237
238  function createSlick(){
239		$('#s3Slide').on('init', function(slick){
240			var controller = new ScrollMagic.Controller();
241			new ScrollMagic.Scene({
242				triggerElement: "#s3Slide",
243				triggerHook: 0.5,
244				duration: $("#s3Slide").height(), // chieu cao slide
245			}).addTo(controller).on("enter", function (e) {
246				$('#s3Slide').slick('slickPlay');
247			}).on("leave", function (e) {
248				$('#s3Slide').slick('slickPause');
249			});
250		});
251
252    $('#s3Slide').not('.slick-initialized').slick({
253      dots: true,
254      infinite: true,
255      speed: 600,
256      cssEase: 'linear',
257      autoplay: false,
258      arrows: false,
259      pauseOnHover: false,
260      pauseOnFocus: false,
261      fade: true,
262      responsive: [{
263        breakpoint: 9999,
264        settings: "unslick"
265      }, {
266          breakpoint: 768,
267          settings: "getslick"
268        }
269      ]
270    });
271  }
272}
273
274function partyPg() {
275	createSlick();
276	$(window).on('resize', createSlick);
277	
278	function createSlick(){
279		$('#s2Slide').on('init', function(slick){
280			var controller = new ScrollMagic.Controller();
281			new ScrollMagic.Scene({
282				triggerElement: "#s2Slide",
283				triggerHook: 0.5,
284				duration: $("#s2Slide").height(), // chieu cao slide
285			}).addTo(controller).on("enter", function (e) {
286				$('#s2Slide').slick('slickPlay');
287			}).on("leave", function (e) {
288				$('#s2Slide').slick('slickPause');
289			});
290		});
291
292    $('#s2Slide').not('.slick-initialized').slick({
293      dots: true,
294      infinite: true,
295      speed: 600,
296      cssEase: 'linear',
297      autoplay: false,
298      arrows: false,
299      pauseOnHover: false,
300      pauseOnFocus: false,
301      fade: true,
302      responsive: [{
303        breakpoint: 9999,
304        settings: "unslick"
305      }, {
306          breakpoint: 768,
307          settings: "getslick"
308        }
309      ]
310    });
311  }
312}
313
314function takeoutPg() {
315	$('.slider').slick({
316		dots: true,
317		arrows: false,
318		pauseOnHover: false,
319		pauseOnFocus: false,
320		fade: true,
321		autoplay: true
322	});
323	$(".slidescroll").slick({
324		arrows: false,
325		speed: 5000,
326		autoplay: true,
327		autoplaySpeed: 0,
328		cssEase: 'linear',
329		slidesToShow: 4,
330		slidesToScroll: 1,
331		infinite: true,
332		swipeToSlide: true,
333		centerMode: true,
334		focusOnSelect: true,
335		pauseOnHover: false,
336		pauseOnFocus: false,
337		responsive: [
338			{
339				breakpoint: 768,
340				settings: {
341					slidesToShow: 3,
342				}
343			},
344			{
345				breakpoint: 475,
346				settings: {
347					slidesToShow: 2,
348				}
349			}
350		]
351	});
352}
353
354let doc = document.documentElement;
355doc.style.setProperty('--app-height', `${window.innerHeight}px`);
356window.addEventListener('resize', doc.style.setProperty('--app-height', `${window.innerHeight}px`))

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.