PageSourceSearch

https://hirosophy.com/_assets/js/app.js?ver=0.01

js hirosophy.com collected 2026-10-06 23:57:55 UTC 16,201 bytes, 519 lines download raw bytes

1/*
2  ver : 6.2.4
3  data: 2020.10.15
4  memo: 1015 | fnFixedFooter 改修 / height() → innerHeight() に変更
5  memo: 0515 | js-Show load へ変更
6  memo: 0421 | Url Setting load へ変更 / isDrawer 追加
7  memo: 0409 | js-Accordion / js-Drawer 改修
8  memo: 0228 | js-iziModal 更新
9  memo: 0203 | js-Active
10  memo: 1223 | fnFixedFooter 追加
11*/
12"use strict";
13(function($){
14	var windowWidth   = window.innerWidth;
15	var windowHeight  = window.innerHeight;
16	var headerHeight = 0;
17	var navHeight = 0;
18	var mainHeight = 0;
19	var footerHeight = 0;
20
21	var windowScroll;
22	var scrollPosition = 0;
23
24	var showCnt;
25	var	showSecElem = [];
26	var	showSecTop  = [];
27
28	var isDrawer = true;
29
30	// CSS
31	var cssSwitchTab         = '.js-Switch-Tab';
32	var cssSwitchTabItem     = '.js-Switch-Tab > *';
33	var cssSwitchSelect      = '.js-Switch-Select';
34	var cssSwitchSelectTitle = '.js-Switch-Select > *:nth-child(1)';
35	var cssSwitchSelectItem  = '.js-Switch-Select > *:nth-child(2)';
36	var cssSwitchSelectValue = '.js-Switch-Select > *:nth-child(2) > *';
37	var cssSwitchCont        = '.js-Switch-Cont > *';
38
39	// - Function - //
40	///// Local /////
41
42	///// Common /////
43	var fnFixedHeader = function(){
44		if ($('#js-Header').css('position') == 'fixed'){
45			if ($('#js-Header').length && $('#js-Header').css('display') != 'none'){
46				headerHeight = $('#js-Header').innerHeight();
47			}
48			if ($('#js-Nav').length && $('#js-Nav').css('display') != 'none'){
49				navHeight = $('#js-Nav').innerHeight();
50				$('#js-Nav').css('position', 'fixed');
51				$('#js-Nav').css('top', headerHeight);
52//				$('.p-drop-2nd').css('top', navHeight);
53			}
54			$('.l-main').css('padding-top', headerHeight + navHeight);
55		} else {
56			if ($('#js-Nav').length && $('#js-Nav').css('display') != 'none'){
57				navHeight = $('#js-Nav').innerHeight();
58//				$('.p-drop-2nd').css('top', navHeight);
59			}
60			$('.l-main').css('padding-top', 0);
61		}
62	}
63
64	var fnFixedFooter = function(){
65		headerHeight = $('#js-Header').innerHeight();
66		footerHeight = $('#js-Footer').innerHeight();
67		$('.l-main').css('min-height', (windowHeight - headerHeight - navHeight - footerHeight));
68	}
69
70	var fnSwitch = function(id, n, h){
71		var switchItemCnt = $(id + ' ' + cssSwitchTabItem).length - 1;
72		if (n < 0 || n > switchItemCnt) {n = 0;}
73		var switchTabLength    = $(id + ' ' + cssSwitchTab).length;
74		var switchSelectLength = $(id + ' ' + cssSwitchSelect).length;
75		var $switchTab         = $(id + ' ' + cssSwitchTabItem);
76		var $switchSelect      = $(id + ' ' + cssSwitchSelect);
77		var $switchSelectTitle = $(id + ' ' + cssSwitchSelectTitle);
78		var $switchSelectItem  = $(id + ' ' + cssSwitchSelectItem);
79		var $switchSelectValue = $(id + ' ' + cssSwitchSelectValue);
80		var $switchCont        = $(id + ' ' + cssSwitchCont);
81		$switchCont.addClass('u-dpN').removeClass('is-active');
82		$switchCont.eq(n).addClass('is-active').removeClass('u-dpN');
83		if (switchTabLength) {
84			$switchTab.removeClass('is-active');
85			$switchTab.eq(n).addClass('is-active');
86		}
87		if (switchSelectLength) {
88			$switchSelectValue.removeClass('is-active');
89			$switchSelectValue.eq(n).addClass('is-active');
90			$switchSelectTitle.html('<span>' + $switchSelectValue.eq(n).text() + '</span>');
91			$switchSelect.removeClass('is-active');
92			$switchSelectItem.css('height', '');
93		}
94		// Slick Slider
95		if ($switchCont.eq(n).find('[data-slick]').length) {
96			$switchCont.eq(n).css('height', h);
97			$switchCont.eq(n).find('[data-slick]').each(function(){
98				$(this).slick('setPosition');
99			});
100			$switchCont.eq(n).css('height', 'auto');
101		}
102	}
103
104	var fnSmoothLink = function(id){
105		if($('html').hasClass('is-drawer')){
106			$('html').removeClass('is-drawer');
107		}
108//		var movePosition = $(id).offset().top - headerHeight - navHeight;
109		var movePosition = $(id).offset().top;
110		$('html,body').animate({scrollTop:movePosition}, 400, 'swing');
111		return false;
112	}
113
114	var fnAcdHeight = function(mode){
115		if ($('.js-Accordion').length){
116			$('.js-Accordion').each(function(index, element){
117				var acdId = '#' + $(element).data('acd-id');
118				var acdInvalid = $(element).data('acd-invalid');
119				var fnAcdHeightResize = function() {
120					if ($(element).hasClass('is-active')) {
121						$(acdId).css('height', 'auto');
122						$(acdId).css('height', $(acdId).get(0).scrollHeight);
123					} else {
124						$(acdId).css('height', 0);
125					}
126				}
127				// Accordion Off
128				// acdInvalid -> 1:PC | 2:TAB | 3:SP | 4:PC TAB | 5:PC SP | 6:TAB SP
129				switch (acdInvalid) {
130					case 1:
131						if (windowWidth > 768) {$(acdId).css('height', 'auto');} else {fnAcdHeightResize();}
132						break;
133					case 2:
134						if (windowWidth > 480 && windowWidth <= 768) {$(acdId).css('height', 'auto');} else {fnAcdHeightResize();}
135						break;
136					case 3:
137						if (windowWidth <= 480) {$(acdId).css('height', 'auto');} else {fnAcdHeightResize();}
138						break;
139					case 4:
140						if (windowWidth > 480) {$(acdId).css('height', 'auto');} else {fnAcdHeightResize();}
141						break;
142					case 5:
143						if (windowWidth <= 480 || windowWidth > 768) {$(acdId).css('height', 'auto');} else {fnAcdHeightResize();}
144						break;
145					case 6:
146						if (windowWidth <= 768) {$(acdId).css('height', 'auto');} else {fnAcdHeightResize();}
147						break;
148					default:
149						fnAcdHeightResize();
150						break;
151				}
152				$(acdId).attr('data-acd-height', $(acdId).get(0).scrollHeight);
153			});
154		}
155	}
156
157	// - Ready - //
158	$(document).ready(function(){
159		///// Local /////
160		///// Common /////
161
162
163		// Accordion - Seting
164		fnAcdHeight('ready');
165
166		// ScrollTop
167//		$('html,body').animate({ scrollTop: 0 }, '1');
168
169	});
170
171	// - Load - //
172	$(window).on('load', function(){
173		///// Local /////
174		///// Common /////
175		fnFixedHeader();
176		fnFixedFooter();
177
178		// Show - Seting
179		if ($('.js-Show').length){
180			showCnt = $('.js-Show').length;
181			$('.js-Show').each(function(index, element){
182				$(element).addClass('js-Show-' + index);
183				$(element).removeClass('js-Show');
184				showSecElem.push('js-Show-' + index);
185				showSecTop.push($('.' + showSecElem[index]).offset().top);
186			});
187		}
188
189		// Url - Setting
190		var urlParam = location.search.substring(1);
191		if (urlParam) {
192			var param = urlParam.split('&');
193			var paramAry = [];
194			for (var i = 0; i < param.length; i++) {
195				var paramItem = param[i].split('=');
196				paramAry[paramItem[0]] = paramItem[1];
197			}
198			// Switch (ex. -> switchId={{ SelectorID }}&switchNum={{ NUM }})
199			if (paramAry.switchId) {
200				var switchId  = '#' + paramAry.switchId;
201				var switchNum = parseInt(paramAry.switchNum) - 1;
202				fnSwitch(switchId, switchNum);
203			}
204			// Link (ex. -> linkId={{ SelectorID }})
205			if (paramAry.linkId) {
206				var linkId  = '#' + paramAry.linkId;
207				fnSmoothLink(linkId);
208			}
209		}
210
211		// Loading
212		$('#js-Loader').addClass('is-off');
213		setTimeout(function(){
214			$('body').removeClass('is-loading');
215			$('.is-show').removeClass('is-show');
216		}, 1000);
217	});
218
219	// -  Scroll - //
220	$(window).on('scroll', function(){
221		windowScroll = $(window).scrollTop();
222		///// Local /////
223		///// Common /////
224		// ToTop - Display or Hidden
225		if ($('#js-To-Top').length) {
226			if (windowScroll > 100){
227				$('#js-To-Top').fadeIn('slow');
228			} else {
229				$('#js-To-Top').fadeOut('slow');
230			}
231		}
232		// Nav - Display or Hidden
233		if ($('#js-Header').css('position') == 'fixed' && $('#js-Nav').length && $('#js-Nav').css('display') != 'none' ) {
234			if (windowScroll > scrollPosition){
235				$('#js-Nav').addClass('is-off');
236			} else if (windowScroll < scrollPosition){
237				$('#js-Nav').removeClass('is-off');
238			}
239			scrollPosition = windowScroll;
240		}
241		// Show - Display
242		if (showCnt) {
243			for (var i = 0; i<showCnt; i++) {
244				if (!$('.' + showSecElem[i]).hasClass('is-show')) {
245					if (windowScroll > showSecTop[i] - windowHeight + windowHeight/3) {$('.' + showSecElem[i]).addClass('is-show');}
246				}
247			}
248		}
249	});
250
251	// - Resize - //
252	$(window).on('resize', function(){
253		windowWidth  = window.innerWidth;
254		windowHeight = window.innerHeight;
255		///// Local /////
256		// drawer - Hidden
257		if (windowWidth > 768 && $('html').hasClass('is-drawer')) {
258			var drawerTop = $('.l-body').data('drawer-top');
259			$('.l-body').css('position', 'static');
260			$('html,body').scrollTop(drawerTop);
261			$('html').removeClass('is-drawer');
262		}
263
264		///// Common /////
265		fnFixedHeader();
266		fnFixedFooter();
267
268		// Accordion - Seting
269		fnAcdHeight('resize');
270	});
271
272	// - Action - //
273	// Click:Switch -> Tab
274	$(document).on('click', cssSwitchTabItem, function(){
275		var switchId     = '#' + $(this).data('switch-id');
276		var switchNum    = $(switchId + ' ' + cssSwitchTabItem).index(this);
277		var switchHeight = $(switchId + ' ' + cssSwitchCont + '.is-active').innerHeight();
278		fnSwitch(switchId, switchNum, switchHeight);
279	});
280	// Click:Switch -> Select -> Item
281	$(document).on('click', cssSwitchSelectValue, function(){
282		var switchId     = '#' + $(this).data('switch-id');
283		var switchNum    = $(switchId + ' ' + cssSwitchSelectValue).index(this);
284		var switchHeight = $(switchId + ' ' + cssSwitchCont + '.is-active').innerHeight();
285		fnSwitch(switchId, switchNum, switchHeight);
286	});
287	// Click:Switch -> Select -> Title
288	$(document).on('click', cssSwitchSelectTitle, function(){
289		if ($(this).parent().hasClass('is-active')) {
290			$(this).parent().removeClass('is-active');
291			$(this).next().css('height', '');
292		} else {
293			$(this).parent().addClass('is-active');
294			$(this).next().css('height', $(this).next().get(0).scrollHeight);
295		}
296	});
297	// Click:SmoothLink
298	/*
299		data-link-id="" :#idName
300	*/
301	$(document).on('click', '.js-Smooth-Link', function(){
302		var linkId = '#' + $(this).data('link-id');
303		fnSmoothLink(linkId);
304	});
305	// Click:ToTopLink
306	$(document).on('click', '#js-To-Top', function(){
307		$('html,body').animate({scrollTop:0}, 'slow');
308		return false;
309	});
310	// Click:Drawer
311	$(document).on('click', '.js-Drawer', function(e){
312		if (isDrawer) {
313			isDrawer = false;
314			headerHeight = $('#js-Header').innerHeight();
315			if($('html').hasClass('is-drawer')){
316				var drawerTop = $('.l-body').data('drawer-top');
317				$('.l-body').css('position', 'static');
318				$('html,body').scrollTop(drawerTop);
319				$('html').removeClass('is-drawer');
320				setTimeout(function(){
321					isDrawer = true;
322				}, 500);
323			} else {
324				windowScroll = $(window).scrollTop();
325				var dammy = windowScroll - 10;
326				$('html').addClass('is-drawer');
327				if ($('#js-Header').css('position') == 'fixed') {
328					$('.l-drawer').css('top', headerHeight);
329					$('.l-drawer').css('height', windowHeight - headerHeight);
330				} else {
331					$('.l-drawer').css('top', '0');
332					$('.l-drawer').css('height', '100vh');
333/*
334					$('.l-drawer').css('top', headerHeight);
335					$('.l-drawer').css('height', windowHeight - headerHeight);
336*/
337				}
338				setTimeout(function(){
339					if (windowWidth > 768) {
340						$('.l-body').css('position', 'static');
341					} else {
342						$('.l-body').css('position', 'fixed');
343					}
344					$('.l-body').css('top', - windowScroll);
345					$('.l-body').data('drawer-top', windowScroll);
346					isDrawer = true;
347				}, 500);
348			}
349		}
350	});
351	$(document).on('click', '.js-Drawer-Close', function(){
352		if (isDrawer) {
353			isDrawer = false;
354			if($('html').hasClass('is-drawer')){
355				var drawerTop = $('.l-body').data('drawer-top');
356				$('.l-body').css('position', 'static');
357				$('html,body').scrollTop(drawerTop);
358				$('html').removeClass('is-drawer');
359				setTimeout(function(){
360					isDrawer = true;
361				}, 500);
362			}
363		}
364	});
365	// Click:Accordion
366	/*
367		data-acd-id 		:#idName
368		data-acd-group 		:
369		data-acd-invalid	:
370	*/
371	$(document).on('click', '.js-Accordion', function(){
372		var dataId    = $(this).data('acd-id');
373		var dataGroup = $(this).data('acd-group');
374		var acdId     = '#' + dataId;
375		var acdHeight = $(acdId).attr('data-acd-height');
376		var acdParent = $(acdId).parents('.c-acd-cont');
377		if ($(this).hasClass('is-active')) {
378			if (acdParent.length) {
379				acdParent.each(function(index, element){
380					var parentH = parseInt($(element).attr('data-acd-height'));
381					$(element).attr('data-acd-height', parentH - parseInt(acdHeight));
382					$(element).css('height', parentH - parseInt(acdHeight));
383				});
384			}
385			$(this).removeClass('is-active');
386			$(acdId).css('height', 0);
387		} else {
388			if (typeof dataGroup !== 'undefined' && dataGroup != ''){
389				$('[data-acd-group=' + dataGroup + ']').removeClass('is-active');
390				$('[data-acd-group=' + dataGroup + ']').next().css('height', 0);
391			}
392			if (acdParent.length) {
393				acdParent.each(function(index, element){
394					var parentH = parseInt($(element).attr('data-acd-height'));
395					$(element).attr('data-acd-height', parentH + parseInt(acdHeight));
396					$(element).css('height', parentH + parseInt(acdHeight));
397				});
398			}
399			$(this).addClass('is-active');
400			$(acdId).css('height', acdHeight);
401		}
402	});
403	// Click:Common -> Active
404	/*
405		data-active-id="" :#idName
406		data-active-group="" :.className
407	*/
408	$(document).on('click', '.js-Active', function(){
409		var dataId    = $(this).data('active-id');
410		var dataGroup = $(this).data('active-group');
411		var activeId    = '#' + dataId;
412		if ($(this).hasClass('is-active')) {
413			$(activeId).removeClass('is-active');
414			if (typeof dataGroup !== 'undefined' && dataGroup != ''){
415				$('[data-active-group=' + dataGroup + ']').removeClass('is-active');
416			}
417			$(this).removeClass('is-active');
418		} else {
419			$(activeId).addClass('is-active');
420			if (typeof dataGroup !== 'undefined' && dataGroup != ''){
421				$('[data-active-group=' + dataGroup + ']').addClass('is-active');
422			}
423			$(this).addClass('is-active');
424		}
425	});
426	// Click:Slider -> Btn
427	$(document).on('click', '.js-Slider-Btn', function(){});
428
429
430	// JS:Slick
431	/*
432		data-slick :slick init
433		data-slick-dots=""   :int  1:true | null or 0:false
434		data-slick-arrows="" :int  1:true | null or 0:false
435		data-slick-show-pc="" :int  defult -> 1
436		data-slick-show-tb="" :int  defult -> 1
437		data-slick-show-sp="" :int  defult -> 1
438	*/
439	if ($('[data-slick]').length) {
440		$('[data-slick]').each(function(){
441			var slickDots   = $(this).data('slick-dots') || 1;
442			var slickArrows = $(this).data('slick-arrows') || 1;
443			var slickAuto   = $(this).data('slick-auto') || 0;
444			var slickShowPc = $(this).data('slick-show-pc') || 1;
445			var slickShowTb = $(this).data('slick-show-tb') || 1;
446			var slickShowSp = $(this).data('slick-show-sp') || 1;
447			$(this).not('.slick-initialize') && $(this).slick({
448				adaptiveHeight: true,
449				autoplay: slickAuto,
450				autoplaySpeed: 4000,
451				arrows: true,
452				dots: true,
453				infinite: true,
454				slidesToShow: slickShowPc,
455				slidesToScroll: slickShowPc,
456				responsive: [
457				{
458					breakpoint: 769,
459					settings: {
460						slidesToShow: slickShowTb,
461						slidesToScroll: slickShowTb
462					}
463				},
464				{
465					breakpoint: 481,
466					settings: {
467						slidesToShow: slickShowSp,
468						slidesToScroll: slickShowSp
469					}
470				}
471				]
472			});
473		});
474	}
475
476	// JS:iziModal
477	$(document).on('click', '.js-iziModal-Open', function(event){
478		event.preventDefault();
479		var dataId = $(this).data('modal-id');
480		var modalId = '#' + dataId + '.js-iziModal';
481
482		$(modalId + ' .p-modal-cont').animate({ scrollTop: 0 }, '1');
483
484		windowScroll = $(window).scrollTop();
485		$('html').addClass('is-modal');
486		$('.l-body').css('position', 'fixed');
487		$('.l-body').css('top', - windowScroll);
488		$('.l-body').data('drawer-top', windowScroll);
489
490		$(modalId).iziModal('open', {transitionIn: 'fadeInDown'});
491	});
492	$(document).on('click', '.js-iziModal-Close', function(event){
493		event.preventDefault();
494		var dataId = $(this).data('modal-id');
495		var modalId = '#' + dataId + '.js-iziModal';
496
497		var drawerTop = $('.l-body').data('drawer-top');
498		$('.l-body').css('position', 'static');
499		$('html,body').scrollTop(drawerTop);
500		$('html').removeClass('is-modal');
501
502		$(modalId).iziModal('close');
503	});
504	$(document).on('click', '.js-iziModal-Prev', function(event){
505		event.preventDefault();
506		var dataId = $(this).data('modal-id');
507		var modalId = '#' + dataId + '.js-iziModal';
508
509		$(modalId).iziModal('prev');
510	});
511	$(document).on('click', '.js-iziModal-Next', function(event){
512		event.preventDefault();
513		var dataId = $(this).data('modal-id');
514		var modalId = '#' + dataId + '.js-iziModal';
515
516		$(modalId).iziModal('next');
517	});
518
519})(jQuery);

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.