PageSourceSearch

https://www.sumigoya.com/shared/js/shared.js

js sumigoya.com collected 2026-10-07 23:21:24 UTC 5,128 bytes, 176 lines download raw bytes

1var TargetPos = $('section.nav-target').offset().top || 0;
2var offsetY;
3var page = $('body').attr('id') || '';
4
5$(function() {
6	$('body').removeClass('navOpen');
7	$('#ft_fixed').removeClass('hide');
8
9	// if($('.nav-fixed[scroll-active]').length && $('.nav-fixed').attr('scroll-active') === "true")
10	// 	$(document).on('scroll', onScroll)
11
12	// BEGIN: Menu toggle
13	$(".hamburger").click(function() {
14		if ($('body').hasClass('navOpen')) {
15			$('body').addClass('navClose');
16			$('body').removeClass('navOpen');
17			$('body').css('position','static');
18			$('#ft_fixed').removeClass('hide');
19			$(".hamburger").removeClass('is-active');
20      $(window).scrollTop(offsetY);
21		} else {
22			$('body').addClass('navOpen');
23			$('body').removeClass('navClose');
24			$("body").removeClass('has_nav');
25			$('#ft_fixed').addClass('hide');
26			$("#pagetop").removeClass("visible");
27			$(".hamburger").addClass('is-active');
28      offsetY = window.pageYOffset;
29      $('body').css({
30        position: 'fixed',
31        width: '100%',
32        'top': -offsetY + 'px'
33      });
34		}
35		return false;
36	});
37	// END: Menu toggle
38
39	$("#menu_toggle a").click(function() {
40		$('body').removeClass('navOpen');
41		$('body').css('position','static');
42		$(window).scrollTop(offsetY);
43		$('#ft_fixed').removeClass('hide');
44		$('.hamburger').removeClass('is-active');
45	});
46
47	$('.nav-fixed a[href^="#"], #menu_toggle a[href^="#"]').on('click', function () {
48		var e = $(this).attr('href');
49		var h = $(window).width() > 767 ? $('.nav-fixed').outerHeight() : 0;
50		var b = $(e).length ? $(e).offset().top : 0;
51		$('html, body').animate({
52			scrollTop: (b + 1 - h)
53		}, 500);
54		//return false;
55	})
56
57  $('.unsmooth').click(function() {
58    if ($('body').hasClass('navOpen')) {
59			$('body').css('position','static');
60      $(window).scrollTop(offsetY);
61      $('body').removeClass('navOpen');
62    } else {
63      offsetY = window.pageYOffset;
64      $('body').css({
65        position: 'fixed',
66        width: '100%',
67        'top': -offsetY + 'px'
68      });
69		}
70  });
71
72	$(document).on('closed', '.remodal', function (e) {
73		$('body').css('position','static');
74    $(window).scrollTop(offsetY);
75	});
76
77	// BEGIN: scroll to top
78	$("body").on("click", "#pagetop", function() {
79		if (!$(this).hasClass("in-scroll")) {
80			$(this).addClass("in-scroll");
81			var $scrollDuration = $.inArray($(this).attr("data-duration"), ["slow", "normal", "fast"]) >= 0 || parseInt($(this).attr("data-duration")) > 0 ? $(this).attr("data-duration") : "slow";
82			$("html, body").stop().animate({
83				scrollTop: 0
84			}, $scrollDuration, function() {
85				$("#pagetop").removeClass("in-scroll");    
86				$("#pagetop").removeClass("visible"); 
87			});
88		}
89	});
90	// END: scroll to top
91
92	if ($('.slider-default').length > 0) {
93		$('.slider-default').not('.slick-initialized').slick({
94			arrows: false,
95			dots: true,
96      fade: true,
97      autoplay: true,
98			pauseOnFocus:false,
99			pauseOnHover: false,
100		});
101	}
102	$('.slider').on('touchstart', function() {
103		$('.slider').slick('slickPlay');
104	});
105});
106
107$(window).load(function(){
108	TargetPos = $('section.nav-target').offset().top || 0;
109})
110
111$(window).scroll(function () {
112	let ScrollPos = $(window).scrollTop();
113	if (ScrollPos > TargetPos) {
114		$("body").addClass('has_nav');
115	} else {
116		$("body").removeClass('has_nav');
117	}
118});
119
120// BEGIN: scroll down hidden pagetop
121var lastScrollTop = 0;
122$(window).scroll(function(){
123	var st = $(this).scrollTop();
124	if (lastScrollTop != 0)	{
125		if (st < lastScrollTop){
126			$("#pagetop").addClass("visible");
127			if(st < 10){
128				$("#pagetop").removeClass("visible");
129			}
130		} 
131		else if (st > lastScrollTop){
132			$("#pagetop").removeClass("visible");
133		}
134	}
135	lastScrollTop = st;
136});
137// END: scroll down hidden pagetop
138
139function onScroll(){
140	let scroll = $(window).scrollTop();
141	let header = $('.nav-fixed').outerHeight() + 2;
142  let element = $(window).width() > 767 ? '.nav-fixed a[href^="#"]' : '#menu_toggle a[href^="#"]';
143	$(element).each(function() {
144		var el = $(this).attr('href')
145		var offset = $(el).length ? $(el).offset().top : 0
146		if($(this).find('img').length){
147			var _src_ = $(this).find('img').attr("src");
148			_src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2");
149			$(this).find('img').attr("src", _src_)
150			$(this).find('img').addClass('btn')
151		}
152		if((scroll + header) >= offset && ($(el).outerHeight() + offset) > (scroll + header)){
153			$('.nav-fixed a[href^="#"]').removeClass('active')
154			$(this).addClass('active')
155			if($(this).find('img').length){
156				//$('.nav-fixed a[href^="#"] img').addClass('btn')
157				$(this).find('img').removeClass('btn')
158
159				$('.nav-fixed a[href^="#"] img').each(function(){
160					var src = $(this).attr('src')
161					var newSrc = src.replace('_on', '')
162					$(this).attr('src', newSrc)
163				})
164
165				$(this).find('img').attr("src").match(/^(.*)(\.{1}.*)/g);
166				var newSrc = RegExp.$1 + "_on" + RegExp.$2;
167
168				$(this).find('img').attr("src", newSrc); // update src
169			}
170		}
171	})
172}
173
174let doc = document.documentElement;
175doc.style.setProperty('--app-height', `${window.innerHeight}px`);
176window.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.