PageSourceSearch

https://www.ni-grand.co.jp/js/library.js

js ni-grand.co.jp collected 2026-09-26 09:42:52 UTC 7,196 bytes, 351 lines download raw bytes

1/**
2 * JavaScript library
3 * Version: 2009
4 * Depends: jquery-1.4.1.js
5 */
6// Addition meta information
7document.write('<meta http-equiv="imagetoolbar" content="no" />');
8
9/**
10 * External links
11 */
12function externalLinks(){
13
14	if(!document.getElementsByTagName) return;
15
16	var anchors = document.getElementsByTagName("a");
17
18	for(var i=0; i<anchors.length; i++){
19
20		var anchor = anchors[i];
21
22		if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
23
24	}
25
26}
27
28$(function(){ externalLinks()});
29
30/**
31 * Rollover images
32 */
33function smartRollover(){
34
35	if(document.getElementsByTagName){
36
37		var imageTags = document.getElementsByTagName("img");
38
39		for(var i=0; i < imageTags.length; i++){
40
41			if(imageTags[i].className == "rollover"){
42
43				if(imageTags[i].getAttribute("src").match("_off.")){
44
45					imageTags[i].onmouseover = function(){
46
47						this.setAttribute("src",this.getAttribute("src").replace("_off.","_on."));
48
49					}
50
51					imageTags[i].onmouseout = function(){
52
53						this.setAttribute("src",this.getAttribute("src").replace("_on.","_off."));
54
55					}
56
57				}
58
59			}
60
61		}
62
63	}
64
65}
66
67$(function(){ smartRollover()});
68
69/**
70 * Popup new window
71 */
72function popupWindow(popHref,popWidth,popHeight){
73
74	popUpWin = window.open(
75
76		popHref,
77		"subwin",
78		"width="+popWidth+",height="+popHeight+",scrollbars=1,resizable=1,directories=0,toolbar=0,status=1,location=0"
79
80	);
81
82	popUpWin.focus();
83
84}
85
86
87/*-------------------------------------------------------
88	Modal
89-------------------------------------------------------*/
90jQuery(function($){
91
92	$(function(){
93
94		// スクロールバーの横幅を取得
95		$('html').append('<div class="scrollbar" style="overflow:scroll;"></div>');
96
97		var scrollsize = window.innerWidth - $('.scrollbar').prop('clientWidth');
98
99		$('.scrollbar').hide();
100
101		// 「.modal-open」をクリック
102		$('.modal-open').click(function(){
103
104			// html、bodyを固定(overflow:hiddenにする)
105			$('html, body').addClass('lock');
106
107			// オーバーレイ用の要素を追加
108			$('body').append('<div class="modal-overlay"></div>');
109
110			// オーバーレイをフェードイン
111			$('.modal-overlay').fadeIn('slow');
112
113			// モーダルコンテンツのIDを取得
114			var modal = '#' + $(this).attr('data-target');
115
116			// モーダルコンテンツを囲む要素を追加
117			$(modal).wrap("<div class='modal-wrap'></div>");
118
119			// モーダルコンテンツを囲む要素を表示
120			$('.modal-wrap').show();
121
122			// モーダルコンテンツの表示位置を設定
123			modalResize();
124
125			// モーダルコンテンツフェードイン
126			$(modal).fadeIn('slow');
127
128			// モーダルコンテンツをクリックした時はフェードアウトしない
129			$(modal).click(function(e){
130				e.stopPropagation();
131			});
132
133			// 「.modal-overlay」あるいは「.modal-close」をクリック
134			$('.modal-wrap, .modal-close').off().click(function(){
135
136				// モーダルコンテンツとオーバーレイをフェードアウト
137				$(modal).fadeOut('slow');
138
139				$('.modal-overlay').fadeOut('slow',function(){
140
141					// html、bodyの固定解除
142					$('html, body').removeClass('lock');
143
144					// オーバーレイを削除
145					$('.modal-overlay').remove();
146
147					// モーダルコンテンツを囲む要素を削除
148					$(modal).unwrap("<div class='modal-wrap'></div>");
149
150				});
151
152			});
153
154			// リサイズしたら表示位置を再取得
155			$(window).on('resize', function(){
156
157				modalResize();
158
159			});
160
161			// モーダルコンテンツの表示位置を設定する関数
162			function modalResize(){
163
164				// ウィンドウの横幅、高さを取得
165				var w = $(window).width();
166				var h = $(window).height();
167
168				// モーダルコンテンツの横幅、高さを取得
169				var mw = $(modal).outerWidth(true);
170				var mh = $(modal).outerHeight(true);
171
172				// モーダルコンテンツの表示位置を設定
173				if ((mh > h) && (mw > w)) {
174
175					$(modal).css({'left': 0 + 'px','top': 0 + 'px'});
176
177				} else if ((mh > h) && (mw < w)) {
178
179					var x = (w - scrollsize - mw) / 2;
180					$(modal).css({'left': x + 'px','top': 0 + 'px'});
181
182				} else if ((mh < h) && (mw > w)) {
183
184					var y = (h - scrollsize - mh) / 2;
185					$(modal).css({'left': 0 + 'px','top': y + 'px'});
186
187				} else {
188
189					var x = (w - mw) / 2;
190					var y = (h - mh) / 2;
191					$(modal).css({'left': x + 'px','top': y + 'px'});
192
193				}
194
195			}
196
197		});
198
199	});
200
201});
202
203/*-------------------------------------------------------
204	gotop
205-------------------------------------------------------*/
206(function($){
207
208	$(function() {
209
210		var topBtn = $('.move');
211		topBtn.hide();
212
213		//スクロールが100に達したらボタン表示
214		$(window).scroll(function () {
215
216			if ($(this).scrollTop() > 100) {
217
218				topBtn.fadeIn();
219
220			} else {
221
222				topBtn.fadeOut();
223
224			}
225
226		});
227
228		//スクロールしてトップ
229		topBtn.click(function () {
230
231			$('body,html').animate({
232
233				scrollTop: 0
234
235			}, 500);
236
237			return false;
238
239		});
240
241	});
242
243	$(".move").hide();
244	// ↑ページトップボタンを非表示にする
245
246	$(window).on("scroll", function() {
247
248		//上へ戻るときにモーションをつけたい場合はコメントアウト解除
249//		if ($(this).scrollTop() > 100) {
250
251			// ↑ スクロール位置が100よりも小さい場合に以下の処理をする
252//			$('.move').slideDown("fast");
253			// ↑ (100より小さい時は)ページトップボタンをスライドダウン
254
255//		} else {
256
257//			$('.move').slideUp("fast");
258			// ↑ それ以外の場合の場合はスライドアップする。
259
260//		}
261		//上へ戻るときにモーションここまで
262
263		// フッター固定する
264		scrollHeight = $(document).height();
265
266		// ドキュメントの高さ
267		scrollPosition = $(window).height() + $(window).scrollTop();
268
269		// ウィンドウの高さ + スクロールした高さ → 現在のトップからの位置
270		footHeight = $("footer").innerHeight();
271
272		// フッターの高さ
273		if ( scrollHeight - scrollPosition  <= footHeight ) {
274
275			// 現在の下から位置が、フッターの高さの位置にはいったら
276			// ".move"のpositionをabsoluteに変更し、フッターの高さの位置にする
277			$(".move").css({
278
279				"position":"absolute",
280				"bottom": footHeight
281
282			});
283
284			$(".move").addClass("stop");
285
286		} else {
287
288			// それ以外の場合は元のcssスタイルを指定
289			$(".move").css({
290
291				"position":"fixed",
292				"bottom": "30px"
293
294			});
295
296			$(".move").removeClass("stop");
297
298		}
299
300	});
301
302})(jQuery);
303
304/*-------------------------------------------------------
305	PC or SP
306-------------------------------------------------------*/
307var windowWidth = $(window).width();
308var windowSm = 640;
309
310if ( windowWidth <= windowSm ) {
311
312	jQuery(function($){
313
314		$(window).on('scroll', function() {
315
316			if ($(this).scrollTop() > 50 ) {
317
318				$('header').addClass('fixed');
319
320			} else {
321
322				$('header').removeClass('fixed');
323
324			}
325
326		});
327
328	});
329
330	jQuery(function($){
331
332		$(function() {
333
334			$(".langnav").css("display","none");
335
336			$(".menu_en").on("click", function() {
337
338				$(".langnav").slideToggle();
339
340			});
341
342		});
343
344	});
345
346} else {
347
348	// 横幅640px超のとき(タブレット、PC)に行う処理を書く
349
350}
351

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.