PageSourceSearch

https://www.gotenmori.co.jp/lg_common/js/setting_option.js

js gotenmori.co.jp collected 2026-10-06 01:01:26 UTC 5,660 bytes, 171 lines download raw bytes

1/* --------------------------------------------------------
2	[Setting Option] ※全ページに関わるものだけ記載
3-------------------------------------------------------- */
4$(document).ready(function() {
5	/* 電話番号へのリンク指定
6	   PC     →  「span」で囲む (リンクにしない)
7	   スマホ  →  「class="tel-link"」をつけたリンク
8	-------------------------------------------------------- */
9	if(!navigator.userAgent.match(/(iPhone|iPad|Android)/)){
10		$("a.tel-link").each(function(){
11			$(this).replaceWith('<span class="tel-link">' + $(this).html() + '</span>');
12		});
13	}
14
15
16	/* スムーススクロール
17	-------------------------------------------------------- */
18	$('a[href^="#"]:not(.nosmooth)').click(function(){
19		var speed = 500;
20		var href= $(this).attr("href");
21		var target = $(href == "#" || href == "" ? 'html' : href);
22		var hHeight = '';
23
24		/* ▽ 固定ヘッダーありの場合の処理 ▽ */
25		// // ヘッダー固定が解除されるウィンドウ幅
26		//var hFixSize = window.matchMedia('(max-width: 600px)');
27		// 固定ヘッダーの高さ
28		//if(!hFixSize.matches) {
29			// 固定ヘッダー( #header_wrap の箇所は固定ヘッダーのid名に合わせてください )
30			hHeight = $('#header').outerHeight() ;
31		//}
32		/* △ 固定ヘッダーありの場合の処理 ▽ */
33
34		var position = target.offset().top - hHeight;
35		$("html, body").animate({scrollTop:position}, speed, "swing");
36		return false;
37	});
38
39
40	$('#hd_menu').on('click',function(){
41		$(this).toggleClass('on');
42		$('#gnav').toggleClass('on');
43		$('body').toggleClass('noscroll');
44	});
45
46	$('#gn_close , #main_menu a').on('click',function(){
47		$('#hd_menu').removeClass('on');
48		$('#gnav').removeClass('on');
49		$('body').removeClass('noscroll');
50	});
51
52});
53
54// ページが完全に読み込まれたら実行
55$(window).on('load',function(){
56	/* datepicker
57	-------------------------------------------------------- */
58	
59	/* グローバルナビ途中から上部固定にする
60		※最初から一番上にくっついてる場合はこのjsいらないので消してください。
61	-------------------------------------------------------- */
62	var hnav = $('#header');		// 固定するナビ領域
63	var con = $('#main_img');	// ナビ領域の次の要素(ナビがfixedになった時に位置がずれないように上にpaddingを確保する要素)
64	var hnavTop = $(window).height();
65	function hnavFix() {
66		if($(this).scrollTop() >= hnavTop) {
67			if(!hnav.hasClass('fixed')) {
68				hnav.addClass('fixed');	// fixed クラスを追加
69				hnav.removeClass('top');
70			}
71		} else if(hnav.hasClass('fixed')) {
72			hnav.addClass('top');
73			hnav.removeClass('fixed').css('top','');
74		}
75	}
76	hnavFix();
77
78		//スクロール時の処理
79		$(window).scroll(function () {
80		var winTop = $(this).scrollTop();
81		hnavFix();
82		if(hnav.hasClass('fixed')){
83			//fixedの際に横スクロールする処理
84			hnav.css("left", -$(window).scrollLeft());
85		}
86	});
87
88
89	/* アコーディオンメニュー
90	-------------------------------------------------------- */
91	var accTrigger = $('.acc_tit'),
92			accSpSize = window.matchMedia('(max-width: 600px)');
93	const accChange = function() {
94		accTrigger.each(function() {
95			if($(this).attr('data-size')){
96				if(accSpSize.matches && $(this).attr('data-size') == 'sp') {
97					// 600px以下でアコーディオンにしたい時はこっち
98					$(this).next().addClass('acc_contents').hide();
99					return true;
100				}
101
102				$(this).next().css('display','').removeClass('acc_contents');
103			}
104		});
105	}
106	accSpSize.addListener(accChange);
107	accChange();
108	$('.acc_contents').hide();
109	$('.acc_tit').on("click",function(){
110		var acc = $(this);
111		acc.toggleClass("active").next(".acc_contents").slideToggle(300);
112	});
113
114	/* 別ページから特定ID箇所へ移動するときに固定ヘッダー分位置をずらす
115	 * aタグのリンクを下記のように設定してください。
116	 * <a href="hoge/?id=id名">hogehoge</a>
117	-------------------------------------------------------- */
118	// // urlパラメータの取得
119	var moveArg = new Object;
120	var movePrm = location.search.substring(1).split('&');
121	var moveFlg = false;
122	for(var i=0 ; movePrm[i] ; i++) {
123		var kv = movePrm[i].split('=');
124		moveArg[kv[0]]=kv[1];
125
126		if(kv[0] == 'id') {
127			moveFlg = true;
128		}
129	}
130
131	if( moveFlg ) {
132		var target = $('#' + moveArg['id']);
133		var hHeight = '';
134
135		/* ▽ 固定ヘッダー有りの場合の処理 ▽ */
136		// ヘッダー固定が解除されるウィンドウ幅
137		//var hFixSize = window.matchMedia('(max-width: 600px)');
138		// 固定ヘッダーの高さ
139		//if(!hFixSize.matches) {
140			// 固定ヘッダー( #header_wrap の箇所は固定ヘッダーのid名に合わせてください )
141			hHeight = $('#header').outerHeight();
142		//}
143		/* △ 固定ヘッダー有りの場合の処理 △ */
144
145		var position = target.offset().top - hHeight;
146		$("html, body").animate({scrollTop:position}, 500, "swing");
147	}
148
149
150/* ----- Setting End ----------------------------------- */
151});
152
153
154/* メールアドレス暗号化
155-------------------------------------------------------- */
156function converter(M){
157var str="", str_as="";
158for(var i=0;i<M.length;i++){
159str_as = M.charCodeAt(i);
160str += String.fromCharCode(str_as + 1);
161}
162return str;
163}
164function mail_to(k_1,k_2)
165{eval(String.fromCharCode(108,111,99,97,116,105,111,110,46,104,114,101,102,32,
16661,32,39,109,97,105,108,116,111,58) 
167+ escape(k_1) + 
168converter(String.fromCharCode(120,110,120,96,106,116,63,102,110,115,100,109,108,110,113,104,45,98,110,45,
168105,111,
16962,114,116,97,105,100,98,115,60)) 
170+ escape(k_2) + "'");} 
171

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.