PageSourceSearch

https://www.otsuka-kenpo.or.jp/common/std/js/common.js

js otsuka-kenpo.or.jp collected 2026-10-05 02:45:42 UTC 10,746 bytes, 404 lines download raw bytes

1/**
2 * common.js
3 */
4
5(function($){
6
7/* default_set
8--------------------------------------------------*/
9	var default_set = function() {
10
11		// sp pc judge
12		if( window.ontouchstart === null ){
13			return;
14		} else {
15			$('body').addClass('noT');
16            $('.inSubBtn > a').removeClass('on');
17        }
18
19		// judge
20		var
21			ua = navigator.userAgent.toLowerCase(),
22			ver = navigator.appVersion.toLowerCase(),
23			isIE11 = (ua.indexOf('trident/7') > -1),
24			isMSIE = (ua.indexOf('msie') > -1) && (ua.indexOf('opera') == -1),
25			isEdge = !(ua.indexOf('msie') > -1) && (ua.indexOf('edge') > -1),
26			isIE = isMSIE || isIE11 || isEdge,
27			isChrome = !(ua.indexOf('msie') > -1) && (ua.indexOf('chrome') > -1),
28			isSafari = !(ua.indexOf('msie') > -1) && (ua.indexOf('safari') > -1),
29			isFirefox = !(ua.indexOf('msie') > -1) && (ua.indexOf('firefox') > -1),
30			isiPhone = (ua.indexOf('iphone') > -1),
31			isAndroid = (ua.indexOf('android') > -1) && (ua.indexOf('mobile') > -1);
32
33		if(isIE) {
34			$('body').addClass('IE');
35		}
36		if(isChrome) {
37			$('body').addClass('Chrome');
38		}
39		if(isSafari) {
40			$('body').addClass('Safari');
41		}
42		if(isFirefox) {
43			$('body').addClass('Firefox');
44		}
45		if(isiPhone){
46			$('body').addClass('iphone');
47		}
48		if(isAndroid){
49			$('body').addClass('android');
50		} else {
51			$('body').addClass('android_none');
52		}
53
54		// tel link
55		$('.tel').on('click', function(){
56			if( window.ontouchstart === null ){
57				return;
58			} else {
59				return false;
60			}
61		});
62	}
63
64
65/* spJsReset
66--------------------------------------------------*/
67	var spJsReset = function() {
68		$(window).on('resize', function(){
69			var w = $(window).width();
70			if(w > 940){
71				$('body').removeClass('open');
72				$('#gNav,#sp-close,#overlay').removeAttr('style');
73			}
74		});
75	}
76	
77/* include header images
78--------------------------------------------------*/
79	var includeHeaderImages = function() {
80		$('#header img').each(function(index, el) {
81			var img = $(this).attr('src');
82			$(this).attr('src', directory +img);
83		});
84	}
85
86/* include1
87--------------------------------------------------*/
88	var include1 = function() {
89			if($('#header-include').length){
90				$.ajax({
91					type: 'GET',
92					url: directory + 'common/std/html/header2.html',
93					dataType: 'html',
94					success: function(data) {
95						$('#header-include').append(data);
96						spMenu();
97						fontsize();
98						includeHeaderImages();
99						linksHierarchy('#header-include a');
100						inSubBtn();
101					}
102				});
103			}
104	}
105
106/* smoothscroll
107--------------------------------------------------*/
108	var smoothscroll = function() {
109		$('.smooth').on('click', function(){
110			var speed = 500;
111			var href= $(this).attr('href');
112			var target = $(href == '#' || href == '' ? 'html' : href);
113			var position = target.offset().top;
114			$('html, body').animate({scrollTop:position}, speed, 'swing');
115			return false;
116		});
117	}
118
119/* spMenu
120--------------------------------------------------*/
121	var spMenu = function() {
122		$('#spMenu').on('click', function(){
123			$('body').addClass('open');
124			$('#overlay').fadeIn(400);
125		});
126		$('#sp-close').on('click', function(){
127			$('body').removeClass('open');
128			$('#overlay').fadeOut(400);
129		});
130		$('#overlay').on('click', function(){
131			$('body').removeClass('open');
132			$('#overlay').fadeOut(400);
133		});
134	}
135
136
137/* fontsize
138--------------------------------------------------*/
139	var fontsize = function() {
140		var cookie = $.cookie('fontsize');
141		if(cookie == 'big'){
142			$('html').addClass('big');
143		}
144		$('#fontsize a').on('click', function(){
145			$('#fontsize a').removeClass('on');
146			$(this).addClass('on');
147			if($(this).hasClass('f-big')){
148				$.cookie('fontsize','big',{path:'/'});
149				$('html').addClass('big');
150			} else {
151				$.removeCookie('fontsize',{path:'/'});
152				$('html').removeClass('big');
153			}
154			return false;
155		});
156	}
157
158/* pagetop
159--------------------------------------------------*/
160	var pagetop = function() {
161		$(window).on('scroll', function(){
162			var
163				sc = $(window).scrollTop(),
164				wh = $(window).height(),
165				pos = $('#footer').offset().top;
166			if(sc>100){
167				$('#pagetop').addClass('up');
168			} else {
169				$('#pagetop').removeClass('up');
170			}
171			if(sc+wh>pos){
172				$('#pagetop').addClass('stop');
173			} else {
174				$('#pagetop').removeClass('stop');
175			}
176		});
177	}
178
179/* include footer images
180--------------------------------------------------*/
181	var includeFooterImages = function() {
182		$('#footer img').each(function(index, el) {
183			var img = $(this).attr('src');
184			$(this).attr('src', directory +img);
185		});
186	}
187
188/* linksHierarchy
189--------------------------------------------------*/
190	function linksHierarchy(links) {
191		var links = $(links);
192		links.each(function(index, el) {
193			var
194				href = $(this).attr('href'),
195				linktype = $(this).attr('target');
196			if(!(linktype == '_blank' || $(this).hasClass('smooth'))) {
197				$(this).attr('href', directory+href);
198			}
199		});
200	}
201
202/* inSubBtn
203--------------------------------------------------*/
204	var inSubBtn = function() {
205		$('.inSubBtn').hoverIntent(function() {
206			var ww = $(window).width();
207			if(ww>940){
208				$(this).stop(false, true).toggleClass('nav_open');
209                $('body').toggleClass('nav_overlay');
210                return false;
211			}
212		});
213    
214    /* hover action fade */
215		/*$('.inSubBtn').hover(function() {
216			var ww = $(window).width();
217			if(ww>940){
218				$('.inSubMenu',this).stop(true).fadeIn();
219                $('body').toggleClass('nav_overlay');
220			}
221		}, function() {
222			var ww = $(window).width();
223			if(ww>940){
224				$('.inSubMenu',this).fadeOut();
225                $('body').toggleClass('nav_overlay');
226                return false;
227			}
228		});
229    }*/
230        
231    /* click action*/
232		$('.inSubBtn > a').on('click', function(){
233        var ww = $(window).width();
234			if(ww<940){
235			$('.inSubBtn > a').not(this).removeClass('on');
236			$('.inSubBtn > a').not(this).next().slideUp(200);
237            $(this).toggleClass('on');
238			$(this).closest('.inSubBtn').find('.inSubMenu').slideToggle(200);
239			return false;
240            }
241		});
242    }
243
244
245/* include
246--------------------------------------------------*/
247	var include = function() {
248			if($('#footer-include').length){
249				$.ajax({
250					type: 'GET',
251					url: directory + 'common/std/html/footer.html',
252					dataType: 'html',
253					success: function(data) {
254						$('#footer-include').append(data);
255						includeFooterImages();
256						pagetop();
257						smoothscroll();
258						linksHierarchy('#footer-include a');
259					}
260				});
261			}
262			if($('#search-side-include').length){
263			$.ajax({
264				type: 'GET',
265				url: directory + 'common/std/html/search_sidemenu.html',
266				dataType: 'html',
267				success: function(data) {
268					$('#search-side-include').append(data);
269					linksHierarchy('#search-side-include a');
270				}
271			});
272			}else if($('#fabric-side-include').length){
273				$.ajax({
274					type: 'GET',
275					url: directory + 'common/std/html/fabric_sidemenu.html',
276					dataType: 'html',
277					success: function(data) {
278						$('#fabric-side-include').append(data);
279						linksHierarchy('#fabric-side-include a');
280					}
281				});
282			}else if($('#health-side-include').length){
283				$.ajax({
284					type: 'GET',
285					url: directory + 'common/std/html/health_sidemenu.html',
286					dataType: 'html',
287					success: function(data) {
288						$('#health-side-include').append(data);
289						linksHierarchy('#health-side-include a');
290					}
291				});
292			}else if($('#benefit-side-include').length){
293				$.ajax({
294					type: 'GET',
295					url: directory + 'common/std/html/benefit_sidemenu.html',
296					dataType: 'html',
297					success: function(data) {
298						$('#benefit-side-include').append(data);
299						linksHierarchy('#benefit-side-include a');
300					}
301				});
302			}else if($('#application-side-include').length){
303				$.ajax({
304					type: 'GET',
305					url: directory + 'common/std/html/application_sidemenu.html',
306					dataType: 'html',
307					success: function(data) {
308						$('#application-side-include').append(data);
309						linksHierarchy('#application-side-include a');
310					}
311				});
312			}else if($('#checkup-side-include').length){
313				$.ajax({
314					type: 'GET',
315					url: directory + 'common/std/html/checkup_sidemenu.html',
316					dataType: 'html',
317					success: function(data) {
318						$('#checkup-side-include').append(data);
319						linksHierarchy('#checkup-side-include a');
320					}
321				});
322			}else if($('#wellness-side-include').length){
323				$.ajax({
324					type: 'GET',
325					url: directory + 'common/std/html/wellness_sidemenu.html',
326					dataType: 'html',
327					success: function(data) {
328						$('#wellness-side-include').append(data);
329						linksHierarchy('#wellness-side-include a');
330					}
331				});
332			}else if($('#resort-side-include').length){
333				$.ajax({
334					type: 'GET',
335					url: directory + 'common/std/html/resort_sidemenu.html',
336					dataType: 'html',
337					success: function(data) {
338						$('#resort-side-include').append(data);
339						linksHierarchy('#resort-side-include a');
340					}
341				});
342			}else if($('#union-side-include').length){
343				$.ajax({
344					type: 'GET',
345					url: directory + 'common/std/html/union_sidemenu.html',
346					dataType: 'html',
347					success: function(data) {
348						$('#union-side-include').append(data);
349						linksHierarchy('#union-side-include a');
350					}
351				});
352			}else if($('#contents-side-include').length){
353				$.ajax({
354					type: 'GET',
355					url: directory + 'common/std/html/contents_sidemenu.html',
356					dataType: 'html',
357					success: function(data) {
358						$('#contents-side-include').append(data);
359						linksHierarchy('#contents-side-include a');
360					}
361				});
362			}else if($('#rizap-side-include').length){
363				$.ajax({
364					type: 'GET',
365					url: directory + 'common/std/html/rizap_sidemenu.html',
366					dataType: 'html',
367					success: function(data) {
368						$('#rizap-side-include').append(data);
369						linksHierarchy('#rizap-side-include a');
370					}
371				});
372				}
373	}
374
375/* dom ready
376--------------------------------------------------*/
377	$(function(){
378
379		if($('.dir-2').length){
380			directory = '../';
381		} else if($('.dir-3').length) {
382			directory = '../../';
383		} else if($('.dir-4').length) {
384			directory = '../../../';
385		} else {
386			directory = '';
387		}
388
389		default_set();
390		spJsReset();
391		include1();
392		spMenu();
393		smoothscroll();
394		include();
395	});
396
397})(jQuery);
398
399$(function () {
400$('.togglemenu').hide();
401$('#title').on('click', function(){
402$('.togglemenu').slideToggle();
403});
404});

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.