PageSourceSearch

https://www.n-land.co.jp/lib/js/jquery/common_gimmick.js

js n-land.co.jp collected 2026-10-05 07:00:00 UTC 12,294 bytes, 416 lines download raw bytes

1/* 
2/ ================================================================ 
3/	Copyright(C) E-LIFE CO.,LTD. ALL Right Reserved. 
4/	http://www.e-life.jp/
5/
6/	2014.07.01 初期作成
7/	※要jquery.js
8/
9/	2023.12.13 スマートフォン版との機能の差異を見直す
10/	2023.12.12 InpageLinkを修正(parallax_base.jsへの対応)
11/	2021.07.13 function radioToggleCkeck を修正
12/	2021.06.21 function radioToggleCkeck を追加
13/	2021.06.14 function BlockLink(){}を修正
14/	2019.10.24 getIncludeSourceを追加
15/	2019.01.29 adj_scroll()実装
16/	2017.10.02 InpageLinkを修正
17/	2015.07.31 管理動作をユニバーサル対応
18/	2015.07.17 GetScriptParams()実装
19/	2015.07.17 管理タグ変更
20/	2014.10.17 function BlockLink(){}を修正
21/	2014.12.08 function FlatHeightSet{}を追加
22/	2015.03.02 リリース開始
23/
24/ ================================================================ 
25 */
26
27	// Elscript管理設定
28	var filenameElJs	= 'common_gimmick.js';
29	var updatedElJs	=  '20231213';
30	$(function(){
31		ToggleContent();
32		EvenOdd();
33		Matrix();
34		ToolTip();
35		HideSeekBtn();
36		InpageLink();
37		BlockLink();
38		FlatHeightSet();
39		setTopicPath();
40		adj_scroll();
41	});
42
43
44/*====================
45function ToggleContent(){}
46コンテンツの開閉
47==========*/
48function ToggleContent(){
49	if($(".toggle")!=null){
50		$(".toggle_sw").click(function(){
51			$toggleTime = 500;
52			$(this).parent(".toggle").find(".toggle_content").toggle($toggleTime);
53		});
54	}
55}
56
57/*====================
58function EvenOdd(){
59tableの奇数/偶数行の色わけ
60※IE9以降の対応はcss3で対応可能!!
61==========*/
62function EvenOdd(){
63	if($(".even_odd")!=null){
64		$(".even_odd tr:nth-child(odd)").addClass('odd');
65		$(".even_odd tr:nth-child(even)").addClass('even');		
66	}else{
67		return false;
68	}
69}
70
71/*====================
72function matrix(){
73tableのマトリックス表示
74==========*/
75function Matrix(){
76	if($(".matrix")!=null){
77		$('.matrix td').hover(
78			function(){
79				$(this).parent().addClass("over");
80				var currentNum = $(this).index();
81				$('tr',$(this).parent().parent()).each(function(i){
82					$('td',this).eq(currentNum-1).addClass('over');
83				});
84			},
85			function(){
86				$(this).parent().removeClass('over');
87				var currentNum = $(this).index();
88				$('tr',$(this).parent().parent()).each(function(i){
89					$('td',this).eq(currentNum-1).removeClass('over');
90				});
91			}
92		);
93		
94		/*=====
95		マトリックス表示内のクリック動作
96		==========*/
97		$(".matrix td a.clk_fix").click(function () {
98			// 一度全てのaタグから"selected"を削除
99			$(".matrix td a").removeClass('selected');	
100			// 削除後クリックしたaタグに"selected"を付与
101			$(this).addClass('selected');
102		});
103	}
104}
105
106/*====================
107function ToolTip(){}
108ツールチップ表示
109==========*/
110function ToolTip(){
111	$tooltip_speed = 250;
112	if($(".tooltip")!=null){
113		$(".tooltip").hover(function() {
114			//$(this).find(".tooltip_content").not(":animated").animate({opacity: "hide", top: ($tooltip_locate -10) }, $tooltip_speed/2);
115			//$(this).find(".tooltip_content").css("display","block");
116			//$tooltip_parent_h = 0;//$(this).outerHeight();
117			$tooltip_locate = -1 * ($(this).find(".tooltip_content").outerHeight());
118			//$tooltip_locate = -1 * ($tooltip_parent_h + $tooltip_h);
119		
120			$(".tooltip_content").not(":animated").css({opacity: "hide",top: ($tooltip_locate - 5)});
121			$(this).find(".tooltip_content").not(":animated").animate({opacity: "show", top: $tooltip_locate}, $tooltip_speed);
122		},
123			function () {
124				$(".tooltip_content").fadeOut($tooltip_speed/4);
125			}
126		);
127	}
128}
129
130/*====================
131function HideSeekBtn(){
132ページ下部のトップへ戻るボタン	
133ウィンドウ高さを超えたらボタンを表示	
134==========*/
135function HideSeekBtn(){
136	// ".re_top"存在確認後に動作
137	if($(".re_top")!=null){
138		// ウィンドウの高さを取得
139		$windowHeight = $(window).height();
140		// ウィンドウがリサイズした場合サイズを再取得
141		$(window).resize(function(){
142			$windowHeight = $(window).height();
143		});
144		// fadeIn/Outの時間設定
145		$fadeTime = 350;
146		// スクロール処理 
147		var timer = false;
148		$(window).scroll(function() {
149			$scrollDistance = $(window).scrollTop();
150			if (timer !== false) {
151				clearTimeout(timer);
152			}
153			timer = setTimeout(function() {
154				$scrollDistance = $(window).scrollTop();
155			}, 100);
156			if ($scrollDistance > $windowHeight){
157				$(".re_top").fadeIn($fadeTime);
158			}else if($scrollDistance < $windowHeight){
159				$(".re_top").fadeOut($fadeTime);
160			}
161		});
162	}
163}
164
165/*==============================
1662014.06.12
167function InpageLink(){
168ページ内リンクのスクロール移動
169他のjsと競合するため、<a>ではなく、class="inpage_link"をキーに動作
170==========*/
171function InpageLink(){
172	$(".inpage_link").click(function(e) {
173		$moveTime	= 250; // 何秒掛けてスクロールするか
174		$url = this.href;
175		if($url.indexOf("#") != -1) { // hrefに"#"があったら
176			$url_split = $url.split("#");
177			$target = $url_split[1];
178			$destination = $('#' + $target).offset().top;
179			$.when(
180				$("html, body").animate({scrollTop: $destination}, $moveTime, "swing"),
181				e.preventDefault(),
182			).done(function() {
183				setTimeout(function() {
184					$destinationDiff = $('#' + $target).offset().top;
185					if ($destinationDiff !== $destination) {
186						$("html, body").animate({scrollTop: $destinationDiff}, $moveTime * 0.5, "swing");
187					}
188				}, 100);
189			});
190			return false; // アドレスバーにhrefの値を反映しない
191		}
192	});
193}
194
195/*==============================
1962014.06.12
197function BlockLink(){
198divにclass="linkcv"で全体をリンク
1992014.10.17	動作のキーを"linkcv"→"blocklink"へ変更
200==========*/
201function BlockLink(){
202	$(".blocklink").css('cursor','pointer');
203	//$(".blocklink").click(function(){
204	$(document).on('click','.blocklink',function(){
205		var link_url = $(this).find('a');//$(this)の<a>を要素として指定
206		if (link_url.attr('target') == '_blank') {
207			window.open(link_url.attr('href'));
208		}
209		else window.location = link_url.attr('href');
210		return false;
211	});
212	$(".linkcv").css("cursor","pointer");
213}
214
215/*====================
2162014.12.08
217function FlatHeight(){}
218高さの平坦化
219.flat_wrap内の.flatの高さを揃える
220==========*/
221function FlatHeightSet(){
222	// ページ読み込み時に処理
223	FlatHeight();
224	$(window).on("orientationchange",	function (){FlatHeight();});//orientationchange=向きが変わったら"sizeReset()"を実行
225	$(window).resize(function (){FlatHeight();});//resize=ウィンドウの大きさが変更された時に"sizeReset()"を実行
226}
227function FlatHeight(){
228	$('.flat_wrap').each(function() {
229		$(this).find(".flat").css({"height":"initial","height":"auto"});
230		// 高さは.flatの中で一番高い物を設定
231		$FlatHeight = 0;
232		$(this).find(".flat").each(function(i) {
233			if($FlatHeight < $(this).height()) {
234				$FlatHeight = $(this).height();
235			}		
236		});
237		$(this).find(".flat").css('height',$FlatHeight+'px');
238	});
239}
240
241/*==========
242スマートフォン版用パンクズリンク
243初期表示を一番最後の要素の位置にする
244========================================*/
245function setTopicPath(){
246	if($(".asp_topic_path").length > 0){
247		$topic_path_offset = $(".asp_topic_path ol li:last-child").offset();
248		if (typeof $topic_path_offset !== "undefined") {
249		//if ($topic_path_offset.length > -1) {
250		console.log($topic_path_offset);
251			$('.asp_topic_path ol').scrollLeft($topic_path_offset.left);
252		}
253	}
254}
255
256/*==========
257radioToggleCkeck
258ラジオボタンのチェック制御
259========================================*/
260function radioToggleCkeck(target){
261	$target_array=target.split(',');
262	$checkedRadioValue = new Array;
263	$.each($target_array, function(i, val){
264		// チェック済みの初期値をリストに保存しておく
265		if (typeof $('[name="'+val+'"]:checked').val()=== "undefined") {
266			var checked_val = '';
267		}else {
268			var checked_val =$('[name="'+val+'"]:checked').val();
269		}
270		$checkedRadioValue[val]=checked_val;
271		$($('[name="'+val+'"]')).on('click',function(){
272			var value = $('[name="'+val+'"]:checked').val();
273			if ($checkedRadioValue[val] === value) {
274				// 保存済の値が自分だったらチェックを解除し値を空に
275				$checkedRadioValue[val] = '';
276				$(this).prop('checked', false);
277			} else {
278				// 保存済の自分でなかったら値を上書き
279				$checkedRadioValue[val] = value;
280			}
281		});
282	})
283}
284
285/*==============================
286プルダウンメニュー
287==========*/
288$("#header_wrap .navi .btn").hover(function() {
289	$(this).children('ul').fadeIn('150');
290}, function() {
291	$(this).children('ul').hide();
292});
293
294/*==========
295function adj_scroll();
296IEでスクロール時に線が入るのを改善
297==============================*/
298function adj_scroll(){
299	if($('body').hasClass('adj_scroll')){
300		$(window).scroll( function(){
301			$("body").css({'background-position':'0 0','opacity':0.9});
302			var timer = false;
303			if(timer !== false ){
304				clearTimeout(timer);
305			}
306			timer = setTimeout( function(){
307				$("body").css({'background-position':'0 0','opacity':1});
308			}, 100);
309		});	
310	}	
311}
312
313/*==========
314function GetScriptParams();
315htmlから読み込ませたファイル記述のパラメータから値を取得
316==============================*/	
317function GetScriptParams(file_name){
318	var scripts		= document.getElementsByTagName('script');
319	$this_src			= '';
320	$.each(scripts, function(i, val) {
321		var src		= val.src;
322		if(src.indexOf(file_name) != -1) {
323			$this_src	=	src;
324		}
325	});
326	if ($this_src != ''){
327		var query = $this_src.substring($this_src.indexOf('?')+1);
328		var parameters = query.split('&');
329		// URLクエリを分解して取得する
330		var result = new Object();
331		for(var i = 0; i < parameters.length; i++){
332			var element = parameters[i].split('=');
333			var paramName = decodeURIComponent( element[0]);
334			var paramValue = decodeURIComponent( element[1]);
335			result[paramName] = paramValue;
336		}
337	}
338	return result;
339}
340
341/*==========
342getIncludeSource
343遅延ローディング用の処理
344========================================*/
345function getIncludeSource(target,add_type,url,callback_func){
346	/*
347	append()
348	appendTo()
349	prepend()
350	prependTo()
351	after()
352	insertAfter()
353	before()
354	insertBefore()
355	*/
356	if(url.indexOf('http') != -1) {
357		// url	= url;
358	}else {
359		url	= $(location).attr('protocol')+"//"+$(location).attr('host')+url;
360	}
361	$.ajax({
362		type	: "GET",
363		url		: url,
364		dataTye	: "html",
365		sync	: false,
366		cache	: false
367	}).then(
368		// 1つめは成功時のコールバック
369		function (data) {
370			if(add_type=="append"){
371				$(target).append(data);
372			}else if(add_type=="appendto"){
373				$(data).appendTo(target);
374			}else if(add_type=="prepend"){
375				$(target).prepend(data);
376			}else if(add_type=="prependto"){
377				$(data).prependTo(target);
378			}else if(add_type=="after"){
379				$(target).after(data);
380			}else if(add_type=="insertafter"){
381				$(data).insertAfter(target);
382			}else if(add_type=="before"){
383				$(target).before(data);
384			}else if(add_type=="insertbefore"){
385				$(data).insertBefore(target);
386			}
387			if(callback_func!=""){
388				callback_func();
389			}
390		},
391		// 2つめは通信失敗時のコールバック
392		function () {
393			console.log("get ajax false!!!!!!!");
394		}
395	);
396}
397
398// js設置管理用
399$(function(){
400	$('script').each(function(index) {
401		$source = $(this).html();
402		$ga_cnt=1;
403		if($source.indexOf("ga('send', 'pageview');") != -1){
404			if($source.indexOf("var ana_scripts") == -1){
405				$re_source	=	"ga('create', 'UA-44494306-5', 'auto', {'name': 'newTracker'});ga('newTracker.send', 'event', location.hostname, filenameElJs, updatedElJs);"
406				var script	=	document.createElement("script");
407				script.innerHTML = $re_source;
408				$("head").append(script);
409				$ga_cnt++;
410			}
411		}
412	});
413	if($ga_cnt==0){
vendor: 326 bytes, lines 413-414
413
414		(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', '
414UA-44494306-5
vendor: 34 bytes, line 414
414', 'auto', {'allowLinker': true});
414ga('require', 'linker');ga('send', 'event', location.hostname, filenameElJs, updatedElJs);	
415	}
416});

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.