/* カスタマイズ用のJavaScriptコードをここに記述してください */ /* カスタマイズ用のJavaScriptコードをここに記述してください */ //trigger onload when access page via back button. // window.onpageshow = function(event) { // try { // if (event.persisted || window.performance && // window.performance.navigation.type == 2) { // window.location.reload(); // } // } catch (e) {console.log(e)} // } // iPhone Safari対策:"現在地からさがす"で遷移後にブラウザバックした際に"現在地を取得中"文言を非表示にする。 window.onpageshow = function(event) { if (event.persisted) { ZdcEmapLocFinish(); } } /* 現在地検索 */ function searchGps() { custSearchSubmit(document.formGps); ZdcEmapMakeGPSCondParams(document.formGps); document.formGps.submit(); } /* 住所リスト検索 */ function searchAdcd(adcd) { custSearchSubmit(document.formAddrL); document.formAddrL.adcd.value = adcd; document.formAddrL.submit(); } /* 絞込条件 */ function custSearchSubmit(formTo) { // 画面側の絞込条件(formCond)を取得 var frm = document.formCond; if (!frm) return; // 絞り込み設定(ZdcEmapCond)取得 if (ZdcEmapCond.length > 0) { for(var i=0; i < ZdcEmapCond.length; i++) { custCond = eval("frm.cond"+ZdcEmapCond[i]); if (custCond) { if (custCond.type == 'hidden' || (custCond.value && custCond.checked == true)) { var condName = "cond"+ZdcEmapCond[i]; condto = document.createElement("input"); condto.setAttribute("type", "hidden"); condto.setAttribute("name", condName); //check condition item isn't existed var chk = $(formTo).find('[name="'+condName+'"]').length; if (chk == 0) { formTo.appendChild(condto); } condto.value = custCond.value; } } } } } //accordion-product function initAccordion () { //jqueryオブジェクト保存と効率化 var accordionItem=$('#accordion-product'); //一旦全部消す accordionItem.find('div').hide(); //default open // accordionItem.find('h3').addClass('active'); //active要素を指定して開く var no=0; //click-action accordionItem.find('h3').click(function () { //active切り替え $(this).toggleClass('active'); //表示非表示に時間設定 show hide $(this).next('div').slideToggle('slow'); }); //hover-toggle accordionItem.find('h3').hover(function () { //toggle hoveredクラス $(this).toggleClass('hovered'); }); } //update conditions form of nmap and list. var initFormCondsMapList = function () { if (!document.formCond) return; //switch page nmap if ($('#formNmapView').length) { ZdcEmapCondGetForm(formNmapView); } //switch page list if ($('#formNmapListView').length) { ZdcEmapCondGetForm(formNmapListView); } } $(function(){ //check and update form conditions initFormCondsMapList(); /*------------ アコーディオン ------------*/ // initAccordion(); /*------------ TOPのタブ切り替え ------------*/ (function changeSearchType() { var $nav_list = $(".local-nav-01 li"); if (!$nav_list.length) return; var $contents = $(".wrap_tabs > section"); var idx = $nav_list.index($nav_list.filter(".is-current")); if (idx < 0) idx = 0; $contents.hide(); $contents.eq(idx).show(); $nav_list.on("click", function() { var idx = $nav_list.index(this); $nav_list.removeClass("is-current"); $(this).addClass("is-current"); $contents.hide(); $contents.eq(idx).show(); }); }()); /*------------ FW検索結果のタブ切り替え ------------*/ (function changeFWResult() { var $nav_list = $(".local-nav-02 li"); if (!$nav_list.length) return; var $contents = $(".wrap_tabs > section"); var idx = $nav_list.index($nav_list.filter(".is-current")); if (idx < 0) idx = 0; $contents.hide(); $contents.eq(idx).show(); $nav_list.on("click", function() { var idx = $nav_list.index(this); $nav_list.removeClass("is-current"); $(this).addClass("is-current"); $contents.hide(); $contents.eq(idx).show(); }); }()); /*------------ 条件で絞りこむのトグル/都道府県のトグル ------------*/ (function toggleList() { var $list = $(".js-toggle-01 dd"); if (!$list.length) return; $list.hide(); $(".js-toggle-01 dt").on("click", function() { $(this).toggleClass("is-close"); $(this).next().toggle(); }); }()); }); //init map callback function var initInterval = null; var ZdcEmapInitNMapCallBackFunc = function () { initInterval = setInterval(function () { if (typeof ZdcEmapMapObj != undefined && ZdcEmapMapObj) { $('.z_map_lvl_scaleM').add($('.z_map_lvl_scaleP')).show(); //display button pinch in / pinch out clearInterval(initInterval); initInterval = null; } }, 500) } // remove form input element if checked is false function condInputClick(id) { var condition = "cond" + id; var frm = document.formAddrL; for (var i = frm.length - 1; i >= 0; i--) { var elemName = frm[i].getAttribute('name'); if (condition === elemName) { frm.removeChild(frm[i]); } } frm = document.formPl1; for (var i = frm.length - 1; i >= 0; i--) { var elemName = frm[i].getAttribute('name'); if (condition === elemName) { frm.removeChild(frm[i]); } } frm = document.formGps; for (var i = frm.length - 1; i >= 0; i--) { var elemName = frm[i].getAttribute('name'); if (condition === elemName) { frm.removeChild(frm[i]); } } }