PageSourceSearch

https://www.nmri.go.jp/common/js/script_slider_auto.js

js nmri.go.jp collected 2026-10-02 05:26:17 UTC 11,457 bytes, 450 lines download raw bytes

1// JavaScript Document
2
3/* TOPへ */
4jQuery(function($){
5  var pageTop = $("#page-top");
6  pageTop.hide();
7  pageTop.click(function () {
8    $('body, html').animate({ scrollTop: 0 }, 500);
9    return false;
10  });
11  $(window).scroll(function () {
12    if($(this).scrollTop() >= 200) {
13      pageTop.fadeIn();
14    } else {
15      pageTop.fadeOut();
16    }
17  });
18});
19
20
21$(function() {
22	$('a[href^="#"]').click(function() {
23		var speed = 400;
24		var href= $(this).attr("href");
25		var target = $(href == "#" || href == "" ? 'html' : href);
26		var position = target.offset().top-30;//固定メニューの分ずらす
27		$('body, html').animate({scrollTop:position}, speed, 'swing');
28		return false;
29	});
30});
31
32
33
34$(function(){
35  var menuItem = $('header.site_head .menu_item');
36  menuItem.children('.sub_menu').hide();
37	var timeBomb;
38	menuItem.hover(function () {
39    var that = this;
40    timeBomb = setTimeout(function(){
41      $(that).children('.sub_menu').fadeIn("fast");
42			//$(that).addClass('current');
43    }, 250);
44  }, function () {
45		$(this).children('.sub_menu').fadeOut("fast");
46		//$(this).removeClass('current');
47    clearTimeout(timeBomb);
48  });
49
50	$('.sub_menu .close').on('click', function () {
51		$('.sub_menu').fadeOut("fast");
52	});
53});
54
55
56
57
58
59$(function(){
60	if(location.pathname != "/") {
61	$("header.site_head li.menu_item a").each(function(){
62		if(this.href == location.href) {
63			$(this).parents("li").addClass("current");
64		}
65	});
66	} else $(this).parents("li").addClass("current");
67});
68
69
70
71$(function () {
72	var $body = $('body');
73	$('#js__sideMenuBtn').on('click', function () {
74		$body.toggleClass('side-open');
75		$('#js__overlay').on('click', function () {
76			$body.removeClass('side-open');
77		});
78	});
79});
80
81
82
83$(function () {
84	$('.search_btn').on('click', function () {
85		$(this).next().slideToggle();
86	});
87});
88
89
90$(function () {
91	$('.toggle_btn').next().addClass('toggle_wrap');
92	$('.toggle_btn').next().hide();
93	$('.toggle_btn').on('click', function () {
94		$('.toggle_btn').not($(this)).next().slideUp();
95		$('.in_toggle_btn').next().slideUp();
96		$(this).next().slideToggle();
97		$(this).toggleClass('active');
98		$('.toggle_btn').not($(this)).removeClass('active');
99	});
100});
101$(function () {
102	$('.in_toggle_btn').next().addClass('toggle_wrap');
103	$('.in_toggle_btn').next().hide();
104	$('.in_toggle_btn').on('click', function () {
105		$('.in_toggle_btn').not($(this)).next().slideUp();
106		$(this).next().slideToggle();
107		$(this).toggleClass('active');
108	});
109});
110
111
112$(function () {
113	var hash = location.hash;
114	var pathname = location.pathname;
115	if (window.matchMedia( "(max-width: 896px)" ).matches) {
116		//var headsize = 180;
117		if (pathname.includes('combination_table')) {
118			var headsize = 320;
119		} else {
120			var headsize = 180;
121		}
122	} else {
123		//var headsize = 50;
124		if (pathname.includes('combination_table')) {
125			var headsize = 220;
126		} else {
127			var headsize = 50;
128		}
129	}
130	if(hash){
131		$(hash).children('.toggle_wrap').slideToggle();
132		$(hash).children('.toggle_btn').toggleClass('active');
133		var targetOffset = $(hash).offset().top-headsize;
134		$('html,body').delay(100).animate({scrollTop: targetOffset}, "slow"); //0.1秒後
135		//console.log(pathname);
136	}
137});
138
139
140
141
142
143$(function() {
144    var dir = location.href.split("/");
145    var dir_name = dir[3];
146		//console.log(dir_name);
147    $('body').addClass(dir_name);
148		if (dir_name != '') {
149			$('body').addClass('lower');
150		}
151});
152
153
154
155/* form */
156$(function(){
157  $('#inquiry').validationEngine({
158    promptPosition: "topLeft:0",
159		scrollOffset: 85
160  })
161})
162//全角から半角に変換
163$(function(){
164    $(".half").change(function(){
165        var str = $(this).val();
166        str = str.replace( /[A-Za-z0-9]/g, function(s) {
167            return String.fromCharCode(s.charCodeAt(0) - 65248);
168        });
169        $(this).val(str);
170    }).change();
171});
172//半角から全角に変換
173$(function(){
174    $(".em").change(function(){
175        var str = $(this).val();
176        str = str.replace( /[A-Za-z0-9]/g, function(s) {
177            return String.fromCharCode(s.charCodeAt(0) + 65248);
178        });
179        $(this).val(str);
180    }).change();
181});
182//記号のみ半角から全角に変換
183$(function(){
184    $(".em_mark").change(function(){
185        var str = $(this).val();
186        str = str.replace( /[,/\\!;#\$%&()=~\.:_<>,\?\[\]\+\*{}@\^~]/g, function(s) {
187            return String.fromCharCode(s.charCodeAt(0) + 65248);
188        });
189        $(this).val(str);
190    }).change();
191});
192
193//半角カタカナから全角カタカナ
194$(function() {
195
196;(function($){
197	$.fn.tgConvertString = function(options){
198		init(); // 文字配列呼び出し
199		$(".zenkaku").each(function(){
200			$(this).change(function(){
201				var str = $(this).val();
202				str = hanKata2zenKata(str);
203				$(this).val(str);
204			});
205		})
206	}
207}
207)(jQuery);
208/** 半角カタカナ→全角カタカナ* */
209function hanKata2zenKata( str ){
210	for(i=0; i<=90; i++){
211		while(str.indexOf(hanKata[i]) >= 0){
212			str = str.replace(hanKata[i], zenKata[i]);
213		}
214	}
215	return str;
216}
217
218/* 文字配列作成*/
219function init(){
220	hanKata = new Array(
221		"ガ", "ギ", "グ", "ゲ", "ゴ", "ザ", "ジ", "ズ", "ゼ", "ゾ",
222		"ダ", "ヂ", "ヅ", "デ", "ド", "バ", "パ", "ビ", "ピ", "ブ",
223		"プ", "ベ", "ペ", "ボ", "ポ", "ヴ", "ァ",  "ア",  "ィ",  "イ",
224		"ゥ",  "ウ",  "ェ",  "エ",  "ォ",  "オ",  "カ",  "キ",  "ク",  "ケ",
225		"コ",  "サ",  "シ",  "ス",  "セ",  "ソ",  "タ",  "チ",  "ッ",  "ツ",
226		"テ",  "ト",  "ナ",  "ニ",  "ヌ",  "ネ",  "ノ",  "ハ",  "ヒ",  "フ",
227		"ヘ",  "ホ",  "マ",  "ミ",  "ム",  "メ",  "モ",  "ャ",  "ヤ",  "ュ",
228		"ユ",  "ョ",  "ヨ",  "ラ",  "リ",  "ル",  "レ",  "ロ",  "ワ",  "ウィ",
229		"ウェ", "ヲ",  "ン",  "ー",  "。",  "「",  "」",  "、",  "・",  "゙",
230		"゚"
231	);
232	zenKata = new Array(
233		"ガ", "ギ", "グ", "ゲ", "ゴ", "ザ", "ジ", "ズ", "ゼ", "ゾ",
234		"ダ", "ヂ", "ヅ", "デ", "ド", "バ", "パ", "ビ", "ピ", "ブ",
235		"プ", "ベ", "ペ", "ボ", "ポ", "ヴ", "ァ", "ア", "ィ", "イ",
236		"ゥ", "ウ", "ェ", "エ", "ォ", "オ", "カ", "キ", "ク", "ケ",
237		"コ", "サ", "シ", "ス", "セ", "ソ", "タ", "チ", "ッ", "ツ",
238		"テ", "ト", "ナ", "ニ", "ヌ", "ネ", "ノ", "ハ", "ヒ", "フ",
239		"ヘ", "ホ", "マ", "ミ", "ム", "メ", "モ", "ャ", "ヤ", "ュ",
240		"ユ", "ョ", "ヨ", "ラ", "リ", "ル", "レ", "ロ", "ワ", "ヰ",
241		"ヱ", "ヲ", "ン", "ー", "。", "「", "」", "、", "・", "゛",
242		"゜"
243	);
244}
245});
246
247jQuery(function(){
248    $(this).tgConvertString();
249});
250
251
252//エンターでのsubmitを禁止
253$(document).ready(function () {
254	$('input,textarea[readonly]').not($('input[type="button"],input[type="submit"]')).keypress(function (e) {
255		if (!e) var e = window.event;
256		if (e.keyCode == 13)
257		return false;
258	});
259});
260
261
262//site_head クラスの header の中の g_nav クラスがスクロールされた際に
263//要素の最上部から縦スクロールした現在位置の上部までのピクセル数が
264//offset.topを越えた場合に bodyのクラスにfixed を追加。
265//bodyに fixed が設定されると、headerもfixedになり上部に固定される。
266// https://ghweb.info/post-1920.html
267// 2022年11月1日、上記コメントを追加
268$(function($) {
269	var nav = $('header.site_head .g_nav'),
270	offset = nav.offset();
271
272	$(window).scroll(function () {
273		if($(window).scrollTop() > offset.top) {
274			$('body').addClass('fixed');
275		} else {
276			$('body').removeClass('fixed');
277		}
278	});
279});
280
281//site_head クラスの header の中の g_nav クラスがスクロールされた際に
282//要素の最上部から縦スクロールした現在位置の上部までのピクセル数が
283//offset.topを越えた場合に jump1_5が設定されたdiv要素に jump1_5bis を追加。
284//設定は重複するが、important設定をしているので、jump1_5bisの設定が優先。
285// 2022年11月1日、下記を追加
286$(function($) {
287	var nav = $('header.site_head .g_nav'),
288	offset = nav.offset();
289
290	$(window).scroll(function () {
291		if($(window).scrollTop() > offset.top) {
292			$('div.jump1_5').addClass('jump1_5bis');
293			$('div.jump1_6').addClass('jump1_6bis');
294			$('div.jump1_7').addClass('jump1_7bis');
295		} else {
296			$('div.jump1_5').removeClass('jump1_5bis');
297			$('div.jump1_6').removeClass('jump1_6bis');
298			$('div.jump1_7').removeClass('jump1_7bis');
299		}
300	});
301});
302
303$(function() {
304	$('.mh').matchHeight();
305	$('.main_slider li').matchHeight();
306	$('.box_list li').matchHeight();
307});
308
309
310
311
312$(function(){
313
314	$('.main_slider').slick({
315		arrows: true,
316		dots: false,
317		appendDots: $('#slider_controller'),
318		autoplay: true,
319		autoplaySpeed: 7000,
320		infinite: true,
321		pauseOnFocus: false, 
322		pauseOnHover: false
323	});
324	var isPaused = false;
325	$('.slider_play_pause_button').on('click', function () {
326		$(this).toggleClass('active');
327
328		if (isPaused === false) {
329			$('.main_slider').slick('slickPause');
330			isPaused = true;
331		} else {
332			$('.main_slider').slick('slickPlay');
333			isPaused = false;
334		}
335        });
336
337	/*
338	var i = 0;
339	var slide_to_show = 2;
340
341	function filter_function(index, element) {
342		const slide_data = $(element).data("slide");
343		if (slide_data === "") {
344			return true;
345		}
346		if (slide_data === slide_to_show) {
347			return true;
348		}
349		return false
350	}
351
352	$('.main_slider').on('beforeChange', function(slick, currentSlide) {
353		i++;
354		if (i === 3) {
355			i = 0;
356			slide_to_show++;
357			if (slide_to_show == 4) {
358				slide_to_show = 1;
359			}
360			$('.main_slider').slick('slickUnfilter');
361			$('.main_slider').slick('slickFilter', filter_function);
362		}
363	});
364	setTimeout(() => {
365		$('.main_slider').slick('slickFilter', filter_function);
366	}, 10);
367	*/
368});
369
370$(function(){
371	$('.slider').slick({
372		centerPadding: '5%',
373		arrows: true,
374		dots: true,
375		slidesToShow:3,
376		centerMode:true,
377		prevArrow:'<div class="prev"></div>',
378		nextArrow:'<div class="next"></div>',
379		autoplay: true,
380		autoplaySpeed: 5000,
381		responsive: [
382			{
383				breakpoint: 761, //760px以下のサイズに適用
384				settings: {
385					slidesToShow:1,
386					centerPadding: '30px',
387				}
388			}
389		]
390	});
391});
392
393
394
395
396//スマホのみtelリンク追加
397if (navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/)) {
398  $(function() {
399    $('.telnum').each(function() {
400      var str = $(this).html();
401      if ($(this).children().is('img')) {
402        $(this).html($('<a>').attr('href', 'tel:' + $(this).children().attr('alt').replace(/-/g, '')).append(str + '</a>'));
403      } else {
404        $(this).html($('<a>').attr('href', 'tel:' + $(this).text().replace(/-/g, '')).append(str + '</a>'));
405      }
406    });
407  });
408}
409
410
411
412
413jQuery(function($){
414	$('.tab').click(function(){
415		$('.is_active').removeClass('is_active');
416		$(this).addClass('is_active');
417		$('.is_show').removeClass('is_show');
418		// クリックしたタブからインデックス番号を取得
419		const index = $(this).index();
420		// クリックしたタブと同じインデックス番号をもつコンテンツを表示
421		$('.panel').eq(index).addClass('is_show');
422	});
423});
424
425
426
427
428if (window.matchMedia( "(max-width: 896px)" ).matches) {
429	//scroll-hint
430	$(function(){
431		 new ScrollHint('.scroll', {
432				 remainingTime: 5000
433		 });
434	});
435}
436
437
438
439
440//file_tracking
441$(function() {
442	$('a[href$=".pdf"], a[href$=".zip"]').on('click', function () {
443		const $this = $(this);
444		const filePath = $(this).attr('href');
445		gtag('config', GA_TRACKING_ID, {
446			'page_title': $this.text(),
447			'page_path': filePath
448		});
449	});
450});

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.