PageSourceSearch

https://yubune.co/wp-content/themes/yubune3/js/script.js?1791177870

js yubune.co collected 2026-10-05 05:24:49 UTC 10,657 bytes, 468 lines download raw bytes

1$(function () {
2
3	$('.room_img_main_01').slick({	
4		asNavFor:".room_img_thumb_01",
5		slidesToShow: 1,
6		fade: true,
7		arrows: false,
8	});
9	$('.room_img_thumb_01').slick({
10		asNavFor:".room_img_main_01",
11		slidesToShow: 12,
12		focusOnSelect: true,
13		lazyLoad:"progressive",
14	});
15
16	$('.room_img_main_02').slick({	
17		asNavFor:".room_img_thumb_02",
18		slidesToShow: 1,
19		fade: true,
20		arrows: false,
21	});
22	$('.room_img_thumb_02').slick({
23		asNavFor:".room_img_main_02",
24		slidesToShow: 12,
25		focusOnSelect: true,
26		lazyLoad:"progressive",
27	});
28
29	$('.room_img_main_03').slick({	
30		asNavFor:".room_img_thumb_03",
31		slidesToShow: 1,
32		fade: true,
33		arrows: false,
34	});
35	$('.room_img_thumb_03').slick({
36		asNavFor:".room_img_main_03",
37		slidesToShow: 12,
38		focusOnSelect: true,
39		lazyLoad:"progressive",
40	});
41
42	//グローバルナビ開閉
43	$('.sp-btn-trigger').on('click', function(){
44		$(this).toggleClass('is-active');
45		$('.sp-nav-wrap').fadeToggle(500);
46		return false;
47	});
48	
49	$('.sp-nav-wrap a').on('click', function(){
50		$('.sp-btn-trigger').removeClass('is-active');
51		$('.sp-nav-wrap').fadeToggle(500);
52	});
53
54	let ScrTop;
55	let viewerWidth = window.innerWidth ? window.innerWidth : $(window).width();
56	let viewerHeight = window.innerHeight ? window.innerHeight : $(window).height();
57	const firstViewerHeight = viewerHeight;
58	let breakpoint = 750;
59	let $swiper;
60	let timer = false;
61	let $slideshow1, $slideshow2;
62	let h1_flg = true;
63	let hash=location.hash;
64	
65	const setFillHeight = () => {
66	  const vh = window.innerHeight * 0.01;
67	  document.documentElement.style.setProperty('--vh', `${vh}px`);
68	}
69
70	$(window).load(function () {
71		$("#loading").fadeOut(3000);
72
73		if ($("#home").length) {
74			setTimeout(function () {
75				$("#news").addClass("show");
76				$("#burger").addClass("news");
77				$("#covid").addClass("show");
78				$("#burger").addClass("covid");
79			}, 1000);
80		}
81	});
82
83
84	$(window).on("load resize", function () {
85		viewerWidth = window.innerWidth ? window.innerWidth : $(window).width();
86		viewerHeight = window.innerHeight ? window.innerHeight : $(window).height();
87		
88		//setFillHeight();
89
90		if (viewerWidth > breakpoint) {
91
92			if ($("body#home").length) {
93				$("main section:nth-child(1), #news, #news >a").css("height", "100vh");
94			}
95
96		} else {
97			if ($("body#home").length) {
98				$("#news, #news >a").css("height", viewerHeight);
99				$("main section:nth-child(1)").css("height", firstViewerHeight);
100				//log($("main section:nth-child(1)").offset().top);
101			}
102		}
103	});
104
105	$(window).on("load scroll", function () {
106		ScrTop = $(document).scrollTop();
107		//console.log(ScrTop);
108
109		if (viewerWidth > breakpoint) {
110			$("header").removeClass("bg");
111			if(ScrTop>0){
112				$("header").addClass("s");
113			}else{
114				$("header").removeClass("s");
115			}
116		}else{
117			$("header").removeClass("s");
118			if(ScrTop>0){
119				$("header").addClass("bg");
120			}else{
121				$("header").removeClass("bg");
122			}
123		}
124		/*
125		if ($("#home").length) {
126
127			if (viewerWidth > breakpoint) {
128
129			} else {
130				let $h1;
131				$h1 = $("main>section:nth-child(1) > div>h1");
132				let y = ScrTop - ($h1.offset().top + $h1.height());
133				if (y > 0) {
134					$("header h1").addClass("show");
135					h1_flg = true;
136				} else {
137					$("header h1").removeClass("show");
138					h1_flg = false;
139				}
140			}
141
142		} else {
143			//$("header h1").addClass("show");
144		}
145		*/
146
147
148		if (viewerWidth > breakpoint) {} else {}
149
150		//(($(document).height()-viewerHeight)-ScrTop)<100
151		
152		if (viewerHeight >= $(document).height()) {
153			$("a.pagetop, a.backto").addClass("show")
154		} else {
155			if (ScrTop > 50) {
156				$("a.pagetop, a.backto").addClass("show")
157			} else {
158				$("a.pagetop, a.backto").removeClass("show")
159			}
160		}
161		
162		pre_ScrTop = ScrTop;
163	});
164
165	init();
166
167	function init() {
168
169		if ($("#home").length) {
170			$("main > section:nth-child(1) .standby").each(function (i, e) {
171				let d = i * 0.5;
172				$(this).css("transition-delay", d + "s");
173				$(this).addClass("go");
174				
175			});			
176		}
177
178		setTimeout(function(){
179
180			$('#public_bath,#accommodation,#activity,#access').waypoint(function (direction) {
181				let arr=['#public_bath','#accommodation','#activity','#access'];
182				let activePoint = $(this.element);
183				let page = activePoint.index('#public_bath,#accommodation,#activity,#access') + 1;
184				let c=activePoint.attr("id").split("#");
185				if (direction === 'down') { //scroll down				
186				} else { //scroll up					
187					page = page - 1
188					//$("header nav.global li."+c).removeClass("current");
189				}
190				$("header nav.global li").removeClass("current");
191				if(page>0){
192					$("header nav.global li:nth-child("+page+")").addClass("current");
193					let id=arr[page-1];
194					//log(page);
195					history.replaceState("", document.title, window.location.pathname  + id);
196				}else{
197					history.replaceState("", document.title, window.location.pathname);
198				}
199			}, {
200				offset: '50%'
201			});
202			
203			if(hash){
204				//log($("main section:nth-child(1)").offset().top);
205				/*
206				$('.standby').each(function(){
207					if($(this).offset().top<$(hash).offset().top){
208					   $(this).removeClass("standby");
209					 }
210				});
211				*/				
212				goto(hash);
213			}
214			
215			$('.standby').waypoint(function (direction) {
216				let activePoint = $(this.element);
217				if (direction === 'down') { //scroll down
218					activePoint.addClass('go');
219				} else { //scroll up
220					//activePoint.removeClass('active');
221				}
222			}, {
223				offset: '98%'
224			});
225
226		},100);
227
228		if ($(".bogo-language-switcher").length) {
229			let en = $(".bogo-language-switcher a[hreflang=en-US]").attr("href");
230			if (en != void(0)) {
231				$("nav.jpen a:nth-child(2)").attr("href", en);
232			} else {
233				$("nav.jpen a:nth-child(2)").addClass("disabled")
234			}
235
236			let jp = $(".bogo-language-switcher a[hreflang=ja]").attr("href");
237			if (jp != void(0)) {
238				$("nav.jpen a:nth-child(1)").attr("href", jp);
239			} else {
240				$("nav.jpen a:nth-child(1)").addClass("disabled")
241			}
242
243		}
244
245		$("a.anchor, nav.global a").click(function () {
246			let href = $(this).attr("href");
247			if($("body.home").length){
248				if(href.indexOf("#")!=-1){
249					let hash="#"+href.split("#")[1]
250					goto(hash);
251					return false;
252				}
253			}
254		
255		});
256					
257		$("a.pagetop").click(function () {
258			goto("#top");
259			return false;
260		});
261
262		if ($("#home").length) {
263
264			let $button_img=$("#news a").parent().find("button img");
265			let $button_img_src=$button_img.attr("src");
266			let $txt_img=$("#news a").find(" img");
267			let $txt_img_src=$txt_img.attr("src");
268			$("#news a").hover(
269				function() {									
270					$button_img.attr("src",$button_img_src.replace(".svg", "_over.svg"));
271					$txt_img.attr("src",$txt_img_src.replace(".svg", "_over.svg"));	
272				},
273				function() {
274					$button_img.attr("src",$button_img_src);
275					$txt_img.attr("src",$txt_img_src);				
276				}
277			);
278
279			$("#news button.close").click(function () {
280				$("#news").removeClass("show");
281				$("#burger").removeClass("news");
282				return false;
283			});
284
285			$("#covid button.close").click(function () {
286				$("#covid").removeClass("show");
287				$("#burger").removeClass("covid");
288				return false;
289			});
290
291			initSwiper();
292		}
293
294		if ($("#second").length) {
295			initSwiper();
296		}
297
298		if ($('a.mail').length) {
299			let mailLink = $('a.mail');
300			let lineFeed = "\r\n";
301			let subject, body;
302
303			if (!$("body.en").length) {
304				// 件名
305				subject = 'お問い合わせ';
306				// 本文
307				body = [
308					'●お名前(必須):',
309					'●メールアドレス(必須):',
310					'●電話番号(必須):',
311					'●住所:',
312					'●お問い合わせ内容:'
313				];
314
315			} else {
316				subject = '【Contact】';
317				// 本文
318				body = [
319					'●Name: ',
320					'●Emai: ',
321					'●Tel: ',
322					'●Address: ',
323					'●Comments: ',
324				];
325			}
326
327			let mailto = "mailto:[email protected]"
328			mailto += '?subject=' + subject;
329			mailto += '&body=' + body.join(encodeURIComponent(lineFeed));
330			mailLink.attr('href', mailto);
331
332		}
333
334	}
335
336	function noScroll(flg) {
337		
338		let movefun = function (event) {
339			event.preventDefault();
340		}
341		if (flg) {
342			ScrTop = $("body").scrollTop();
343			$("body").addClass("noscroll").css({
344				'top': -ScrTop
345			});
346
347			/*
348			$(window).on('touchmove.noScroll', function(e) {
349				e.preventDefault();
350			});
351			*/
352			// スクロール停止の処理
353			//window.addEventListener( 'touchmove' , movefun , { passive: false } );
354
355		} else {
356
357			$("body").removeClass("noscroll").css({
358				'top': ScrTop
359			});
360			//$(window).off('.noScroll');
361			// スクロール停止することを停止する処理
362			//window.removeEventListener( 'touchmove' , movefun, { passive: false } );
363
364		}
365	}
366
367	function goto(id, duration) {
368	
369		//let offsetY=$("header").height();
370		let toY, offsetY;
371		if (id == "#top") {
372			toY = 0
373			offsetY = 0;
374		} else {
375			toY = id;
376			offsetY = 50;
377		}
378		if (duration == undefined) {
379			duration = 0.8
380		}
381		
382
383		TweenLite.to(window, duration, {
384			scrollTo: {
385				y: toY,
386				autoKill: false,
387				offsetY: offsetY
388			},
389			ease: Power3.easeOut,
390			onComplete:function(){
391			
392				if (id == "#top") {
393					history.replaceState("", document.title, window.location.pathname);
394				}else{
395					history.replaceState("", document.title, window.location.pathname  + id);
396				}
397			}
398		});
399
400
401	}
402
403	function initSwiper() {
404		if ($(".swiper-container").length) {
405			new Swiper('.swiper-container', {
406				speed: 1000,
407				//effect: "fade",
408				loop: true,
409				lazy: true,
410				loopFillGroupWithBlank: true,
411				//preloadImages: false,
412				navigation: {
413					nextEl: 'div .swiper-button-next',
414					prevEl: 'div .swiper-button-prev',
415				},
416				pagination: {
417					el: 'div .swiper-pagination',
418					clickable: true,
419				},
420				autoplay: {
421					delay: 4000,
422					disableOnInteraction: false,
423				},
424				on: {
425					slideChange: function () {
426
427						if (this.realIndex == 1) {
428
429						} else {
430
431						}
432					},
433					init: function () {
434						// console.log('swiper initialized');
435					},
436				}
437			});
438		}
439
440	}
441
442	function log(str) {
443		console.log(str);
444	}
445
446});
447
448
449function unixTime2ymd(intTime) {
450	let d = new Date(intTime * 1000);
451	let year = d.getFullYear();
452	let month = d.getMonth() + 1;
453	let day = d.getDate();
454	let hour = (d.getHours() < 10) ? '0' + d.getHours() : d.getHours();
455	let min = (d.getMinutes() < 10) ? '0' + d.getMinutes() : d.getMinutes();
456	let sec = (d.getSeconds() < 10) ? '0' + d.getSeconds() : d.getSeconds();
457	return (year + '.' + month + '.' + day);
458}
459
460function getParam(name, url) {
461	if (!url) url = window.location.href;
462	name = name.replace(/[\[\]]/g, "\\$&");
463	let regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
464		results = regex.exec(url);
465	if (!results) return null;
466	if (!results[2]) return '';
467	return decodeURIComponent(results[2].replace(/\+/g, " "));
468}

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.