PageSourceSearch

https://www.pref.fukushima.jp/ssi/js/smart.js?2023_0828am1136

js pref.fukushima.jp collected 2026-09-24 18:19:11 UTC 19,980 bytes, 604 lines download raw bytes

1// スマートフォン用Javascript
2
3$(function(){
4	//テスト用 ?SP
5	function test(){
6		if(location.href.lastIndexOf('?sp') != -1){
7			return true;
8		}
9	}
10	var path = location.href;
11	var dPath = '/';
12	//var dPath = path.match(/^(.+fukushima\/)(.+)/)[1];//作業用
13	
14
15	/*userAgent*/
16	function ua(tgt) {
17		var nut = navigator.userAgent.toLowerCase();
18		var uaChk = {
19			"iphone"	:nut.indexOf("iphone") != -1,
20			"ipad"		:nut.indexOf("ipad") != -1,
21			"android"	:nut.indexOf("android") != -1,
22			"mobile"	:nut.indexOf("mobile") != -1,
23			"ie"	:nut.indexOf("ie") != -1
24		};
25		return uaChk[tgt];
26	}
27	function sp(){
28		if(ua('iphone') || (ua('android') && ua('mobile'))||test()){
29			return true;
30		}else{
31			return false;/////false
32		}
33	}
34	
35	function navChange(){
36		//グローバルナビ画像差し替え
37		$('#top_search_a li[id*="page_now0"]').remove();
38		//以下、replaceWithを必要に応じて記述
39		
40	}
41	function lifeStageChange(){
42		//ライフステージ画像差し替え
43	}
44	
45	
46	if(sp()){
47		//viewport setting
48		var header = document.getElementsByTagName("head").item(0);
49		var vp = document.createElement("meta");
50		vp.name = "viewport";
51		vp.content = "width=device-width, initial-scale=1.0, maximum-scale=4.0, user-scalable=yes";
52		header.appendChild(vp);
53		
54		/*viewParam*/
55		if (!sessionStorage['view']) {
56			sessionStorage['view'] = 'sp';
57		}
58		var crView = sessionStorage['view'];
59		
60		
61		function changeViewPort(width) {
62		    $('meta[name=viewport]').attr('content','width=' + width);
63		}
64		if (crView == 'pc') {
65			changeViewPort(960);
66		}
67		
68		
69		/*pcStyle*/
70		function tgtCss(){
71			var tgtStyle = $('head style').html();
72			var m = /(css\/)(.+)(\.css)/.exec(tgtStyle);
73			var pcStyle = RegExp.$2;
74			return pcStyle;
75		}
76		var currentCSS = tgtCss();
77		var currentURLArry = location.pathname.split('/');
78
79		/*language*/
80		function chkLang(){
81			var langChk = path;
82			var m = /(site\/)(.+)(\/)/.exec(langChk);
83			var lang = RegExp.$2;	// サブサイト /site/aaa/ のアドレス中の aaa が lang へ代入され、返り値となる。
84			return lang;
85		}
86		/*loader*/
87		var loadAnim;
88		//ロードアニメーション
89		//アニメーション開始
90		function strLoader(){
91			var haH = $(window).height();
92			var orghaH = haH;
93			haH = haH+200;
94			var haW = $(window).width();
95			haW = haW+100;
96			$('body').css({'background-image':'none','background-color':'#ffffff'});
97			$('#container').css({"display":"none"});
98			$('body').append('<img id="loadingImage" style="background-color:#ffffff; position:absolute; z-index:100;top:0px; width:35px; left:50%; " src="'+dPath+'img/sp/sp-loader.png" width="35" height="35" alt="" />');
99			$('#loadingImage').css('margin-top',orghaH/2);
100			var rDeg = 0;
101			loadAnim = setInterval(function() {
102				rDeg =  rDeg+10;
103				$('#loadingImage').css('-webkit-transform','rotate('+rDeg+'deg)');
104			}, 20);
105		}
106		//アニメーション終了
107		function stopLoader(){
108			function stopTimming() {
109					if ($('#spMenu').length >  0) {
110						return true;
111					}
112			}
113			
114			var stopAnim = setInterval(function() {
115				if(stopTimming()){
116					$('#container').css({'display':'block'});
117					$('#loadingImage').remove();
118					clearInterval(loadAnim);
119					clearInterval(stopAnim);
120				}
121			}, 100);
122		}
123		
124		/*head write*/
125		//sp
126		function hdWrite(){
127			$('head').append('<link href="'+dPath+'ssi/css/sp-'+currentCSS+'.css" rel="stylesheet" type="text/css" />');
128		}
129		//pc
130		function hdWritePC(){
131			$('head').append('<link href="'+dPath+'ssi/css/sp-pc.css" rel="stylesheet" type="text/css" />');
132		}
133		
134		/*dom*/
135		//common
136		function viewSwitchSet(langTgt){
137			var jaSet = ['[表示]','モバイル','パソコン','トップに戻る'];
138			var enSet = ['[view]','Mobile','PC','Home'];
139			var krSet = ['[??]','???','PC','? ???'];
140			var chkSet = ['[?示]','手机网站','??','首?'];
141			var chhSet = ['[顯示]','手機網站','電腦','首頁'];
142			if (langTgt == 'english') {
143				var thisSet = enSet;
144			}else if (langTgt == 'korean') {
145				var thisSet = krSet;
146			}else if (langTgt == 'chinese-k') {
147				var thisSet = chkSet;
148			}else if (langTgt == 'chinese-h') {
149				var thisSet = chhSet;
150			}else {
151				var thisSet = jaSet;
152			}
153		
154			$('#footer').prepend('<div id="viewSwitch"><dl><dt>'+thisSet[0]+'</dt><dd><ul><li><a id="vsSP">'+thisSet[1]+'</a></li><li><a id="vsPC">'+thisSet[2]+'</a></li><li><a id="vsTop">'+thisSet[3]+'</a></li></ul></dd></dl></div>');
155			$('#vsSP').click(function(){
156				spChange();
157			});
158			$('#vsPC').click(function(){
159				pcChange();
160			});
161			$('#vsTop').click(function(){
162				window.location.href = '/';
163			});
164		}
165		
166		//sp
167		function domSet(){
168			
169			//img --> text
170			function imgToText(tgt){
171				$(tgt).each(function(){
172				   $(this).append($(this).children('img').attr('alt'));
173				   $(this).children('img').remove();
174				});
175			}
176			//a href change
177			function aHrefChange(tgt,prm){
178				$(tgt).each(function(i){
179					$(this).attr('href',prm[i]);
180				});
181			}
182			//img H checker
183			function imgChk(tgtImg){
184				var imgRH;
185				var timer = setInterval(chkImg,50);
186				chkImg();
187				function chkImg(){
188					var imgRH = tgtImg.height();
189					if(imgRH != 0){
190						clearInterval(timer);timer=null;
191						return imgRH;
192					}
193				}
194				return chkImg();
195			}
196			
197			
198			//common----------------------------------------------------------------
199			$('body').addClass('spcss-'+currentCSS);
200			
201			
202			function hdBtnSet(){
203				$('#he_left').append('<ul id="spMenu">');
204				$('#spMenu').append('<li id="spm_menu">メニュー');
205				$('#spMenu').append($('.header_nav1 .gyou1_2'));
206				$('#spMenu').append('<li id="spm_pc">PCサイト');
207			
208				$('#spm_menu').click(function(){
209					$('#top_search').slideToggle(300);
210				});
211				$('#spm_pc').click(function(){
212					pcChange();
213				});
214			}
215			function gnavSet() {
216				imgToText('#top_search_a li a');
217				$('#top_search_a ul').append($('<li class="slideme1"><a href="/sec/">組織でさがす</a></li>'));
218				$('#top_search_a ul').append($('<li class="slideme2"><a href="/calendar/">カレンダーでさがす</a></li>'));
219				$('#top_search').after($('#top_search_keyword'));
220			}
221			gnavSet();
222			
223			function bottomSet() {
224				imgToText('h1#h1_title');
225			}
226			bottomSet();
227			
228			
229			if (currentCSS != 'xxxxxxxxxxxxxxxx') {
230				hdBtnSet();
231			}
232			
233			function pagetopSet() {
234				imgToText('#back_or_pagetop a');
235			}
236			pagetopSet();
237			
238			function ftSet(){
239				viewSwitchSet(chkLang());
240				//imgToText('.footer_navi li a');
241				
242				$('#author_info').prepend('<div id="new_author_box">');
243//				$('#author_box a').each(function(i){
244//					$(this).addClass('sp-'+i);
245//					$('#new_author_box').append($(this));
246//				});
247				$('#new_author_box').append($('#author_box a:nth(0)'))
248				$('#new_author_box').append('<span>Tel:<a href="tel:0245211111">024-521-1111</a></span>');
249				
250				$('#new_author_box').append($('#new_author_box a:nth(3)'));
251				
252				$('#author_box').remove();
253				
254			}
255			if(currentCSS != 'xxxxxxxxxxxxxxxxx'){
256				ftSet();
257			}
258			
259			
260			//topPage----------------------------------------------------------------
261						
262			
263			//テンプレートごとの処理
264			//トップページ処理
265			if(currentCSS == 'top'){
266				$('#top_search_a').after($('#supersized'));               
267			
268
269//				$('#top_search_a').after('<div id="spSlide"><ul class="bxslider">');
270//				$('#supersized li').each(function () {
271//					$('.bxslider').append($(this).clone(true));
272//				});
273//			
274//				$('head').append('<link href="/ssi/css/jquery.bxslider.css" rel="stylesheet" type="text/css" />');
275//				$.getScript("/ssi/js/jquery-bxslider.js", function(){
276//					var slider = $('.bxslider').bxSlider({
277//			        	auto: true,
278//			        	speed:1000,
279//			        	pause: 4000,
280//			    		onSliderLoad: function () {
281//			    			bxLoad();
282//			    		},
283//			        	onSlideBefore: function () {
284//			        	},
285//			        	onSlideAfter: function () {
286//			        	}
287//			         });
288//			         
289//			         function bxLoad() {
290//			         	var boxw = $('.bxslider a').width();
291//			         	$('.bxslider img').each(function () {
292//			         		$(this).height(95);
293//			         		$(this).width('auto');
294//			         	
295//			         		var imgw = $(this).width();
296//			         		var imgl = (imgw-boxw)/2*-1;
297//			         		
298//			         		$(this).css({marginLeft: imgl+'px'});
299//			         	});
300//			         };
301//			         function bxBefore() {
302//			         }
303//			         function bxAfter() {
304//			         }
305//			         
306//		         	window.onorientationchange = function() {
307//		         		bxLoad();
308//		         	};
309//				});
310			
311				
312				
313				$('#sidebar2').prepend($('#sidebar1>div:nth(5)'));
314				
315				$('#box1,#box2,#box3,#box4, #sidebar2 .sidebar1_box1, #sidebar2 .sidebar2_box1').css({display:'block',visibility:'visible'}).addClass('topBoxes');
316				$('#box1, #sidebar2 .sidebar1_box1, #sidebar2 .sidebar2_box1').show(0).addClass('boxOpen');
317				$('.topBoxes h2').click(function () {
318					$(this).parents('.topBoxes').toggleClass('boxOpen');
319				});
320				
321				$('#sidebar2 .menu_list_e2').each(function (i) {
322					$(this).addClass('sp-'+i);
323				});
324                
325                
326                $('.emer_box ul').remove();
327$('.menu_list_e_nuclear').remove();
328$('.menu_list_e2_2').remove();
329$('.emer_box').append($('<div class="spSideBnr"><ul><li><a href="/site/portal/moni-k.html" target="_blank"><img src="/img/banner/bnr_alps.gif" alt="ALPS処理水海域モニタリング結果" class="img_b"></a></li><li><a href="/sec/16025d/"><img src="/img/bnr_emer2_2.gif" alt="各種放射線モニタリング結果" class="img_b"></a> </li><li style="width: 100%;"><a href="/sec/16025c/"><img src="/img/banner/bnr_genan.jpg" alt="廃炉作業安全確認ALPS処理水の海洋放出に関する情報" class="img_b"></a></li><li><a href="http://josen-plaza.env.go.jp/" target="_blank"><img src="/uploaded/library/200_50.png" alt="環境再生プラザ"></a></li><li><a href="https://www.pref.fukushima.lg.jp/sec/21045b/" target="_blank"><img src="/img/kenkochosa1.png" alt="県民健康調査について" class="img_b"></a></li><li><a href="http://www.pref.fukushima.jp/douro/kisei/kisei-map.htm" style=”text-align:center”><img src="/img/banner/bnr_roadregulatory.jpg" alt="福島県内の道路通行規制情報(工事や異常気象等による)" class="img_b"></a></li><li><a href="http://kaseninf.pref.fukushima.jp/gis/" target="_blank"><img src="/img/banner/bnr_kasen_uryou.gif" alt="福島県内の河川水位・雨量情報" class="img_b"></a></li><li><a href="https://d-keikai.pref.fukushima.lg.jp" target="_blank"><img src="/img/banner/bnr_dkeikai.jpg" alt="土砂アラート(土砂災害危情報システム" class="img_b"></a></li></ul></div>'));
330$('.emer_box').before($('.spSideBnr'));
331
332$(".hisai_important").insertAfter("#header");
333$(".covid19bnr").insertBefore(".hisai_important");
334			}
335			
336			//life
337			if (currentCSS == 'life') {
338				if ($('#main_body>.navigation').length) {
339					$('#main_body>.navigation:nth(0)').addClass('boxOpen');//1つ目開くなら
340					$('#main_body>.navigation h2').click(function () {
341						$(this).parents('.navigation').toggleClass('boxOpen');
342					});
343				}
344			}
345			
346			
347			/*あこディオンclass*/
348			if ($('#main_body .navigation').length && currentCSS != 'life3') {
349				$('#main_body').addClass('extend_acco');
350			}
351			//soshiki
352			if (currentCSS == 'soshiki' || currentCSS == 'soshiki-50' || currentURLArry[1] =='sitemap.html') {
353				//$('#main_body').addClass('extend_acco');
354				if ($('#main_body>.navigation').length) {
355					$('#main_body>h2:nth(0)').addClass('boxOpen');//1つ目
356					$('#main_body>h2:nth(0)+.navigation').addClass('boxOpen');//1つ目開くなら
357					
358					$('#main_body> h2').click(function () {
359						$(this).toggleClass('boxOpen');
360						$('+.navigation',this).toggleClass('boxOpen');
361					});
362				}
363			}
364			if (currentCSS == 'life') {
365			}
366			
367			//soshiki-kakubu2並べ替え
368			if (currentCSS == 'soshiki-kakubu2') {
369				$('.box_g').each(function () {
370					var box = $(this).parents('.box_kb');
371					box.children('h2').after($(this));
372					$(this).addClass('sp-hide');
373				});
374			}
375			
376			//site
377			if (currentCSS == 'site') {
378				if ($('#sidebar2>.sidebar1_b').length) {
379					$('#sidebar2>.sidebar1_b:nth(0)').addClass('boxOpen');//1つ目開くなら
380					$('#sidebar2>.sidebar1_b').click(function () {
381						$(this).toggleClass('boxOpen');
382					});
383				}
384			}
385			//site-gikai
386			if (currentCSS == 'site-gikai') {
387				$('.heightLineParent').removeClass('heightLineParent');
388				if ($('#gmenu_wrap .sidebar1_b').length) {
389					$('#gmenu_wrap .sidebar1_b:nth(0)').addClass('boxOpen');//1つ目開くなら
390					$('#gmenu_wrap .sidebar1_b').click(function () {
391						$(this).toggleClass('boxOpen');
392					});
393				}
394				if ($('.gikai_top').length) {
395					$('#top_search').css('display', 'block');
396				}
397				$('#spMenu .gyou1_2').remove();
398			}
399			
400			
401			//sitemap.html
402			if (currentURLArry[1] =='sitemap.html') {
403				$('#main_body').addClass('extend-sitemap');
404				$('#main_body').after('<div id="bunrui-wrap">');
405				$('#bunrui-wrap').append($('#main_body> h2:nth(0)'));
406				$('#bunrui-wrap').append($('#halfbox_wrap'));
407				$('#main_body').wrapInner('<div id="sosiki-wrap">');
408				$('#sosiki-wrap').wrapInner('<div id="sosiki-wrap-inner">');
409				$('#sosiki-wrap').prepend($('#sosiki-wrap h2'));
410				$('#main_body').prepend($('#bunrui-wrap'));
411				
412				$('#main_body h2').addClass('boxOpen');
413				
414				$('#main_body h2, #main_body h3').click(function () {
415					$(this).toggleClass('boxOpen');
416//					$('#halfbox_wrap',this).toggleClass('boxOpen');
417//					$('.h2_box',this).toggleClass('boxOpen');
418
419					$(this).parents('.main_box').toggleClass('boxOpen');
420				});
421			}
422			
423			
424			//緊急災害
425			if(currentCSS == 'top-emer'){
426$(".bousai_web").insertBefore("#shinchaku_box");
427				$('#main').after($('#sidebar1'));
428				$('#mymainback').prepend($('#top_bousai'));
429				//バナー画像差し替え
430				$('#top_bousai ul li img[src="/img/bnr_bousai.gif"]').replaceWith('<img class="img_b" src="/img/sp/sp-bnr_bousai.png" width="142" height="34" alt="防災情報" />');
431				$('#top_bousai ul li img[src="/img/bnr_iryou.gif"]').replaceWith('<img class="img_b" src="/img/sp/sp-bnr_iryou.png" width="142" height="34" alt="緊急・休日当番医" />');
432				//ウェザーニューズ削除
433				$('#weathernews_blog_parts').remove();
434				//
435				$('#main .h2_b, #mymainback .waku:nth(0) h2').addClass('boxOpen');//1つ目開くなら
436				$('#main .h2_b, #mymainback .waku h2').click(function () {
437					$(this).toggleClass('boxOpen');
438				});
439			}
440			
441			//組織でさがす
442			/*if(currentCSS == 'soshiki' | currentCSS == 'soshiki-50' | currentCSS == 'soshiki-kakubu' | currentCSS == 'soshiki-kakubu2'){
443				imgToText('#sidebar1 .kanren_back');
444				imgToText('.kikan h3');
445				$('#main').after($('#sidebar1'));
446			}*/
447			//各部
448			/*if(currentCSS == 'soshiki-kakubu'){
449				//部局一覧の子要素にulを持つliの幅を97%にする。課が一つ程度だと他の部局が回りこんで表示されてしまう件の対応。
450				$('.menu_list_b li').find('ul').parent().css('width','97%');
451			}*/
452			
453			//各課
454			/*if(currentCSS == 'soshiki-kakuka'){
455				imgToText('#sidebar2 .kanren_back h2');
456			}*/
457			//分類
458			/*if(currentCSS == 'life' | currentCSS == 'life2' | currentCSS == 'life3'){
459				imgToText('#sidebar2 .kanren_back h2');
460				//$('#main_body').prepend($('#life_index'));
461				$('#main_body > .navigation + br').remove();
462
463			}*/
464			//サブサイト
465			/*if(currentCSS == 'site'){
466				$('#main').after($('#sidebar1')); 
467				$('#footer').prepend($('#site_footer'));
468			}*/
469			//市議会
470			/*if (currentCSS == 'site-gikai') {
471				$('#main').after($('#sidebar1'));
472				$('#mainmenu li').removeAttr('class');
473			};*/
474			//県知事サブサイト
475			if (currentCSS == 'site-governor') {
476				$('#area_top_right').each(function () {
477				   $('#area_top_left').after($(this));
478				})
479			};
480			
481			// FAQページ
482			/*if(currentCSS == 'faq-top' || currentCSS == 'faq-2p'){
483				imgToText('#h1_title');
484				$('#main_body .navigation ul + br').remove();
485			}*/
486			//地図でさがす
487			/*if(currentCSS == 'shisetsu-top'){
488				imgToText('#h1_title');//地図でさがすトップ・リストページ
489				imgToText('#shisetsu_back');//地図でさがす目的ページ
490				$('#sidebar1').before($('#main'));
491				$('#box_list').append('<a href="#sidebar1" style="display:block;padding:1em;">施設案内へ</a>');
492			}*/
493			//360 PC表示
494			/*if(currentCSS == 'view360'){
495				pcChange();
496			}*/
497			//カレンダー
498			/*if(currentCSS == 'calendar'){
499				setCalTypeCss();
500				$('#main_body table th').removeAttr('style');
501
502			}*/
503
504			//ウェブブック
505			if(currentCSS == 'book'){
506				$('.book_box').each(function(){
507					$('h3').after($('.book_day'));
508				});
509			}
510
511			/*if(currentCSS == 'site-kosodate'){
512				$('h1').wrap('<div class="wrap_h1"></div>');
513				$('h2').wrap('<div class="wrap_h2"></div>');
514				$('h3').wrap('<div class="wrap_h3"></div>');
515				$('h4').wrap('<div class="wrap_h4"></div>');
516				$('h5').wrap('<div class="wrap_h5"></div>');
517				$('h6').wrap('<div class="wrap_h6"></div>');
518				$('#sidebar1').before($('#main'));
519				//$('#main').prepend($('#top_search_a'));
520			}*/
521			/*if(currentCSS == 'site-ceramic'){
522				photoLoadCeramic();
523				$('h1').parent().removeAttr('class');
524				$('#jslidernews1').remove();
525				$('*').removeClass('hide2');
526				$('#in_main').before($('#in_sidebar2'));
527				$('#ceramic_footer div[class*="cfoot"] dd').hide();
528				$('#ceramic_footer div[class*="cfoot"] dt').click(function(){
529					$(this).next().slideToggle();
530				});
531				$('#author_info').prepend($('#ceramic_footer'));
532				$('#solid').prepend($('#main'));
533			}*/
534			//LinkList
535			/*function hdLineAndDivi(tgtLine) {
536				$(tgtLine).each(function(){
537					if($(this).children('a').length > 1){
538						$(this).addClass('hd_div');
539					}
540				});
541			}*/
542			//hdLineAndDivi('.list_ccc .span_b');
543			
544			
545			//pages------------
546			
547		}
548		//pc
549		function domSetPC(){
550			$('body').prepend('<div id="switchSP">スマートフォン版はこちらをタップ');
551			$('#switchSP').click(function(){
552				spChange();
553			});
554			 //viewSwitchSet(chkLang());
555		}
556		
557		///user action----------------------------------------------------------------
558		//common
559		
560		/*$('#spmSoshiki').on("click", function(){
561			window.location.href = '/soshiki/';
562		});
563		$('#spmSite').on("click", function(){
564			window.location.href = '/site/userguide/foreign.html';
565		});*/
566		function spChange(){
567			sessionStorage['view'] = 'sp';
568			location.reload();
569		}
570		function pcChange(){
571			sessionStorage['view'] = 'pc';
572			location.reload();
573		}
574		
575		//top---------------------------------
576		//タブを実装する際はここに記入
577
578		////START------------------------------------------------------------------
579		//viewSwitch
580		if(crView == 'sp'){
581			// ロードアニメーション	
582			//strLoader(); 
583			$(window).load(function() {
584				hdWrite();
585				domSet();
586				if (!location.hash) {
587					setTimeout(scrollTo, 100, 0, 1);
588				}
589			});
590			if (!ua('ie')) {
591				window.onpageshow = function() {
592					//stopLoader();
593				};
594			}else {
595				//stopLoader();
596			}
597			window.onorientationchange = function() {
598			};
599		}else if (crView == 'pc') {
600			hdWritePC();
601			domSetPC();
602		}
603	}
604})

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.