PageSourceSearch

https://www.city.miyazaki.miyazaki.jp/js/common.js

js city.miyazaki.miyazaki.jp collected 2026-10-01 10:41:56 UTC 11,270 bytes, 321 lines download raw bytes

1/* 共通
2-------------------------------------------- */
3// 現在のパスを取得
4var locPath = location.pathname.split("/")[1];
5
6// アクティブ判定(便利ナビ)
7$(document).ready(function() {
8	if(locPath == '.s1') {
9		var activeUrl = location.pathname.split("/")[4];
10		var split = 4;
11	} else {
12		var activeUrl = location.pathname.split("/")[2];
13		var split = 2;
14	}
15		navList = $(".icoW").find("li");
16
17	navList.each(function(){
18		if( $("a",this).attr("href").split("/")[split] == activeUrl ) {
19			$("img",this).attr("src",$("img",this).attr("src").replace("_off.", "_on."));
20		};
21	});
22});
23
24// グローバルナビ
25$(function(){
26	$('#mClose').hide();
27	$('#navBtn').click(function() {
28		$('#navIn').slideToggle();
29		$(this).toggleClass('btnAc');
30		$("body").toggleClass("active");
31		$('#navBtn span').toggle();
32	});
33	$('#btnClose').click(function() {
34		$('#navIn').slideUp();
35		$('#navBtn').removeClass('btnAc');
36		$("body").toggleClass("active");
37		$('#navBtn span').toggle();
38	});
39});
40
41// スムーズスクロール
42$(function () {
43	$('a#retTopBtn[href^="#"], .pageTop a[href^="#"], .eScroll[href^="#"]').click(function () {
44		var speed = 500;
45		var href= $(this).attr('href');
46		var target = $(href == '#' || href == '' ? 'html' : href);
47		var position = target.offset().top;
48		$('html, body').animate({scrollTop:position}, speed, 'swing');
49		return false;
50	});
51});
52
53/* 大カテゴリー
54-------------------------------------------- */
55// お知らせ/新着情報のタブ切り替え
56$(function() {
57	$(".newsW .article-pages").hide();
58	$(".newsW .article-pages:eq(0)").show();
59	$(".newsTabBtn li").click(function(){
60		var no = $(".newsTabBtn li").index(this);
61		$(".newsTabBtn li").removeClass("select");
62		$(this).addClass("select");
63		$(".newsW .article-pages").eq(no).show().siblings(".newsW .article-pages").hide();
64		return false;
65	});
66
67	var txt = $(".newsW .article-pages:eq(0) ul li").text();
68	if(txt == ''){
69		$(".newsTabBtn li:eq(0)").hide();
70		$(".newsW .article-pages:eq(0)").hide();
71		$(".newsTabBtn li:eq(1)").addClass("select");
72		$(".newsW .article-pages:eq(1)").show();
73	}
74});
75
76$(document).ready(function(){
77	$(".mCat .catBoxW div").each(function(){
78		var infoTxt = $(this).text();
79		if (infoTxt === "⇒お知らせ") {
80			$(this).remove();
81		};
82	});
83	$('.catBoxW div:even').addClass('boxL');
84	$('.catBoxW div:odd').addClass('boxR');
85});
86
87/* 小カテゴリー
88-------------------------------------------- */
89$(document).ready(function(){
90	$('.catList li:nth-child(odd)').addClass('clear');
91});
92
93/* 詳細ページ
94-------------------------------------------- */
95
96// アイコン追加
97$(document).ready(function(){
98	// NOT target="_blank" かつ PDF・Excel・Word
99	$('.body a[target != "_blank"][href$=".pdf"], .body a[target != "_blank"][href$=".PDF"], .body a[target != "_blank"][href$=".xls"], .body a[target != "_blank"][href$=".XLS"], .body a[target != "_blank"][href$=".xlsx"], .body a[target != "_blank"][href$=".XLSX"], .body a[target != "_blank"][href$=".doc"], .body a[target != "_blank"][href$=".DOC"], .body a[target != "_blank"][href$=".docx"], .body a[target != "_blank"][href$=".DOCX"]').attr('target' , '_blank');
100
101	// target="_blank"
102	$('.body a[target = "_blank"]').after('<img width="12" height="13" alt="新しいウインドウで開きます" class="linkicon other" src="https://www.city.miyazaki.miyazaki.jp/img/sp/icon_blank.png">');
103	$('.body a[target = "_blank"]:has(img) +img').css('display','none');
104
105	// PDF
106	$('.body a[href$=".pdf"], .body a[href$=".PDF"]').after('<img src="https://www.city.miyazaki.miyazaki.jp/img/sp/icon_pdf.png" width="12" height="13" class="linkicon" alt="pdfファイル">');
107	$('.body a[href$=".pdf"]:has(img) +img, .body a[href$=".PDF"]:has(img) +img').css('display','none');
108
109	// Excel
110	$('.body a[href$=".xls"], .body a[href$=".XLS"], .body a[href$=".xlsx"], .body a[href$=".XLSX"]').after('<img src="https://www.city.miyazaki.miyazaki.jp/img/sp/icon_xls.png" width="12" height="13" class="linkicon" alt="Excelファイル">');
111	$('.body a[href$=".xls"]:has(img) +img, .body a[href$=".XLS"]:has(img) +img, .body a[href$=".xlsx"]:has(img) +img, .body a[href$=".XLSX"]:has(img) +img').css('display','none');
112
113	// Word
114	$('.body a[href$=".doc"], .body a[href$=".DOC"], .body a[href$=".docx"], .body a[href$=".DOCX"]').after('<img src="https://www.city.miyazaki.miyazaki.jp/img/sp/icon_doc.png" width="12" height="13" class="linkicon" alt="Wordファイル">');
115	$('.body a[href$=".doc"]:has(img) +img, .body a[href$=".DOC"]:has(img) +img, .body a[href$=".docx"]:has(img) +img, .body a[href$=".DOCX"]:has(img) +img').css('display','none');
116});
117
118// ヒストリーバック(リンク先の処理)
119$(document).ready(function(){
120	(function(){
121		var ans;	// 1つ前のページが同一ドメインかどうか
122		var bs	= false;	// unloadイベントが発生したかどうか
123		var ref = document.referrer;
124		$(window).bind("unload beforeunload",function(){
125			bs = true;
126		});
127		re = new RegExp(location.hostname,"i");
128		if(ref.match(re)){
129			ans = true;
130		}else{
131			ans = false;
132		}
133		$('.historyback').bind("click",function(){
134			var that = this;
135			if(ans){
136			history.back();
137			setTimeout(function(){
138				if(!bs){
139					location.href = $(that).attr("href");
140				}
141			},100);
142		}else{
143			location.href = $(this).attr("href");
144		}
145			return false;
146		});
147	})();
148});
149
150// デバイスサイズ600px以上の時、TELの<a>タグ削除
151$(document).ready(function(){
152	var dwidth = $(window).width();
153	if(dwidth >= 601){
154		$(".tel a").each( function(i){
155			var childNodes = this.childNodes;
156			$(this).replaceWith(childNodes);
157		});
158	}
159});
160
161// アコーディオン
162$(function() {
163	$('.accTit').click(function(){
164		$(this).next().slideToggle().prev().toggleClass('open');
165		return false;
166	});
167});
168
169// IE6 判定(SNS非表示)
170var userAgent = window.navigator.userAgent.toLowerCase();
171var appVersion = window.navigator.appVersion.toLowerCase();
172if (userAgent.indexOf("msie") != -1) {
173	if (appVersion.indexOf("msie 6.") != -1) {
174		$(document).ready(function(){
175			$('.cms-sns_share').hide();
176			$('.oneColumn #mainW .snsOuter').css('padding', '0');
177			$('#mainW #mainContL .released').css('margin-bottom', '15px');
178		});
179	}
180	// IE8 float画像対応
181	if (appVersion.indexOf("msie 8.") != -1) {
182		$(window).load(function(){
183			var imgWR = $('#mainContL .imgTxtR img').width();
184			$('#mainContL .imgTxtR img').css('max-width',imgWR);
185			var imgWL = $('#mainContL .imgTxtL img').width();
186			$('#mainContL .imgTxtL img').css('max-width',imgWL);
187		});
188	}
189}
190
191// テンプレート「画像×3」最後のdivにclassを付与
192$(function(){
193	$(".body .imgW3").each(function(){
194		$('div' ,this).last().addClass('last-child');
195	});
196});
197
198/* よくあるご質問
199-------------------------------------------- */
200$(function(){
201	$('.faq-search .keyword').each(function(){
202		var txt = $(this).html();
203		$(this).html(txt.replace(/キーワード/g,''));
204	});
205	$('.faq-search #keyword').attr('placeholder','キーワード');
206});
207
208/* PDF
209-------------------------------------------- */
210$(window).load(function(){
211	$(".ss-adobe-reader div").html("<span>PDFファイルをご覧いただけなかった方</span>「Adobe Acrobat Reader」もしくは「SkyPDF Viewer」をご利用ください。ダウンロードは無料です。各バナーをクリックして最新バージョンのインストールをお薦めします。");
212});
213$(function () {
214  $('.ss-adobe-reader a[href="https://get.adobe.com/jp/reader/"]').after(
215    '<a href="https://www.skycom.jp/free/">SkyPDF Viewerをダウンロードする</a>'
216  );
217});
218
219/* 施設検索ボタン
220-------------------------------------------- */
221$(window).load(function(){
222	$("footer.send input").eq(0).wrap("<span class='sWrap'></span>");
223	$("footer.send input").eq(1).wrap("<span class='rWrap'></span>");
224});
225
226/* 各課へのお問い合わせ
227-------------------------------------------- */
228$(function(){
229	var locID = location.hash;
230	if(locID){
231		var locFile = locID.replace(/#|[0-9]/g, '');
232		if(locFile == "contact"){
233			var locNo = locID.replace(/#|[A-Za-z]/g, '');
234			var locCnt = locNo -1;
235			$ ('.accW .accTit').eq(locCnt).addClass("open").next().show();
236		}
237	}
238});
239
240/* colorbox
241-------------------------------------------- */
242$(document).bind('cbox_complete', function(){
243	$.colorbox.resize();
244});
245
246/* 便利マップ・指定避難所・指定緊急避難場所
247-------------------------------------------- */
248/*$(function(){
249	// 用途:非表示
250	var useClass = '.condition .service';
251	$(useClass, '.body--institution, .body--shelter, .body--e_shelter').hide().next('dd').hide();
252	// 種類:非表示
253	$('.body--shelter .condition .category').hide().next('dd').hide();
254});*/
255
256/* パンくず
257-------------------------------------------- */
258$(function(){
259	$(".crumbs span").each(function(){
260		if ( $(this).children('a').length > 0 ) {
261			$(this).addClass('node');
262		}
263	});
264});
265
266/* 組織から探す:課一覧
267-------------------------------------------- */
268$(document).ready(function(){
269	$('.relation-nodes-body div').each(function(){
270		$('h3:even', this).addClass('boxL');
271		$('h3:odd', this).addClass('boxR');
272	});
273});
274
275/* 市議会用小カテゴリー
276-------------------------------------------- 
277$(document).ready(function(){
278	$('.rCont .category-pages ul li:nth-child(odd)').addClass('clear');
279});*/
280
281/*GoogleMap ズーム対応
282-------------------------------------------- */
283// Googlemaps_Map.setMarkers
284Googlemaps_Map.minZoom = 13;
285Googlemaps_Map.setMarkers_ = Googlemaps_Map.setMarkers;
286Googlemaps_Map.setMarkers = function(markers) {
287  zoomChangeIdleListener = google.maps.event.addListener(Googlemaps_Map.map, 'idle', function() {
288    if (this.getZoom() > Googlemaps_Map.minZoom) {
289      console.log("ss_map : Googlemaps_Map.setMarkers");
290      this.setZoom(Googlemaps_Map.minZoom);
291    }
292    google.maps.event.removeListener(zoomChangeIdleListener);
293  });
294  Googlemaps_Map.setMarkers_(markers);
295};
296
297// Member_Photo_Form.renderMarkers
298Member_Photo_Form.minZoom = 13;
299Member_Photo_Form.renderMarkers_ = Member_Photo_Form.renderMarkers;
300Member_Photo_Form.renderMarkers = function() {
301  zoomChangeIdleListener = google.maps.event.addListener(Googlemaps_Map.map, 'idle', function() {
302    if (this.getZoom() > Member_Photo_Form.minZoom) {
303      console.log("ss_map : Member_Photo_Form.renderMarkers");
304      this.setZoom(Member_Photo_Form.minZoom);
305    }
306    google.maps.event.removeListener(zoomChangeIdleListener);
307  });
308  Member_Photo_Form.renderMarkers_();
309};
310
311/* 集団検診フォーム 胃がん
312-------------------------------------------- */
313$(function(){
314  $("input[data-name='胃がん(バリウム)']").on("click", function(){
315    $("input[data-name='胃がん(リスク)']").prop('checked',false);
316  });
317  $("input[data-name='胃がん(リスク)']").on("click", function(){
318    $("input[data-name='胃がん(バリウム)']").prop('checked',false);
319  });
320});
321

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.