PageSourceSearch

https://www.shinetsu.co.jp/wp-content/themes/shinetsu-renewal/js/common.js

js shinetsu.co.jp collected 2026-10-02 06:53:10 UTC 5,200 bytes, 160 lines download raw bytes

1$(function(){
2	$('a[href*=\\#]:not([href=\\#]):not(.tabs-page .tab-item a)').on('click',function() {
3	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
4			var $target = $(this.hash);
5			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
6			if ($target.length) {
7				if($(this).parents('.menuBox').length){
8					setTimeout(function(){
9						var targetOffset = $target.offset().top - $('#gHeader').innerHeight();
10						$('html,body').animate({scrollTop: targetOffset}, 1000);
11					},100);
12				}else{
13					var targetOffset = $target.offset().top- $('#gHeader').innerHeight();
14					$('html,body').animate({scrollTop: targetOffset}, 1000);
15				}
16				return false;
17			}
18		}
19	});
20
21	var state = false;
22	var scrollpos;
23
24	$('.menu').on('click', function(){
25		if(state == false) {
26			scrollpos = $(window).scrollTop();
27			$('body').addClass('fixed').css({'top': -scrollpos});
28			$(this).addClass('active');
29			$('.menuBox').stop().fadeToggle();
30			state = true;
31		}else{
32			$('body').removeClass('fixed').css({'top': 0});
33			window.scrollTo( 0 , scrollpos );
34			$(this).removeClass('active');
35			$('.menuBox').stop().fadeToggle();
36			state = false;
37		}
38		return false;
39	});
40
41	$('.search-toggle').on('click', function () {
42		var $overlay = $('#searchOverlay');
43		var isOpen = $overlay.is(':visible');
44		if (isOpen) {
45			$overlay.stop().slideUp(300);
46			if (window.innerWidth >= 769) {
47				$('main').stop().animate({ 'margin-top': '0px' }, 300);
48			}
49			$(this).attr('aria-expanded', 'false');
50		} else {
51			if (state && window.innerWidth >= 769) {
52				$('body').removeClass('fixed').css({'top': 0});
53				window.scrollTo(0, scrollpos);
54				$('.menu').removeClass('active');
55				$('.menuBox').stop().hide();
56				state = false;
57			}
58			var headerH = $('#gHeader').outerHeight();
59			$overlay.css('top', headerH + 'px');
60			if (window.innerWidth >= 769) {
61				$overlay.css({ display: 'block', visibility: 'hidden', height: 'auto' });
62				var overlayH = $overlay.outerHeight();
63				$overlay.css({ display: 'none', visibility: '', height: '' });
64				var gap = 16;
65				$('main').stop().animate({ 'margin-top': (overlayH + gap) + 'px' }, 300);
66			}
67			$overlay.stop().slideDown(300, function () {
68				$overlay.find('.mf-search-bar_input').focus();
69			});
70			$(this).attr('aria-expanded', 'true');
71		}
72		return false;
73	});
74
75	$('.search-overlay-close').on('click', function () {
76		$('#searchOverlay').stop().slideUp(300);
77		if (window.innerWidth >= 769) {
78			$('main').stop().animate({ 'margin-top': '0px' }, 300);
79		}
80		$('.search-toggle').attr('aria-expanded', 'false');
81		return false;
82	});
83
84	var overlay = document.getElementById('searchOverlay');
85	if (overlay) {
86		function doSearchRedirect(query) {
87			if (query) {
88				var lang = document.documentElement.lang === 'ja' ? 'jp' : 'en';
89				window.location.href = '/' + lang + '/search/searchresult.php?q=' + encodeURIComponent(query);
90			}
91		}
92
93		overlay.addEventListener('click', function (e) {
94			if (e.target.closest('.mf-search-bar_button')) {
95				e.preventDefault();
96				e.stopPropagation();
97				e.stopImmediatePropagation();
98				var input = overlay.querySelector('.mf-search-bar_input');
99				if (input) doSearchRedirect(input.value);
100			}
101		}, true);
102
103		overlay.addEventListener('keydown', function (e) {
104			if (e.key === 'Enter' && e.target.closest('.mf-search-bar_input')) {
105				e.preventDefault();
106				e.stopPropagation();
107				e.stopImmediatePropagation();
108				doSearchRedirect(e.target.value);
109			}
110		}, true);
111	}
112
113	if(window.innerWidth < 769){
114		$("#gFooter .fNavi li:has(ul) .comLink02 a").on('click', function(){
115			$(this).toggleClass("on");
116			$(this).parents().next(".linkUl").stop().slideToggle(300);
117			return false;
118		});
119
120		$(".menuBox .naviUl li:has(ul) .comLink02 a").on('click', function(){
121			$(this).toggleClass("on");
122			$(this).parents().next(".linkUl").stop().slideToggle(300);
123			return false;
124		});
125
126		$(".comTypeBox .typeTxt").on('click', function(){
127            if(!$(this).parents('.bigTab').length){
128                $(this).toggleClass("on");
129                $(this).next(".comSideUl").stop().slideToggle(300);
130                return false;
131            }
132        });
133	}
134});
135
136$(window).on('load',function(){
137	var localLink = window.location+'';
138	if(localLink.indexOf("#") != -1 && localLink.slice(-1) != '#'){
139		localLink = localLink.slice(localLink.indexOf("#")+1);
140		if($('#'+localLink).length){
141			setTimeout(function(){
142				$('html,body').animate({scrollTop: $('#'+localLink).offset().top- $('#gHeader').innerHeight()}, 500);
143			},100);
144		}
145	}
146
147	var overlay = document.getElementById('searchOverlay');
148	if (overlay) {
149		overlay.style.display = 'none';
150		var observer = new MutationObserver(function () {
151			var mfInput = overlay.querySelector('.mf-search-bar_input');
152			if (mfInput) {
153				mfInput.value = '';
154				observer.disconnect();
155			}
156		});
157		observer.observe(overlay, { childList: true, subtree: true });
158		setTimeout(function () { observer.disconnect(); }, 10000);
159	}
160});

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.