PageSourceSearch

https://www.city.morioka.iwate.jp/_template_/_site_/_default_/_res/js/default.js?a

js city.morioka.iwate.jp collected 2026-10-02 05:16:49 UTC 64,572 bytes, 1,977 lines download raw bytes

1
2(function(){
3var $ = FI.jQuery;
4
5//-------------------------------------------------
6// ▼各種設定 変更可能エリア ここから
7//-------------------------------------------------
8//ブレイクポイントの設定(ウインドウ幅の設定)
9var point = {
10	//ブレイクポイントの名前(要素移動などで使用) : MediaQueryの値 ※PCとスマホの幅の数値を変更
11	pc: '(min-width : 821px)',
12	smp: 'only screen and (max-width : 820px)'
13};
14
15//要素移動の設定 
16//移動の設定は4つのみ「before:要素の前 after:要素の後 prepend:子要素の先頭 append:子要素の最後」
17var MOVE_E = [{
18	//削除不可:イベントカレンダー
19	elem: '#eventlink',
20	pc: ['#eventsearch','prepend'],
21	smp: ['h1','after']
22},{
23	//
24	elem: '.sample',
25	pc: ['#sample','after'],
26	smp: ['#sample','prepend']
27}];
28
29//要素複製の設定
30//追加位置の指定設定は4つのみ「before:要素の前 after:要素の後 prepend:子要素の先頭 append:子要素の最後」
31var CLONE_E = [{
32	elem: 'test', //複製する要素
33	move: ['test','after'], //移動先要素、追加位置の指定
34	only: 'pc'//pconlyを追加の場合は'pc'、smponlyを追加の場合は'smp'を記述
35},{
36	//
37	elem: '.sample',
38	move: ['#sample','append'],
39	only: ''
40}
41];
42
43//▼ヘッダーフロート起動設定(trueの場合フロートする)
44var gyoseiHeaderActive = true;
45
46//▼ function起動用 起動しないfunctionがある場合はコメントアウト scriptにidを追加し、ある場合のみ読み込む
47function LoadF(mode){
48	CSSchange();
49	ELEMENT(mode);
50	commentMove(mode);
51	bottom_navi_change(mode);
52	SMPjs(mode);
53	Tablescroll(mode);
54	if(gyoseiHeaderActive) {
55		gyoseiHeader(mode);
56	}else{
57		AnchorLink();
58	}
59	ARTICLEALL(mode);
60	dropdown_menu(mode);
61	viewModeChange(mode);
62}
63//▲ function起動用
64
65//-------------------------------------------------
66// ▲各種設定 変更可能エリア ここまで
67//-------------------------------------------------
68
69	var mediaary = Array();
70	var mode;
71	var commentNodes = [];
72	
73	//▼ボトムナビ名称用
74	var $smpmenutext = "メニュー";
75	var $smpmenup1text = $("#smpmenup1 .hnmenu span").text();
76	var $smpmenup2text = $("#smpmenup2 .hnmenu span").text();
77
78	//▼表示固定用
79	var BASE_PC = "pc";
80	var BASE_SMP = "smp";
81	
82	//▼css 切替用初期設定
83	var css_pcary = ["#cmncss_pc","#cmncss_pc2"];
84	var css_smpary = ["#cmncss_smp","#cmncss_smp2"];
85	
86	//▼cookieの期間
87	var cookie_date = 7;
88	
89	$(function(){
90		
91		CLONE();
92		
93		// 要素移動用のコメントを取得
94		$('*').contents().each(function () {
95			if (this.nodeType === 8) {
96				commentNodes.push(this);
97			}
98		});
99		
100		//cookieの判定、cookieは公開サイトでは使用しない
101		if($.cookie('smp_mode')=="smp"){
102			if($('body').hasClass('viewmode_'+BASE_PC)){
103				$('body').removeClass('viewmode_'+BASE_PC);
104			}
105			if(!$('body').hasClass('viewmode_'+BASE_SMP)){
106				$('body').addClass('viewmode_'+BASE_SMP);
107			}
108			LoadF(BASE_SMP);
109		}else if($.cookie('smp_mode')=="pc"){
110			if(!$('body').hasClass('viewmode_'+BASE_PC)){
111				$('body').addClass('viewmode_'+BASE_PC);
112			}
113			if($('body').hasClass('viewmode_'+BASE_SMP)){
114				$('body').removeClass('viewmode_'+BASE_SMP);
115			}
116			LoadF(BASE_PC);
117		}
118		
119		for(mode in point){
120			mediaary[mode] = window.matchMedia(point[mode]);
121			mediaary[mode].addEventListener('change', MODECHANGE, false);
122		}
123		
124		//「スマホ切替ボタン」クリックイベント
125		$('#viewmode_smp').on('click',function(){
126			$.cookie('smp_mode',"smp",{expires:cookie_date});
127			MODECHANGE();
128		});
129		//「PC」クリックイベント
130		$('#viewmode_pc').on('click',function(){
131			$.cookie('smp_mode',"pc",{expires:cookie_date});
132			MODECHANGE();
133		});
134		
135		if(!($.cookie('smp_mode'))){
136			MODECHANGE();
137		}
138		
139		bottomNaviSet();
140	});
141
142
143//▼▼▼▼▼ コメントアウトへの位置移動 ▼▼▼▼▼
144function commentMove(mode){
145
146	// 各コメントを解析して移動
147	$.each(commentNodes, function (i, node) {
148
149		const pattern = new RegExp('^\\[move-' + mode + ':\\s*(.+?)\\]$');
150		const match	  = $.trim(node.nodeValue).match(pattern);
151		if (!match) return;
152		
153		const moveKey = $.trim(match[1]);
154		// data-move の値が一致する要素を取得
155		const $target = $('[data-move="' + moveKey + '"]');
156		if ($target.length === 0) return;
157	
158		// コメントの直後に要素を移動
159		$(node).after($target);
160	});
161	
162}
163//▲▲▲▲▲ コメントアウトへの位置移動 ▲▲▲▲▲
164
165
166//▼▼▼▼▼ function ▼▼▼▼▼
167//▼ ブレイクポイント処理
168function MODECHANGE(){
169	var mc = $.cookie('smp_mode');
170	if(mc){
171		for(mode in point){
172			$('body').removeClass('viewmode_'+mode);
173		}
174		if(mc=="pc"){
175			$('body').addClass('viewmode_'+BASE_PC);
176			LoadF(BASE_PC);
177		}else if(mc=="smp"){
178			$('body').addClass('viewmode_'+BASE_SMP);
179			LoadF(BASE_SMP);
180		}
181		resetEventListeners();
182	}else if(!mc){
183		for(mode in point){
184			if(mediaary[mode].matches && !$('body').hasClass('viewmode_'+mode)){
185				$('body').addClass('viewmode_'+mode);
186				LoadF(mode);
187				resetEventListeners();
188			}
189			if(!mediaary[mode].matches && $('body').hasClass('viewmode_'+mode)){
190				$('body').removeClass('viewmode_'+mode);
191			}
192		}
193	}
194}
195//▲ ブレイクポイント処理
196
197//▼ ボトムナビ
198//--- ▼関数 ----------------------------
199//開閉時にクラスを追加・削除する
200var storedScrollY = 0;
201bodyopen = function(){
202	var h = $(window).height();
203	
204	if($("body").hasClass("open")){
205		$("body").removeClass("open");
206		var currentFontSize = $("body").css("font-size");
207		$("body").removeAttr("style");
208		if(currentFontSize){
209			$("body").css("font-size", currentFontSize);
210		}
211		$('body,html').scrollTop(storedScrollY);
212	}else{
213		var scrollY = $(window).scrollTop();
214		$("body").addClass("open");
215		$("body").height(h);
216		storedScrollY = scrollY;
217		$('body').css({
218			top: `-${scrollY}px`,
219		}).data('scrollY', scrollY);
220	}
221};
222//PC全画面メニュー
223bodypcopen = function(){
224	var h = $(window).height();
225	if($("body").hasClass("pcopen")){
226		$("body").removeClass("pcopen");
227		var currentFontSize = $("body").css("font-size");
228		$("body").removeAttr("style");
229		if(currentFontSize){
230			$("body").css("font-size", currentFontSize);
231		}
232	}else{
233		$("body").addClass("pcopen");
234		$("body").height(h);
235	}
236};
237
238//折りたたみを開いたときに高さを固定する
239gnavismpheight = function(){
240	if($('body').hasClass('viewmode_smp')){
241		var h = window.innerHeight;
242		var jbnh = $("#jssmpbtmnavi").outerHeight();
243		$("#jssmpbtmnavi .openmenu").css({
244			"height": h - jbnh + "px", // フォールバック
245			"bottom": jbnh + "px"
246		});
247		// dvhサポートチェックとスタイル適用
248		if (CSS.supports("height", "100dvh")) {
249			$("#jssmpbtmnavi .openmenu").css({
250				"height": "calc(100dvh - " + jbnh + "px)"
251			});
252		}
253	}
254};
255
256//リンク名称を「閉じる」にする
257//メニュー名を記憶 閉じた際に戻す用
258closeText = function(){
259	if($("#jssmpbtmnavi #smpmenu .choice").length){
260		$("#jssmpbtmnavi #smpmenu .hnmenu span").text("閉じる");
261	}else{
262		$("#jssmpbtmnavi #smpmenu .hnmenu span").text($smpmenutext);
263	}
264	if($("#jssmpbtmnavi #smpmenup1 .choice").length){
265		$("#jssmpbtmnavi #smpmenup1 .hnmenu span").text("閉じる");
266	}else{
267		$("#jssmpbtmnavi #smpmenup1 .hnmenu span").text($smpmenup1text);
268	}
269	if($("#jssmpbtmnavi #smpmenup2 .choice").length){
270		$("#jssmpbtmnavi #smpmenup2 .hnmenu span").text("閉じる");
271	}else{
272		$("#jssmpbtmnavi #smpmenup2 .hnmenu span").text($smpmenup2text);
273	}
274	if($("#header #smpmenup2 .choice").length){
275		$("#header #smpmenup2 .hnmenu span").text("閉じる");
276	}else{
277		$("#header #smpmenup2 .hnmenu span").text($smpmenup2text);
278	}
279};
280
281function bottom_view_change(){
282	$('#jssmpbtmnavi #smpmenu.bmenu ,#jssmpbtmnavi #smpmenup1.bmenu ,#jssmpbtmnavi #smpmenup2.bmenu').each(function(){
283		$('.hnmenu',this).each(function(){
284			if($(this).hasClass("view_pc")){
285				$(this).removeClass("view_pc");
286				$(this).attr('aria-expanded', 'false');
287				$(this).next().attr('aria-hidden', 'true');
288			}
289			if(!$(this).hasClass("view_smp")){
290				$(this).addClass("view_smp");
291			}
292		});
293	});
294}
295
296function bottom_navi_change(mode){
297	if($('#jssmpbtmnavi').length){
298	
299		//グローバルナビ処理
300		if($('#topgnavibg , #gnavibg').length){
301			$gnavi = $('#topgnavibg , #gnavibg');
302			if(mode=="pc"){
303				$('#jssmpbtmnavi .scate').each(function(){
304					$('.navi',this).css('display', 'none');
305					$(".tismenu",this).attr('aria-expanded', 'false');
306					$('.navi',this).attr('aria-hidden', 'true');
307				});
308			}
309			if(mode=="smp"){
310				$('#jssmpbtmnavi .scate').each(function(){
311					$('.navi',this).removeAttr("style");
312					$(this).removeClass("choice");
313					$(".tismenu",this).removeClass("choice");
314					$(".tismenu",this).removeAttr('aria-expanded');
315					$('.navi',this).removeAttr('aria-hidden');
316				});
317			}
318		}
319		
320		//表示処理
321		if(mode=="pc"){
322			$('#jssmpbtmnavi #smpmenu.bmenu .hnmenu').each(function(){
323				if(!$(this).hasClass("view_pc")){
324					$(this).addClass("view_pc");
325					$(this).removeClass("choice");
326					$(this).attr('aria-expanded', 'false');
327					$(this).next().attr('aria-hidden', 'true');
328				}
329				if($(this).hasClass("view_smp")){
330					$(this).removeClass("view_smp");
331				}
332			});
333			
334			if($("body").hasClass("open")){
335				$("body").removeClass("open");
336				var currentFontSize = $("body").css("font-size");
337				$("body").removeAttr("style");
338				if(currentFontSize){
339					$("body").css("font-size", currentFontSize);
340				}
341				$('body,html').scrollTop(storedScrollY);
342			}
343		}
344
345		if(mode=="smp"){
346			$('#jssmpbtmnavi #smpmenu.bmenu ,#jssmpbtmnavi #smpmenup1.bmenu ,#jssmpbtmnavi #smpmenup2.bmenu').each(function(){
347				$('.hnmenu',this).off();
348				$('.psclose',this).off();
349				
350				gnavismpheight();
351				
352				$('.hnmenu',this).each(function(){
353					if($(this).hasClass("view_pc")){
354						$(this).removeClass("view_pc");
355						$(this).removeClass("choice");
356						$(this).attr('aria-expanded', 'false');
357						$(this).next().attr('aria-hidden', 'true');
358					}
359					if(!$(this).hasClass("view_smp")){
360						$(this).addClass("view_smp");
361					}
362				});
363				
364				//bottom_view_change();
365				
366				var $bmenu = $(this).children('*').not('.bmenu .hnmenu');
367				var $currentButton = $('.hnmenu',this);
368				
369				// モード切替時:既に開いている場合はイベントを記録
370				var isMenuOpen = $currentButton.hasClass('choice');
371				
372				$bmenu.hide();
373				$(this).toggleClass("pscatenone");
374
375				//ボトムナビをクリックしたら
376				$('.view_smp',this).on('click', function() {
377					if($('body').hasClass('viewmode_smp')){
378						$bmenu.slideToggle();
379						$(this).toggleClass("choice");
380						$(this).attr('aria-expanded', 'true');
381						$(this).next().attr('aria-hidden', 'false');
382						$(this).parents('.bmenu').toggleClass("pscatenone");
383						
384						bodyopen();
385						gnavismpheight();
386						//closeText();
387						
388						//WAI-ARIA
389						if(!$(this).hasClass("choice")){
390							$(this).attr('aria-expanded', 'false');
391							$(this).next().attr('aria-hidden', 'true');
392						} else {
393							// メニューが開いた時にフォーカストラップを設定
394							setupBottomNaviFocusTrap($(this));
395						}
396						
397						//他を閉じる
398						menuSwitch = function($id){
399							if($($id + ' .hnmenu').hasClass('choice')){
400								$($id).children('*').not('.bmenu .hnmenu').slideUp();
401								$($id + ' .hnmenu').removeClass("choice");
402								$($id + ' .hnmenu').attr('aria-expanded', 'false');
403								$($id + ' .openmenu').attr('aria-hidden', 'true');
404								$($id).addClass("pscatenone");
405								// フォーカストラップを解除
406								$($id + ' .openmenu').find('*').off('.bottomnavitrap');
407								$($id + ' .openmenu').off('.bottomnavitrap');
408								$($id + ' .hnmenu').off('.bottomnavibutton');
409								bodyopen();
410								//closeText();
411							}
412						};
413						//smpmenuをクリックしたときに他を閉じる
414						$('#jssmpbtmnavi #smpmenu .hnmenu').off('click.menuswitch').on('click.menuswitch', function() {
415							menuSwitch("#jssmpbtmnavi #smpmenup1");
416							menuSwitch("#jssmpbtmnavi #smpmenup2");
417						});
418						//smpmenup1をクリックしたときに他を閉じる
419						$('#jssmpbtmnavi #smpmenup1 .hnmenu').off('click.menuswitch').on('click.menuswitch', function() {
420							menuSwitch("#jssmpbtmnavi #smpmenu");
421							menuSwitch("#jssmpbtmnavi #smpmenup2");
422						});
423						//smpmenup2をクリックしたときに他を閉じる
424						$('#jssmpbtmnavi #smpmenup2 .hnmenu').off('click.menuswitch').on('click.menuswitch', function() {
425							menuSwitch("#jssmpbtmnavi #smpmenu");
426							menuSwitch("#jssmpbtmnavi #smpmenup1");
427						});
428					}
429				});
430				
431				// モード切替後:メニューが開いていた場合はフォーカストラップを再設定
432				if(isMenuOpen && $('body').hasClass('viewmode_smp')){
433					setTimeout(function() {
434						setupBottomNaviFocusTrap($currentButton);
435					}, 100);
436				}
437			});
438			
439			if($("body").hasClass("pcopen")){
440				$("body").removeClass("pcopen");
441				var currentFontSize = $("body").css("font-size");
442				$("body").removeAttr("style");
443				if(currentFontSize){
444					$("body").css("font-size", currentFontSize);
445				}
446			}
447			
448		}
449		
450		//閉じるボタンを押したら閉じる
451		$('#jssmpbtmnavi .psclose, #jssmpbtmnavi .hnclose').on('click keydown', null, function(e) {
452			// Enterキーまたはマウスクリックのみ処理
453			if (e.type === 'keydown' && e.keyCode !== 13) {
454				return;
455			}
456			e.preventDefault();
457			e.stopPropagation();
458			
459			var $menu = $(this).parent();
460			var $menuButton = $menu.prev('.hnmenu');
461			
462			// フォーカストラップのイベントを解除(bodyopenの二重実行を防止)
463			$menu.find('*').off('.bottomnavitrap');
464			$menu.off('.bottomnavitrap');
465			$menuButton.off('.bottomnavibutton');
466			
467			// キーボード操作の場合のみフォーカスを移動
468			if (e.type === 'keydown') {
469				$menuButton.focus();
470			}
471			
472			bodyopen();
473			$menu.slideUp();
474
475			$menuButton.removeClass("choice");
476			$menuButton.attr('aria-expanded', 'false');
477			$menu.attr('aria-hidden', 'true');
478			$menuButton.parents('.bmenu').addClass("pscatenone");
479			//closeText();
480		});
481
482	}
483}
484
485// ボトムナビ用フォーカストラップの設定関数
486function setupBottomNaviFocusTrap($menuButton) {
487	var $menu = $menuButton.next('.openmenu');
488	var menuId = $menu.attr('id');
489	
490	// 既存のイベントを削除(重複登録を防ぐ)
491	$menu.find('*').off('focusout.bottomnavitrap');
492	$menu.find('*').off('keydown.bottomnavitrap');
493	$menuButton.off('keydown.bottomnavibutton');
494	
495	// メニュー内の「フォーカス可能要素」を取得
496	var $focusableElements = $menu.find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible');
497	var $lastFocusable = $focusableElements.last();
498	
499	// Escapeキー:メニューボタンで押された場合
500	$menuButton.on('keydown.bottomnavibutton', function(event) {
501		// Escape
502		if (event.keyCode === 27 && $menuButton.hasClass("choice")) {
503			event.preventDefault();
504			
505			// メニューを閉じてフォーカスをボタンに戻す
506			$menu.slideUp();
507			$menuButton.removeClass("choice");
508			$menuButton.attr('aria-expanded', 'false');
509			$menu.attr('aria-hidden', 'true');
510			$menu.parent().addClass("pscatenone");
511			bodyopen();
512			
513			// フォーカスは既にボタンにある
514		}
515		
516		// Shift + Tab
517		else if (event.shiftKey && event.keyCode === 9 && $menuButton.hasClass("choice")) {
518			event.preventDefault();
519			
520			// メニューを閉じる
521			$menu.slideUp();
522			$menuButton.removeClass("choice");
523			$menuButton.attr('aria-expanded', 'false');
524			$menu.attr('aria-hidden', 'true');
525			$menu.parent().addClass("pscatenone");
526			bodyopen();
527			
528			// 前の要素に自然にフォーカス
529			setTimeout(function() {
530				var $allFocusable = $('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible');
531				var currentIndex = $allFocusable.index($menuButton);
532				if (currentIndex > 0) {
533					$allFocusable.eq(currentIndex - 1).focus();
534				}
535			}, 10);
536		}
537	});
538	
539	// Escapeキー:メニュー内で押された場合
540	$menu.on('keydown.bottomnavitrap', function(event) {
541		if (event.keyCode === 27) {
542			event.preventDefault();
543			
544			// メニューボタンにフォーカスを戻してから閉じる
545			$menuButton.focus();
546			
547			$menu.slideUp();
548			$menuButton.removeClass("choice");
549			$menuButton.attr('aria-expanded', 'false');
550			$menu.attr('aria-hidden', 'true');
551			$menu.parent().addClass("pscatenone");
552			bodyopen();
553		}
554	});
555	
556	// Tab:最後の要素から抜けた場合
557	$lastFocusable.on('focusout.bottomnavitrap', function(event) {
558		setTimeout(function() {
559			var activeElement = $(document.activeElement);
560			
561			// メニュー外に出たらメニューを閉じる(フォーカスは自然に次の要素へ)
562			if (!activeElement.closest('#' + menuId).length && !activeElement.is($menuButton)) {
563				$menu.slideUp();
564				$menuButton.removeClass("choice");
565				$menuButton.attr('aria-expanded', 'false');
566				$menu.attr('aria-hidden', 'true');
567				$menu.parent().addClass("pscatenone");
568				bodyopen();
569			}
570		}, 10);
571	});
572}
573//--- ▲関数 ----------------------------
574
575function bottomNaviSet() {
576
577	// グローバルナビ ドロップダウンメニュー
578	if($('#jssmpbtmnavi').length){
579		//ボトムナビの高さを[ウインドウサイズ]―[メニューボタン下部]までã
579®è·é›¢ã«ã™ã‚‹
580		// ロードとリサイズ時の処理
581		$(window).on('load orientationchange resize',function() {
582			gnavismpheight();
583			//bottom_view_change();
584		});
585		
586		gnavismpheight();
587	}
588}
589//▲ ボトムナビ
590
591//▼ 要素複製
592function CLONE() {
593	var clone_e = CLONE_E;
594	var clone = ''; //複製要素保存用
595	if(!clone_e || clone_e.length <= 0) return false;
596	$.each(clone_e,function(){
597		//複製処理
598		if(this.move && this.move[1] && $(this.elem).length){
599			clone = $(this.elem).clone();
600			if(clone.hasClass('pconly')){
601				clone = clone.removeClass('pconly');
602			}
603			if(clone.hasClass('smponly')){
604				clone = clone.removeClass('smponly');
605			}
606			if(this.only=='pc'){
607				clone = clone.addClass('pconly');
608			}else if(this.only=='smp'){
609				clone = clone.addClass('smponly');
610			}
611			switch(this.move[1]){
612				case("append"): $(this.move[0]).append(clone);break;
613				case("prepend"): $(this.move[0]).prepend(clone);break;
614				case("after"): $(this.move[0]).after(clone);break;
615				case("before"): $(this.move[0]).before(clone);break;
616			}
617		}
618	});
619}
620//▲ 要素複製
621
622//▼ 要素移動
623function ELEMENT(mode) {
624	var element = MOVE_E;
625	if(!element || element.length <= 0) return false;
626	$.each(element,function(){
627		if(this[mode] && this[mode][1] && $(this.elem).length){
628			switch(this[mode][1]){
629				case("append"): $(this[mode][0]).append($(this.elem));break;
630				case("prepend"): $(this[mode][0]).prepend($(this.elem));break;
631				case("after"): $(this[mode][0]).after($(this.elem));break;
632				case("before"): $(this[mode][0]).before($(this.elem));break;
633			}
634		}
635	});
636}
637//▲ 要素移動
638
639//▼ CSS切替
640function CSSchange(){
641	var pc_hrefcss = "";
642	var smp_hrefcss = "";
643	var smp_mediacss = "";
644	if($.cookie('smp_mode')=="smp"){
645		for(let cs = 0;cs < 2;cs++){
646			if($(css_pcary[cs]).length && $(css_smpary[cs]).length){
647				if($(css_pcary[cs]).attr('name') == undefined){
648					$(css_pcary[cs]).attr('name','');
649				}
650				if($(css_smpary[cs]).attr('name') == undefined){
651					$(css_smpary[cs]).attr('name','');
652				}
653				if($(css_pcary[cs]).attr('href').length && !($(css_pcary[cs]).attr('name').length)){
654					pc_hrefcss = $(css_pcary[cs]).attr('href');
655					$(css_pcary[cs]).attr('href','');
656					$(css_pcary[cs]).attr('name',pc_hrefcss);
657				}
658				if($(css_smpary[cs]).attr('href').length && $(css_smpary[cs]).attr('media').length && !($(css_smpary[cs]).attr('name').length)){
659					smp_mediacss = $(css_smpary[cs]).attr('media');
660					$(css_smpary[cs]).attr('media','');
661					$(css_smpary[cs]).attr('name',smp_mediacss);
662				} else if($(css_smpary[cs]).attr('media').length && $(css_smpary[cs]).attr('name').length && !($(css_smpary[cs]).attr('href').length)){
663					smp_hrefcss = $(css_smpary[cs]).attr('media');
664					$(css_smpary[cs]).attr('media','');
665					$(css_smpary[cs]).attr('href',smp_hrefcss);
666				}
667			}
668		}
669	}else if($.cookie('smp_mode')=="pc"){
670		for(let cs = 0;cs < 2;cs++){
671			if($(css_pcary[cs]).length && $(css_smpary[cs]).length){
672				if($(css_pcary[cs]).attr('name') == undefined){
673					$(css_pcary[cs]).attr('name','');
674				}
675				if($(css_smpary[cs]).attr('name') == undefined){
676					$(css_smpary[cs]).attr('name','');
677				}
678				if(!($(css_pcary[cs]).attr('href').length) && $(css_pcary[cs]).attr('name').length){
679					pc_hrefcss = $(css_pcary[cs]).attr('name');
680					$(css_pcary[cs]).attr('name','');
681					$(css_pcary[cs]).attr('href',pc_hrefcss);
682				}
683				if($(css_smpary[cs]).attr('href').length && $(css_smpary[cs]).attr('name').length && !$(css_smpary[cs]).attr('media').length){
684					smp_hrefcss = $(css_smpary[cs]).attr('href');
685					$(css_smpary[cs]).attr('href','');
686					$(css_smpary[cs]).attr('media','');
687					$(css_smpary[cs]).attr('media',smp_hrefcss);
688				}
689			}
690		}
691	}
692}
693//▲ CSS切替
694
695//▼ 表を横スクロール
696function Tablescroll(mode){
697	var tables = $('table');
698	if (typeof tables == 'undefined' || !tables) return;
699	
700	if (tables.length > 0 && !$('#eventcalendar').length && !$('#form1').length && !$('#map').length && !$('#googlesearch').length){
701		var resizeTimer;
702		var tableCounter = 0; // テーブル連番用カウンター
703		
704		function adjustTables() {
705			tableCounter = 0; // カウンターリセット
706			tables.each(function(){
707				var $table = $(this);
708				var $wrapper = $table.parent('.tablewrap');
709				
710				// テーブルの親要素から#content、#content2、#content3のいずれかを検索
711				var $contentParent = $table.closest('#content, #content2, #content3');
712				// 親ボックスの横幅を取得
713				var winWidth = $contentParent.length ? $contentParent.innerWidth() : $(window).width();
714				
715				// テーブルにIDがなければ付与
716				var tableId = $table.attr('id');
717				if (!tableId) {
718					tableId = 'scrolltable' + (++tableCounter);
719					$table.attr('id', tableId);
720				}
721				
722				if ($wrapper.length === 0) {
723					$table.wrap('<div class="tablewrap tablenormal">');
724					$wrapper = $table.parent('.tablewrap');
725				}
726				
727				if($table.outerWidth(true) < winWidth){
728					$wrapper.removeClass('tablescroll').addClass('tablenormal');
729					$wrapper.find('.tsbutton').remove();
730				} else {
731					$wrapper.removeClass('tablescroll').addClass('tablenormal');
732					if ($wrapper.find('.tsbutton').length === 0) {
733						$('<button class="tsbutton" aria-controls="' + tableId + '" aria-pressed="false">表の横スクロールを有効にする</button>').insertBefore($table);
734					}
735				}
736			});
737		}
738		
739		// 初期調整
740		adjustTables();
741		
742		// リサイズ時の調整 - 既存のイベントリスナーを解除してから再設定
743		$(window).off('orientationchange.tablescroll resize.tablescroll').on('orientationchange.tablescroll resize.tablescroll', function() {
744			clearTimeout(resizeTimer);
745			resizeTimer = setTimeout(function() {
746				adjustTables();
747			}, 200); // 200ミリ秒後に実行
748		});
749		
750		// クリックイベントも名前空間付きで設定し直し
751		$(document).off('click.tablescroll', '.tablewrap .tsbutton').on('click.tablescroll', '.tablewrap .tsbutton', function() {
752			var isScrollMode = $(this).parent('.tablewrap').hasClass('tablescroll');
753			// 状態に応じてaria-pressedとaria-labelを切り替え
754			if (isScrollMode) {
755				$(this).attr('aria-pressed', 'false').text('表の横スクロールを有効にする');
756			} else {
757				$(this).attr('aria-pressed', 'true').text('表の横スクロールを解除する');
758			}
759			$(this).parent('.tablewrap').toggleClass("tablescroll").toggleClass("tablenormal");
760		});
761	}
762}
763//▲ 表を横スクロール
764
765//▼ 行政サイト ヘッダー固定
766//緊急情報の開閉時にも呼び出せるようグローバルに公開
767var updateHeaderFloat = function(){};
768
769function gyoseiHeader(mode){
770	if($('#wrap #header').length){
771		var floatingContent = $("#topheaderbg #headerinner , #headerbg #headerinner");	//フロートする要素
772		var $toppageContent = $("#toppagebody, #pagebody #tpath");	//通常時の先頭要素
773		var $kinkyuArea = $("#kinkyuarea");	//緊急情報エリア
774		var heightH = floatingContent.outerHeight();
775		
776		//▼追加:表示状態に応じて「フロート後に先頭になる要素」を判定
777		function getFirstContent(){
778			if($kinkyuArea.length && $kinkyuArea.is(':visible')){
779				return $kinkyuArea;
780			}
781			return $toppageContent;
782		}
783		
784		//if(mode=="pc"){
785
786			// URLにハッシュが含まれている場合に実行
787			if(location.hash && $('#googlecontent').length == 0){
788					var target2 = $(location.hash);
789					var position2 = target2.offset().top - heightH;
790					$('html, body').animate({scrollTop: position2}, 500, 'swing');
791			}
792			
793			//▼変更:margin-top制御を関数化し、グローバル変数updateHeaderFloatに代入
794			//    (緊急情報の開閉クリック時にも呼び出せるようにする)
795			updateHeaderFloat = function(){
796				var value = $(window).scrollTop();
797				var headH = floatingContent.outerHeight();
798				var $firstContent = getFirstContent();
799				
800				//対象外になった要素のmargin-topをリセット(両方クリアしてから付与)
801				$toppageContent.css('margin-top', '');
802				if($kinkyuArea.length){
803					$kinkyuArea.css('margin-top', '');
804				}
805				
806				if (value > headH) {
807					floatingContent.addClass("headerfixed");
808					$firstContent.css('margin-top', headH);
809				} else {
810					floatingContent.removeClass("headerfixed");
811					$firstContent.css('margin-top', '0px');
812				}
813			};
814			
815			//追従ヘッダーの分を空けつつスムーススクロール
816			$(window).off('scroll.headscroll load.headscroll').on('load.headscroll scroll.headscroll', function() {
817				updateHeaderFloat();
818			});
819			
820			//▼追加:初期表示時にも一度実行(ページロード直後、リサイズ時のモード切替時など)
821			updateHeaderFloat();
822			
823		//}else{
824		//	$(window).off('scroll.headscroll');
825		//	floatingContent.removeClass("headerfixed");
826		//	$toppageContent.css('margin-top', '');
827		//	if($kinkyuArea.length){
828		//		$kinkyuArea.css('margin-top', '');
829		//	}
830		//	//▼追加:スマホモードでは無効化
831		//	updateHeaderFloat = function(){};
832		//}
833		
834		//クリックイベントを実行 タブ.jsは除外
835		$('a[href^="#"]').not('.ui-tabs-anchor').off('click').on('click', AnchorScroll);
836		function AnchorScroll(){
837			if($(this).attr('href') != "#wrap" && !$(this).hasClass('ui-tabs-anchor')){
838				var speed = 500;
839				var href = $(this).attr("href");
840				if(href == "#" || href == ""){
841					var target = href;
842				}else if(href.indexOf("#") !== -1){
843					var target = href.substring(href.indexOf("#"),href.length);
844					if($(target).length){
845						if(mode=="pc"){
846							var position = $(target).offset().top - heightH;
847						}else{
848							var position = $(target).offset().top;
849						}
850						$('body,html').animate({scrollTop:position}, speed, 'swing');
851					}
852				}
853			}
854		}
855	}
856	//メニューの高さ(変更なし)
857	if($('#wrap #dropdownmenu').length){
858		if(mode=="pc"){
859			var $menuButton = $("#smpmenup2bg .bmenu > button");
860			var $dropMenus = $('#wrap #header #smpmenup1menu, #wrap #header #emergencymenu');
861			
862			function dropHeightSet(){
863			    if($('body').hasClass('viewmode_pc')){
864			        var winHeight = $(window).outerHeight();
865			        var heightH2 = $menuButton[0].getBoundingClientRect().bottom;
866			        var dropHeight = winHeight - heightH2;
867			        $dropMenus.css('height', winHeight);
868			    }
869			}
870			
871			dropHeightSet();
872			
873			$(window).off('load.dropheight').on('load.dropheight', function(){
874				dropHeightSet();
875			});
876			
877			$(window).off('orientationchange.dropheight resize.dropheight').on('orientationchange.dropheight resize.dropheight',function(){
878				setTimeout(function() {
879					dropHeightSet();
880				}, 100);
881				setTimeout(function() {
882					dropHeightSet();
883				}, 1000);
884			});
885			
886			$('[onclick*="fsChange"]').off('click.fschange').on('click.fschange', function(){
887				setTimeout(function(){
888					dropHeightSet();
889				}, 100);
890			});
891		}
892	}
893
894}
895//▲ 行政サイト ヘッダー固定
896
897//▼ pconly、smponlyの表示切替
898function viewModeChange(mode) {
899	if(mode=="smp"){
900		$('.pconly').each(function(){
901			$(this).hide();
902		});
903		$('.smponly').each(function(){
904			$(this).show();
905		});
906	}else if(mode=="pc"){
907		$('.pconly').each(function(){
908			$(this).show();
909		});
910		$('.smponly').each(function(){
911			$(this).hide();
912		});
913	}
914}
915//▲ pconly、smponlyの表示切替
916
917//▼ smp.js
918function SMPjs(mode) {
919	if(mode=="smp"){
920		$('#viewmode_smp').attr('aria-current', 'page');
921		
922		//フッタにボトムナビの高さ分を挿入
923		if($('#jssmpbtmnavi').length){
924			var jbnh = $("#jssmpbtmnavi").outerHeight();
925			$("footer").css("padding-bottom",jbnh);
926			$("html").css("scroll-padding-bottom",jbnh);
927		}
928
929		//緊急情報があります
930		if($("#headkinkyumsg").length){
931			$headkinkyumsg = $('#headkinkyumsg');
932			$($headkinkyumsg).appendTo("#headerbg");
933		}
934		
935		//◆大規模災害:ドロップダウンメニュー
936		if($("#wrapbg").hasClass("saigai")){
937			//折りたたみ用の外枠、ボタン追加
938			$('#util , #utilmenuwrap').removeClass("pconly")
939			$('#util').wrap('<div id="smpmenu">').wrap('<div id="gnavismp" aria-hidden="true" class="clearfix">').removeClass("pconly");
940			$('<button class="hnplus" aria-controls="gnavismp" aria-expanded="false"><span>メニュー</span></button>').insertBefore('#gnavismp');
941			$('<button class="hnclose">閉じる</button>').appendTo('#gnavismp');
942			//折りたたみ処理
943			$('#gnavismp').each(function() {
944				var hnFlg = false;
945				var $this = $(this);
946				var $ul = $('#gnavismp');
947				var $button = $('#smpmenu > button');
948        
949				if($(this).children('*').hasClass("hnplus") ){
950					$ul.hide();
951					hnFlg = false;
952				}
953				//表示
954				$button.on('click',function() {
955					$('#smpmenu > button').toggleClass("hnplus").toggleClass("hnminus");
956					hnFlg = !hnFlg;
957					if(hnFlg){
958						$("#smpmenu").css('width','100%');
959						$("#smpmenu > button").attr('aria-expanded', 'true');
960						$("#gnavismp").attr('aria-hidden', 'false');
961					}
962					$ul.slideToggle('normal', function() {
963						if(!hnFlg){
964							$("#smpmenu").css('width','auto');
965							$("#smpmenu > button").attr('aria-expanded', 'false');
966							$("#gnavismp").attr('aria-hidden', 'true');
967						}
968					});
969					return false;
970				});
971				//閉じるボタン押下
972				$('button.hnclose').on('click',function() {
973					$('#smpmenu button').toggleClass("hnplus").toggleClass("hnminus");
974					hnFlg = !hnFlg;
975					$ul.slideToggle('normal', function() {
976							$("#smpmenu").css('width','auto');
977							$("#smpmenu button").attr('aria-expanded', 'false');
978							$("#gnavismp").attr('aria-hidden', 'true');
979					});
980					return false;
981				});
982			});
983		}
984		
985		// カルーセルB スマホの場合
986		if($("#scroll_b").length && $('body').hasClass('viewmode_smp')){
987			$(window).off('orientationchange.scrollb resize.scrollb');
988			$('#scroll_b .imgtxt').css("height","");
989		}		
990		
991	}else if(mode=="pc"){
992		$('#viewmode_pc').attr('aria-current', 'page');
993		
994		//緊急情報があります(元の位置不明)
995		if($("#headkinkyumsg").length){
996			$headkinkyumsg = $('#headkinkyumsg');
997			$($headkinkyumsg).appendTo("#headerbg");
998		}
999
1000		//フッタにボトムナビの高さ分を挿入
1001		if($('#jssmpbtmnavi').length){
1002			$("footer").css("padding-bottom","");
1003		}
1004
1005		// ◆大規模災害:ドロップダウンメニュー
1006		if ($("#wrapbg").hasClass("saigai") && $('body').hasClass('viewmode_pc')) {
1007
1008		    //スマホ用イベント解除
1009		    $('#smpmenu > button').off();
1010		    $('#smpmenu button.hnclose').off();
1011
1012		    //スマホ用ボタン削除
1013		    $('#smpmenu > button.hnplus, #smpmenu > button.hnminus').remove();
1014		    $('#smpmenu .hnclose').remove();
1015
1016		    //#util を元の位置へ戻す
1017		    if ($('#util').length && $('#gnavismp').length) {
1018		        $('#util').unwrap(); // #gnavismp を外す
1019		    }
1020
1021		    if ($('#util').length && $('#smpmenu').length) {
1022		        $('#util').unwrap(); // #smpmenu を外す
1023		    }
1024
1025		    //PC用クラスを復元
1026		    $('#utilmenuwrap').addClass('pconly');
1027		    $('#util').addClass('pconly');
1028
1029		    // #smpmenu が残っていたら削除
1030		    $('#smpmenu').remove();
1031		}
1032		
1033		// カルーセルB PCの場合
1034		if($("#scroll_b").length && $('body').hasClass('viewmode_pc')){
1035			//imgtxtの高さ
1036			$("#scroll_b .imgtxt").height($("#scroll_b .window").height() - 33);
1037			$(window).off('orientationchange.scrollb resize.scrollb').on('orientationchange.scrollb resize.scrollb', function(){
1038				$("#scroll_b .imgtxt").height($("#scroll_b .window").height() - 33);
1039			});
1040		}
1041	}
1042}
1043//▲ smp.js
1044})();
1045
1046//▼articleall
1047function ARTICLEALL(mode) {
1048	var $ = FI.jQuery;
1049	if(mode=="smp"){
1050		$('.articleall').each(function(){
1051			//折りたたみたくない要素にはクラス「.disp」を設定
1052			var $ul = $(this).children('*').not('.plus,.minus,.disp');
1053			if($(this).children('*').hasClass("plus") ){
1054				$ul.hide();
1055				$(this).children('.plus').attr('aria-expanded', 'false');
1056			} else if($(this).children('*').hasClass("minus") ){
1057				$(this).children('.minus').attr('aria-expanded', 'true');
1058			}
1059			//tabindexにフォーカス
1060			$('.articleall h2').attr('tabindex', '0');
1061			$('.opendata .articleall h3').attr('tabindex', '0');//オープンデータ
1062			$('.categoryfaq .articleall h3').attr('tabindex', '0');//FAQトップ
1063			$('.category.articleall h3').attr('tabindex', '0');//イベントポータル
1064			//開閉
1065			$('.plus,.minus',this).on('click keyup', function(e){
1066				if(e.keyCode == 13 || e.keyCode == null){
1067					if($('body').hasClass('viewmode_smp')){
1068						$(this).toggleClass("plus").toggleClass("minus");
1069						$ul.slideToggle();
1070						$(this).attr('aria-expanded', $(this).hasClass('minus') ? 'true' : 'false');
1071					}
1072				}
1073			});
1074		});
1075	}else if(mode=="pc"){
1076		$('.articleall').each(function(){
1077			$('.plus,.minus',this).off();
1078			//折りたたみたくない要素にはクラス「.disp」を設定
1079			var $ul = $(this).children('*').not('.plus,.minus,.disp');
1080			if($(this).children('*')){
1081				$ul.show();
1082			}
1083			//tabindexにフォーカス
1084			$('.articleall h2').removeAttr('tabindex');
1085			$('.opendata .articleall h3').removeAttr('tabindex');//オープンデータ
1086			$('.categoryfaq .articleall h3').removeAttr('tabindex');//FAQトップ
1087			$('.category.articleall h3').removeAttr('tabindex');//イベントポータル
1088			$('.plus,.minus',this).removeAttr('aria-expanded');
1089		});
1090	}
1091	
1092	//セカンドトップの開閉初期表示をスマホと分ける
1093	//if($('#second').length){
1094	//	if($('.pmbtn').length){
1095	//		$('.articleall2').each(function(){
1096	//			if(!$('h2',this).hasClass('none')){
1097	//				
1098	//				if(mode=="smp"){
1099	//					if(!$('h2',this).hasClass("plus2")){
1100	//						$('h2',this).addClass("plus2")
1101	//					}
1102	//					if($('h2',this).hasClass("minus2")){
1103	//						$('h2',this).removeClass("minus2")
1104	//					}
1105	//				}else if(mode=="pc"){
1106	//					if(!$('h2',this).hasClass("minus2")){
1107	//						$('h2',this).addClass("minus2")
1108	//					}
1109	//					if($('h2',this).hasClass("plus2")){
1110	//						$('h2',this).removeClass("plus2")
1111	//					}
1112	//				}
1113	//				
1114	//				var $ul = $(this).children('*').not('.plus2,.minus2,.disp2');
1115	//				if($('h2',this).hasClass("plus2") ){
1116	//					$ul.hide();
1117	//					$ul.attr('aria-hidden', 'true');
1118	//				}
1119	//				if($('h2',this).hasClass("minus2") ){
1120	//					$ul.show();
1121	//					$ul.attr('aria-hidden', 'false');
1122	//				}
1123	//				
1124	//				//開閉ボタン
1125	//				if($('h2',this).hasClass("minus2") ){
1126	//					$('.pmbtn',this).children('img').attr({
1127	//						src: $('.pmbtn',this).children('img').attr('src').replace('plus', 'minus'),
1128	//						alt: "閉じる"
1129	//					});
1130	//					$('.pmbtn',this).attr('aria-expanded', 'true');
1131	//					$ul.attr('aria-hidden', 'false');
1132	//				}else{
1133	//					$('.pmbtn',this).children('img').attr({
1134	//						src: $('.pmbtn',this).children('img').attr('src').replace('minus', 'plus'),
1135	//						alt: "開く"
1136	//					});
1137	//					$('.pmbtn',this).attr('aria-expanded', 'false');
1138	//					$ul.attr('aria-hidden', 'true');
1139	//				}
1140	//			}
1141	//		});
1142	//	}
1143	//}
1144}
1145//▲articleall
1146
1147//▼dropdown_menu
1148function dropdown_menu(mode){
1149	var $ = FI.jQuery;
1150	
1151	//---------------------------------------------------------------
1152    // 排他制御対象をmodeで切り替え
1153    // SMP時は翻訳(translation)を対象外にして独立動作にする
1154    var headerExclusiveMenus = (mode === "smp")
1155        ? ['#header #smpmenup1', '#header #smpmenup2', '#kinkyubtn']
1156        : ['#header #translation', '#header #sitesearch', '#header #smpmenup1', '#header #smpmenup2', '#kinkyubtn'];
1157	//---------------------------------------------------------------------------
1158	//指定したメニューが開いていれば閉じる
1159	function closeHeaderExclusiveMenu(id){
1160		
1161		//緊急情報
1162		if(id === '#kinkyubtn'){
1163			var $kp    = $('#kinkyubtn p');
1164			var $kbtn  = $('#kinkyubtn button');
1165			var $karea = $('#kinkyuarea');
1166
1167			if($kp.hasClass('active')){
1168				$karea.slideUp();
1169				$kp.removeClass('active');
1170				$kbtn.attr('aria-expanded', 'false');
1171				$karea.attr('aria-hidden', 'true');
1172			}
1173			return;
1174		}
1175		
1176		var $box    = $(id);
1177		var $btn    = $box.children('.hnmenu');
1178		var $menu   = $btn.next('.openmenu');
1179
1180		if($btn.hasClass('choice')){
1181			$menu.slideUp();
1182			$box.removeClass('choice');
1183			$btn.removeClass('choice');
1184			$btn.attr('aria-expanded', 'false');
1185			$menu.attr('aria-hidden', 'true');
1186			$box.addClass('pscatenone');
1187
1188			//smpmenup1/smpmenup2用:フォーカストラップの解除
1189			$menu.find('*').off('.menutrap');
1190			$menu.off('.menutrap');
1191			$btn.off('.menubutton');
1192
1193			//smpmenup1/smpmenup2用:body制御を元に戻す
1194			if(id === '#header #smpmenup1' || id === '#header #smpmenup2'){
1195				if($('body').hasClass('viewmode_smp')){
1196					bodyopen();
1197					gnavismpheight();
1198				}else{
1199					bodypcopen();
1200				}
1201			}
1202		}
1203	}
1204
1205	//自分以外の3つを閉じる
1206	function closeOtherHeaderExclusiveMenus(currentId){
1207		$.each(headerExclusiveMenus, function(i, id){
1208			if(id !== currentId){
1209				closeHeaderExclusiveMenu(id);
1210			}
1211		});
1212	}
1213	//---------------------------------------------------------------------------
1214	//グローバルナビドロップダウンメニュー
1215	
1216	$('.scate').not('#gnavismp .scate').each(function(){
1217		$('.tismenu',this).off();
1218		var $scate = $(this);
1219		var $ul = $(this).children('*').not('.tismenu');
1220		var target = $('.scate .navi').not('#gnavismp .navi');
1221		var target2 = $('.scate .tismenu').not('#gnavismp .tismenu');
1222		var target3 = $('.scate').not('#gnavismp .scate');
1223		if(mode=="pc"){
1224			$ul.hide();
1225			$('.tismenu',this).on('click', function() {
1226				//自分以外の処理
1227				var self = $(this).next("div");
1228				target.not(self).hide().prev().removeClass("choice");
1229				target3.not(self).removeClass("choice");
1230				target.not(self).hide().prev().children().attr('aria-expanded', 'false');
1231				target.not(self).hide().attr('aria-hidden', 'true');
1232				
1233				//自分の処理
1234				$ul.slideToggle();
1235				$(this).toggleClass("choice");
1236				//WAI-ARIA
1237				if($(this).hasClass("choice")){
1238					$(this).attr('aria-expanded', 'true');
1239					$(this).next().attr('aria-hidden', 'false');
1240					$(this).parent('li').addClass("choice");
1241				}else{
1242					$(this).attr('aria-expanded', 'false');
1243					$(this).next().attr('aria-hidden', 'true');
1244					$(this).parent('li').removeClass("choice");
1245				}
1246			});
1247			
1248			//.naviからフォーカスが外れたら閉じる
1249			$("#gnavi .navi ul li:last-child").on('focusout', function() {
1250				$ul.slideUp();
1251				$scate.removeClass("choice");
1252				$(".scate .tismenu").removeClass("choice");
1253				$(".scate .tismenu").attr('aria-expanded', 'false');
1254				$(target).attr('aria-hidden', 'true');
1255			});
1256			$("#translation ul li:last-child").on('focusout', function() {
1257				$ul.slideUp();
1258				$scate.removeClass("choice");
1259				$(".scate .tismenu").removeClass("choice");
1260				$(".scate .tismenu").attr('aria-expanded', 'false');
1261				$(target).attr('aria-hidden', 'true');
1262			});
1263			
1264			//閉じるボタン
1265			$('.gnaviclose').on('click', null, function() {
1266				$ul.slideUp();
1267				$scate.removeClass("choice");
1268				$(".scate .tismenu").removeClass("choice");
1269				$(".scate .tismenu").attr('aria-expanded', 'false');
1270				$(target).attr('aria-hidden', 'true');
1271			});
1272		}else if(mode=="smp"){
1273			$ul.show();
1274		}
1275	});
1276
1277	//---------------------------------------------------------------
1278	// 翻訳ドロップダウン(PC/SMP共通で開閉するが、排他制御はPCのみ)
1279	$('#header #translation.bmenu').each(function(){
1280	    $('.hnmenu',this).off();
1281	    $('.psclose',this).off();
1282
1283	    var $scate  = $(this);
1284	    var $ul     = $(this).children('*').not('.hnmenu, .psclose');
1285	    var $menuId = '#header #' + $scate.attr('id');
1286
1287	    $ul.hide();
1288
1289	    $('.hnmenu',this).on('click', function() {
1290	        $ul.slideToggle();
1291	        $(this).toggleClass("choice");
1292
1293	        if($(this).hasClass("choice")){
1294	            $scate.addClass("choice");
1295	            $(this).attr('aria-expanded', 'true');
1296	            $(this).next().attr('aria-hidden', 'false');
1297
1298	            //▼PCのときだけ他メニューを閉じる。SMPは独立動作にする
1299	            if(mode === "pc"){
1300	                closeOtherHeaderExclusiveMenus($menuId);
1301	            }
1302	        }else{
1303	            $scate.removeClass("choice");
1304	            $(this).attr('aria-expanded', 'false');
1305	            $(this).next().attr('aria-hidden', 'true');
1306	        }
1307	    });
1308
1309	    // psclose、focusout処理は既存のまま移植
1310	    $('.psclose',this).on('click keydown', function(e){
1311	        if (e.type === 'keydown' && e.keyCode !== 13) return;
1312	        e.preventDefault();
1313	        e.stopPropagation();
1314	        var $menuButton = $scate.children('.hnmenu');
1315	        $ul.slideUp();
1316	        $scate.removeClass('choice');
1317	        $menuButton.removeClass('choice').attr('aria-expanded', 'false');
1318	        $ul.attr('aria-hidden', 'true');
1319	        if(e.type === 'keydown'){ $menuButton.focus(); }
1320	    });
1321	});
1322
1323	//---------------------------------------------------------------
1324	// 検索:PCのみ開閉、SMPは常時表示(フォームをそのまま出す)
1325	$('#header #sitesearch.bmenu').each(function(){
1326	    var $scate   = $(this);
1327	    var $btn     = $scate.children('.hnmenu');
1328	    var $ul      = $(this).children('*').not('.hnmenu, .psclose');
1329	    var $psclose = $scate.find('.psclose');
1330
1331	    $btn.off();
1332	    $psclose.off();
1333
1334	    if(mode === "smp"){
1335	        //▼開閉をやめて常時表示
1336	        $ul.show().removeAttr('style').attr('aria-hidden', 'false');
1337	        $btn.hide();       // ボタン自体は不要(CSSでpconly指定でも可)
1338	        $psclose.hide();   // 閉じるボタンも不要
1339	        $scate.removeClass('choice');
1340	    }else{
1341	        //▼PC:従来通りの開閉
1342	        $ul.hide();
1343	        $btn.show();
1344	        $psclose.show();
1345
1346	        $btn.on('click', function(){
1347	            $ul.slideToggle();
1348	            $(this).toggleClass("choice");
1349	            if($(this).hasClass("choice")){
1350	                $scate.addClass("choice");
1351	                $(this).attr('aria-expanded', 'true');
1352	                $ul.attr('aria-hidden', 'false');
1353	                closeOtherHeaderExclusiveMenus('#header #sitesearch');
1354	            }else{
1355	                $scate.removeClass("choice");
1356	                $(this).attr('aria-expanded', 'false');
1357	                $ul.attr('aria-hidden', 'true');
1358	            }
1359	        });
1360
1361	        $psclose.on('click keydown', function(e){
1362	            if (e.type === 'keydown' && e.keyCode !== 13) return;
1363	            e.preventDefault();
1364	            e.stopPropagation();
1365	            $ul.slideUp();
1366	            $scate.removeClass('choice');
1367	            $btn.removeClass('choice').attr('aria-expanded', 'false');
1368	            $ul.attr('aria-hidden', 'true');
1369	            if(e.type === 'keydown'){ $btn.focus(); }
1370	        });
1371	    }
1372	});
1373	//---------------------------------------------------------------
1374	//緊急情報(#kinkyubtn ⇔ #kinkyuarea)
1375	if($('#kinkyubtn').length && $('#kinkyuarea').length){
1376
1377	    var $kinkyuBtn  = $('#kinkyubtn button');
1378	    var $kinkyuP    = $('#kinkyubtn p');
1379	    var $kinkyuArea = $('#kinkyuarea');
1380	    var $menuBtn    = $('#smpmenup2 .hnmenu');
1381
1382	    $kinkyuBtn.off('click.kinkyu keydown.kinkyufocus');
1383	    $kinkyuArea.off('keydown.kinkyufocus');
1384	    $kinkyuArea.find('.psclose').off('click.kinkyu keydown.kinkyu');
1385	    $menuBtn.off('keydown.kinkyufocus');
1386
1387	    if($kinkyuP.hasClass('active')){
1388	        $kinkyuArea.attr('aria-hidden', 'false');
1389	    }else{
1390	        $kinkyuArea.hide().attr('aria-hidden', 'true');
1391	    }
1392
1393	    //▼変更:slideToggleのコールバックでupdateHeaderFloatを呼ぶ
1394	    $kinkyuBtn.on('click.kinkyu', function(){
1395	        $kinkyuArea.slideToggle(function(){
1396	            if(typeof updateHeaderFloat === 'function'){
1397	                updateHeaderFloat();
1398	            }
1399	        });
1400	        $kinkyuP.toggleClass('active');
1401
1402	        if($kinkyuP.hasClass('active')){
1403	            $(this).attr('aria-expanded', 'true');
1404	            $kinkyuArea.attr('aria-hidden', 'false');
1405	            closeOtherHeaderExclusiveMenus('#kinkyubtn');
1406	        }else{
1407	            $(this).attr('aria-expanded', 'false');
1408	            $kinkyuArea.attr('aria-hidden', 'true');
1409	        }
1410	    });
1411
1412	    function getKinkyuFocusable(){
1413	        return $kinkyuArea
1414	            .find('a, button, input, select, textarea, [tabindex]:not
1414([tabindex="-1"])')
1415	            .filter(':visible');
1416	    }
1417
1418	    $kinkyuBtn.on('keydown.kinkyufocus', function(e){
1419	        if(e.keyCode === 9 && !e.shiftKey && $kinkyuP.hasClass('active')){
1420	            var $focusable = getKinkyuFocusable();
1421	            if($focusable.length){
1422	                e.preventDefault();
1423	                $focusable.first().focus();
1424	            }
1425	        }
1426	    });
1427
1428	    $kinkyuArea.on('keydown.kinkyufocus', 'a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])', function(e){
1429	        var $focusable = getKinkyuFocusable();
1430	        var $first = $focusable.first();
1431	        var $last  = $focusable.last();
1432
1433	        if(e.keyCode === 9 && !e.shiftKey && $(this).is($last)){
1434	            e.preventDefault();
1435	            $menuBtn.focus();
1436	        }
1437	        else if(e.keyCode === 9 && e.shiftKey && $(this).is($first)){
1438	            e.preventDefault();
1439	            $kinkyuBtn.focus();
1440	        }
1441	    });
1442
1443	    $menuBtn.on('keydown.kinkyufocus', function(e){
1444	        if(e.keyCode === 9 && e.shiftKey && $kinkyuP.hasClass('active')){
1445	            var $focusable = getKinkyuFocusable();
1446	            if($focusable.length){
1447	                e.preventDefault();
1448	                $focusable.last().focus();
1449	            }
1450	        }
1451	    });
1452
1453	    //▼変更:閉じるボタンでもupdateHeaderFloatを呼ぶ
1454	    $kinkyuArea.find('.psclose').on('click.kinkyu keydown.kinkyu', function(e){
1455	        if (e.type === 'keydown' && e.keyCode !== 13) {
1456	            return;
1457	        }
1458	        e.preventDefault();
1459	        e.stopPropagation();
1460
1461	        $kinkyuArea.slideUp(function(){
1462	            if(typeof updateHeaderFloat === 'function'){
1463	                updateHeaderFloat();
1464	            }
1465	        });
1466	        $kinkyuP.removeClass('active');
1467	        $kinkyuBtn.attr('aria-expanded', 'false');
1468	        $kinkyuArea.attr('aria-hidden', 'true');
1469
1470	        if(e.type === 'keydown'){
1471	            $kinkyuBtn.focus();
1472	        }
1473	    });
1474	}
1475	//---------------------------------------------------------------------------
1476	//【行政】いざというとき/目的別検索(PC/スマホ)
1477	$('#header #smpmenup1.bmenu , #header #smpmenup2.bmenu').each(function(){
1478
1479		var $bmenu       = $(this);
1480		var $menuButton  = $bmenu.children('.hnmenu');      // ★直下のみ
1481		var $openMenu    = $bmenu.children('.openmenu');    // ★直下のみ(#smpmenup1menu)
1482		var $psclose     = $openMenu.children('.psclose');  // ★直下のみ(翻訳/検索のpscloseは含まれない)
1483
1484		$menuButton.off();
1485		$psclose.off();
1486
1487		if(!$menuButton.hasClass("view_pc")){
1488			$menuButton.addClass("view_pc");
1489			$menuButton.removeClass("choice");
1490			$menuButton.attr('aria-expanded', 'false');
1491			$openMenu.attr('aria-hidden', 'true');
1492		}
1493		if($menuButton.hasClass("view_smp")){
1494			$menuButton.removeClass("view_smp");
1495		}
1496
1497		var $ul2 = $openMenu; // 直下のopenmenuのみを開閉対象に
1498
1499		var isMenuOpen     = $menuButton.hasClass('choice');
1500		var $currentButton = $menuButton;
1501
1502		if(!$menuButton.hasClass('choice')){
1503			$ul2.hide();
1504			$bmenu.toggleClass("pscatenone");
1505		}
1506
1507		$menuButton.on('click', function() {
1508			$ul2.slideToggle();
1509			$menuButton.toggleClass("choice");
1510			$bmenu.toggleClass("pscatenone");
1511
1512			if(!$menuButton.hasClass("choice")){
1513				$menuButton.attr('aria-expanded', 'false');
1514				$ul2.attr('aria-hidden', 'true');
1515			} else {
1516				$menuButton.attr('aria-expanded', 'true');
1517				$ul2.attr('aria-hidden', 'false');
1518				setupFocusTrap($menuButton);
1519				closeOtherHeaderExclusiveMenus('#header #' + $bmenu.attr('id'));
1520			}
1521
1522			if($('body').hasClass('viewmode_smp')){
1523				bodyopen();
1524				gnavismpheight();
1525			}else{
1526				bodypcopen();
1527			}
1528
1529			//他を閉じる(変更なし)
1530			menuSwitch = function($id){
1531				if($('#' + $id + ' .hnmenu').hasClass('choice')){
1532					$('#' + $id + '.bmenu').children('.openmenu').slideUp();
1533					$('#' + $id + '.bmenu').children('.hnmenu').removeClass("choice").attr('aria-expanded', 'false');
1534					$('#' + $id + '.bmenu').children('.openmenu').attr('aria-hidden', 'true');
1535					$('#' + $id + '.bmenu').addClass("pscatenone");
1536					$('#' + $id + ' .openmenu').find('*').off('.menutrap');
1537					$('#' + $id + ' .openmenu').off('.menutrap');
1538					$('#' + $id + ' .hnmenu').off('.menubutton');
1539					if($('body').hasClass('viewmode_smp')){
1540						bodyopen();
1541						gnavismpheight();
1542					}else{
1543						bodypcopen();
1544					}
1545				}
1546			};
1547
1548			if($('body').hasClass('viewmode_smp')){
1549				$('#smpmenu .hnmenu').off('click.menuswitch').on('click.menuswitch', function() {
1550					menuSwitch("smpmenup1");
1551					menuSwitch("smpmenup2");
1552				});
1553			}
1554			$('#smpmenup1').children('.hnmenu').off('click.menuswitch').on('click.menuswitch', function() {
1555				menuSwitch("smpmenup2");
1556			});
1557			$('#smpmenup2').children('.hnmenu').off('click.menuswitch').on('click.menuswitch', function() {
1558				menuSwitch("smpmenup1");
1559			});
1560		});
1561
1562		//閉じるボタン(直下のpscloseのみ対象)
1563		$psclose.on('click keydown', null, function(e) {
1564			if (e.type === 'keydown' && e.keyCode !== 13) return;
1565			e.preventDefault();
1566			e.stopPropagation();
1567
1568			$menuButton.off('keydown.menubutton');
1569			$openMenu.find('*').off('.menutrap');
1570			$openMenu.off('.menutrap');
1571
1572			if (e.type === 'keydown') {
1573				$menuButton.focus();
1574			}
1575
1576			$ul2.slideUp();
1577			$menuButton.removeClass("choice").attr('aria-expanded', 'false');
1578			$ul2.attr('aria-hidden', 'true');
1579
1580			if($('body').hasClass('viewmode_smp')){
1581				bodyopen();
1582				gnavismpheight();
1583			}else{
1584				bodypcopen();
1585			}
1586		});
1587
1588		if(mode=="pc" && isMenuOpen){
1589			setTimeout(function() {
1590				setupFocusTrap($currentButton);
1591			}, 100);
1592		}
1593		
1594		// フォーカストラップの設定関数
1595		function setupFocusTrap($menuButton) {
1596			var $menu = $menuButton.next('.openmenu');
1597			var menuId = $menu.attr('id');
1598			
1599			$menu.find('*').off('focusout.menutrap keydown.menutrap');
1600			$menuButton.off('keydown.menubutton');
1601			
1602			var $focusableElements = $menu.find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible');
1603			var $lastFocusable = $focusableElements.last();
1604			
1605			//▼共通化:閉じる処理をまとめる
1606			function closeThisMenu(){
1607				$menu.slideUp();
1608				$menuButton.removeClass("choice");
1609				$menuButton.attr('aria-expanded', 'false');
1610				$menu.attr('aria-hidden', 'true');
1611				$menu.parent().addClass("pscatenone");
1612
1613				//▼修正:4箇所すべてここを通すことで統一
1614				if($('body').hasClass('viewmode_smp')){
1615					bodyopen();
1616					gnavismpheight();
1617				}else{
1618					bodypcopen();
1619				}
1620			}
1621			
1622			// ①② Escape / Shift+Tab:メニューボタンで押された場合
1623			$menuButton.on('keydown.menubutton', function(event) {
1624				if (event.keyCode === 27 && $menuButton.hasClass("choice")) {
1625					event.preventDefault();
1626					closeThisMenu();
1627				}
1628				else if (event.shiftKey && event.keyCode === 9 && $menuButton.hasClass("choice")) {
1629					event.preventDefault();
1630					closeThisMenu();
1631					
1632					setTimeout(function() {
1633						var $allFocusable = $('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible');
1634						var currentIndex = $allFocusable.index($menuButton);
1635						if (currentIndex > 0) {
1636							$allFocusable.eq(currentIndex - 1).focus();
1637						}
1638					}, 10);
1639				}
1640			});
1641			
1642			// ③ Escape:メニュー内で押された場合
1643			$menu.on('keydown.menutrap', function(event) {
1644				if (event.keyCode === 27) {
1645					event.preventDefault();
1646					$menuButton.focus();
1647					closeThisMenu();
1648				}
1649			});
1650			
1651			// ④ Tab:最後の要素から抜けた場合(.pscloseがここに該当)
1652			$lastFocusable.on('focusout.menutrap', function(event) {
1653				setTimeout(function() {
1654					var activeElement = $(document.activeElement);
1655					if (!activeElement.closest('#' + menuId).length && !activeElement.is($menuButton)) {
1656						closeThisMenu();
1657					}
1658				}, 10);
1659			});
1660		}
1661	});
1662
1663}
1664//▲dropdown_menu
1665
1666//▼common.js
1667(function(){
1668	var $ = FI.jQuery;
1669	$(function() {
1670		//本文へ
1671		$("#blockskip a").on('focus',function(){
1672			$(this).addClass("show");
1673		});
1674		$("#blockskip a").on('blur',function(){
1675			$(this).removeClass("show");
1676		});
1677		//ハッシュを使わずにスクロール
1678		$('a[href="#HONBUN"]').on('click', function(e) {
1679			e.preventDefault();
1680			var $target = $('#HONBUN');
1681			if ($target.length) {
1682				$target[0].scrollIntoView();
1683				$target.trigger('focus');
1684			}
1685		});
1686		
1687		//キャプションのある画像のアクセシビリティ対応
1688		$("figure").each(function(i){
1689			$(this).attr("role","group");
1690			i += 1;
1691			$(this).attr("aria-labelledby","figimage" + i);
1692			$(this).children("figcaption").attr("id","figimage" + i);
1693		});
1694		
1695		//フロート画像を囲う
1696		var targetSelectors = '.imageleft, .imageright';
1697		// 対象要素を順番に処理
1698		$(targetSelectors).each(function(index, element) {
1699			// 既にimagewrapで囲まれていない場合のみ処理
1700			if (!$(element).parent().hasClass('imagewrap')) {
1701				var $currentElement = $(element);
1702				var $wrapElements = $currentElement;
1703				// 連続する要素をグループ化
1704				while ($currentElement.next().is(targetSelectors)) {
1705					$currentElement = $currentElement.next();
1706					$wrapElements = $wrapElements.add($currentElement);
1707				}
1708				// 要素をimagewrapで囲む
1709				$wrapElements.wrapAll('<div class="imagewrap"></div>');
1710				
1711				// imagewrapの次の要素がp,ol,ul以外の場合、clearfixクラスを追加
1712				var $imagewrap = $wrapElements.parent('.imagewrap');
1713				if (!$imagewrap.next().is('p , ol , ul')) {
1714					$imagewrap.addClass('clearfix');
1715				}
1716			}
1717		});
1718		
1719		//imageleft(imageleftを含むimagewrap)の後ろのul、olにclearを付与
1720		$('#content, #content2').each(function() {
1721			var $container = $(this);
1722			var selectors = '.imageleft, .imageright, .imagecenter, .imagewrap, h2, h3, h4, h5, h6';
1723			var $elements = $container.find(selectors);
1724			
1725			// 現在のフロート状態を追跡
1726			var hasLeftFloat = false;
1727			
1728			$elements.each(function() {
1729				var $element = $(this);
1730				
1731				// imagewrapの場合、中にimageleftがあるかチェック
1732				if ($element.hasClass('imagewrap')) {
1733					if ($element.find('.imageleft').length > 0) {
1734						hasLeftFloat = true;
1735					} else {
1736						hasLeftFloat = false;
1737					}
1738				// imageleftの場合
1739				} else if ($element.hasClass('imageleft')) {
1740					hasLeftFloat = true;
1741				// imageright, imagecenter, 見出しの場合
1742				} else{
1743					hasLeftFloat = false;
1744				}
1745				
1746				// 現在の要素の後ろにあるul、olを処理
1747				var $current = $element;
1748				while ($current.next().length && !$current.next().is(selectors)) {
1749					if ($current.next().is('ul, ol') && hasLeftFloat) {
1750						$current.next().addClass('clear');
1751					}
1752					$current = $current.next();
1753				}
1754			});
1755		});
1756		
1757		//数字の字間を詰める処理(ページID、更新日、新着日付、災害情報配信日、いいね)
1758		$('.box .update .idnumber, .fi_like').each(function() {
1759			// テキストノードのみを処理
1760			$(this).contents().each(function() {
1761				if (this.nodeType === 3) { // テキストノードの場合
1762					var text = this.nodeValue;
1763					// 2桁以上の数字を<span>で囲む
1764					var replaced = text.replace(/(\d{2,})/g, '<span class="spacing">$1</span>');
1765					if (text !== replaced) {
1766						$(this).replaceWith(replaced);
1767					}
1768				}
1769			});
1770		});
1771		
1772		//ふりがな、やさしい日本語:ページ内埋め込み版
1773		$('.easy').each(function(){
1774			if($.cookie('__tsutaeruMO')=="easy"){
1775				//「やさしい日本語」を消す
1776				if($(this).is('#tsutaeru-button-easy')){
1777					$(this).hide().attr('aria-hidden', 'true');
1778					$(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label');
1779				}else{
1780					$(this).show().attr('aria-hidden', 'false');
1781					$(this).find('button').attr('aria-pressed', 'true').attr('aria-label', 'やさしい日本語で表示しています');
1782				}
1783			}else{
1784				//「もとのページをみる」を消す
1785				if($(this).is('#tsutaeru-button-easyreset')){
1786					$(this).hide().attr('aria-hidden', 'true');
1787					$(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label');
1788				}else{
1789					$(this).show().attr('aria-hidden', 'false');
1790					$(this).find('button').attr('aria-pressed', 'false').attr('aria-label', 'やさしい日本語で表示します');
1791				}
1792			}
1793		});
1794		$('.furigana').each(function(){
1795			if($.cookie('__tsutaeruMO')=="ruby"){
1796				//「ふりがな」を消す
1797				if($(this).is('#tsutaeru-button-ruby')){
1798					$(this).hide().attr('aria-hidden', 'true');
1799					$(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label');
1800				}else{
1801					$(this).show().attr('aria-hidden', 'false');
1802					$(this).find('button').attr('aria-pressed', 'true').attr('aria-label', 'ふりがなを表示しています');
1803				}
1804			}else{
1805				//「ふりがなをけす」を消す
1806				if($(this).is('#tsutaeru-button-rubyreset')){
1807					$(this).hide().attr('aria-hidden', 'true');
1808					$(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label');
1809				}else{
1810					$(this).show().attr('aria-hidden', 'false');
1811					$(this).find('button').attr('aria-pressed', 'false').attr('aria-label', 'ふりがなを表示します');
1812				}
1813			}
1814		});
1815		//「やさしい日本語」変換を実行
1816		$('#header #easyjp , #jssmpbtmnavi #easyjp').on('click',function(){
1817			__tsutaeruMO.start();
1818			$("#header #tsutaeru-button-easy , #jssmpbtmnavi #tsutaeru-button-easy").hide();
1819			$("#header #tsutaeru-button-easyreset , #jssmpbtmnavi #tsutaeru-button-easyreset").show();
1820		});
1821		//「ひらがなをつける」変換を実行
1822		$('#header #ruby , #jssmpbtmnavi #ruby').on('click',function(){
1823			__tsutaeruMO.start({mode:'ruby'});
1824			$("#header #tsutaeru-button-ruby , #jssmpbtmnavi #tsutaeru-button-ruby").hide();
1825			$("#header #tsutaeru-button-rubyreset , #jssmpbtmnavi #tsutaeru-button-rubyreset").show();
1826		});
1827		//「やさしい日本語」「ひらがなをつける」変換を消す
1828		$('#header #easyjpreset , #jssmpbtmnavi #easyjpreset , #header #rubyreset , #jssmpbtmnavi #rubyreset').on('click',function(){
1829			__tsutaeruMO.reset();
1830			$("#header #tsutaeru-button-easyreset , #jssmpbtmnavi #tsutaeru-button-easyreset").hide();
1831			$("#header #tsutaeru-button-easy , #jssmpbtmnavi #tsutaeru-button-easy").show();
1832			$("#header #tsutaeru-button-rubyreset , #jssmpbtmnavi #tsutaeru-button-rubyreset").hide();
1833			$("#header #tsutaeru-button-ruby , #jssmpbtmnavi #tsutaeru-button-ruby").show();
1834		});
1835
1836		//検索結果のaria-label削除
1837		var count = 0;
1838		var timer = setInterval(function() {
1839			count++;
1840			if ($('#googlecontent').length && $('.gsc-refinementHeader').length) {
1841				$('.gsc-refinementHeader').removeAttr("aria-label");
1842				clearInterval(timer);
1843			}
1844			if (count >= 20) { // 20回(約4秒)で諦める
1845				clearInterval(timer);
1846			}
1847		}, 200);
1848
1849	});
1850})();
1851
1852//大きな文字で印刷
1853function printData(){
1854var target = document.getElementById("printcss");
1855target.href = target.href.replace("print_dummy","print_l");
1856var printx = 0;
1857var printSet = setInterval(function() {
1858	printx++;
1859	//終了条件
1860	if (printx == 1) {
1861		window.print();
1862		target.href = target.href.replace("print_l","print_dummy");
1863		clearInterval(printSet);
1864	}
1865}, 500);
1866}
1867
1868//▼セカンドトップ(もっと見る)
1869(function(){
1870	var $ = FI.jQuery;
1871
1872	$(function(){
1873		$('.smenu.secondlist').each(function(){
1874			var $menu = $(this);
1875			var $ul = $menu.find('ul').first();
1876			var $button = $menu.find('.morebtn');
1877			var $label = $button.find('.txtlabel');
1878			var $heading = $menu.find('h2 > a');
1879
1880			if(!$ul.length || !$button.length || !$label.length) return;
1881
1882			var groupName = $heading.length
1883				? ($heading.attr('aria-label') || $heading.text().trim())
1884				: '';
1885
1886			var $items = $ul.children('li');
1887			var visibleCount = 5;
1888
1889			if($items.length <= visibleCount){
1890				return; // CSSでdisplay:noneのまま、ボタンは表示しない
1891			}
1892
1893			$button.addClass('is-visible'); // クラス追加で表示
1894
1895			$items.each(function(index){
1896				if(index >= visibleCount){
1897					$(this).prop('hidden', true);
1898				}
1899			});
1900
1901			$button.on('click', function(){
1902				var isExpanded = $menu.toggleClass('is-open').hasClass('is-open');
1903
1904				$button.attr('aria-expanded', String(isExpanded));
1905
1906				if(isExpanded){
1907					$items.each(function(){
1908						$(this).prop('hidden', false);
1909					});
1910
1911					$label.text('閉じる');
1912					$button.attr('aria-label', groupName + ' 閉じる');
1913
1914					var $firstHiddenItem = $items.eq(visibleCount);
1915					var $link = $firstHiddenItem.find('a').first();
1916
1917					if($link.length){
1918						$link.trigger('focus');
1919					}
1920				}else{
1921					$button.trigger('focus'); // 明示的にフォーカスを戻す
1922
1923					$items.each(function(index){
1924						$(this).prop('hidden', index >= visibleCount);
1925					});
1926
1927					$label.text('もっと見る');
1928					$button.attr('aria-label', groupName + ' もっと見る');
1929				}
1930			});
1931		});
1932	});
1933})();
1934//▲セカンドトップ(もっと見る)
1935//▲common.js
1936
1937//▼アンカーリンク
1938function AnchorLink() {
1939	var $ = FI.jQuery;
1940	//ページ内リンク
1941	$(".pagetop2 a").off('click').on('click', function(){
1942		$('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top }, 'slow','swing').trigger('focus');
1943		$('h1').attr('tabindex', '0');
1944		$('h1').focus();
1945		$('h1').attr('tabindex', '-1');
1946		return false;
1947	});
1948
1949	//アンカーリンク(同ページから遷移時)
1950	$('#anchor a').off('click').on('click', function(){
1951		var target2 = $($(this).attr("href"));
1952		$('html,body').animate({ scrollTop: target2.offset().top }, 'slow','swing').trigger('focus');
1953		target2.attr('tabindex', '0');
1954		target2.focus();
1955		target2.attr('tabindex', '-1');
1956		return false;
1957	});
1958
1959	//イベントカレンダー
1960	$("#eventjump a").off('click').on('click', function(){
1961		$('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top-35 }, 'slow','swing').trigger('focus');
1962	});
1963	
1964}
1965//▲アンカーリンク
1966
1967//▼音声読み上げリーダーのスライド表示
1968function resetEventListeners() {
1969	var $ = FI.jQuery;
1970	if($("#onsei").length){
1971		$('#header #readbtn, #jssmpbtmnavi #readbtn').off('click').on('click', function(){
1972			var $onsei = $(this).closest('#header, #jssmpbtmnavi').find('#onsei');
1973			$onsei.slideToggle();
1974		});
1975	}
1976}
1977//▲音声読み上げリーダーのスライド表示

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.