/* カスタマイズ用のJavaScriptコードをここに記述してください */ $(function(){ // 店舗リストスライド var slideClickFlg = true; //ダブルタップ防止 // リストを表示 $('#slide-control-open').on('click', function(){ if(slideClickFlg){ slideClickFlg = false; // 検索エリア+地図の高さを0にする $('.nmap-content-wrap').slideUp(); /* var headerHeight = $('.cond-modal-header').height() + 20; $('.nmap-content-wrap').css('padding-top', headerHeight); */ // 最寄り一覧(「リストを閉じる」含む)の高さを0から本来の高さにする $('.near-list-wrap').slideDown(); slideClickFlg = true; $('.cond-modal-header').css('position', 'fixed'); /* // 最寄り一覧全体の高さを取得 var listHeight = $('.shop-nlist').height(); // 高さを設定 $('.shop-nlist').css('height', listHeight); // 画面の高さ var screenHeight = window.screen.height; // 「リストを閉じる」の高さ var closeControlerHeight = $('#slide-control-close').height(); // 画面内の最寄り一覧の高さ var visibleListHeight = screenHeight - headerHeight - closeControlerHeight; $('.shop-nlist').css('max-height', visibleListHeight); $('.shop-nlist').css('overflow', 'auto'); */ } }); // リストを閉じる $('#slide-control-close').on('click', function(){ if(slideClickFlg){ slideClickFlg = false; // 戻す $('.nmap-content-wrap').slideDown(); $('.near-list-wrap').slideUp(); $('html,body').animate({ scrollTop: 0 }, '1'); slideClickFlg = true; // ヘッダ固定を解除 $('.cond-modal-header').css('position', 'static'); } }); // デバイスごとにbodyにclassを設定 setUaClass(); }); /* * オンロード時に実行するカスタマイズ関数を追加 * setting_option.incから呼び出される */ function jsInitAdd(lat,lon,interval,icolor){ if( ZdcEmapMapObj ){ // 地図をリサイズ resizeMapHeight(); // 現在地アイコン表示 currentLocationIconDisp( lat,lon,ZdcEmapMapObj,icolor ); }else{ setTimeout(function(){ jsInitAdd(lat,lon,interval,icolor); },interval); } } // #2541 現在地アイコン表示 function currentLocationIconDisp( lat,lon,mapObj,icolor ){ if( mapObj ){ lat = ZDC.msTodeg(lat); lon = ZDC.msTodeg(lon); var latlon = new ZDC.LatLon(lat, lon); if( icolor ){ /* マーカを作成 */ mrk = new ZDC.Marker( latlon,{ color:icolor }); }else{ /* マーカを作成 */ mrk = new ZDC.Marker( latlon,{ color:ZDC.MARKER_COLOR_ID_RED_S }); } mrk.setZindex(999); /* マーカを追加 */ mapObj.addWidget(mrk); } } // 絞込パラメータ作成(チェックされた項目のみセットする) function getCondParamsCust() { var frm = document.formCustCond; if (!frm) return; var condParamsCust = ""; if (ZdcEmapCond.length > 0) { for(var i=0; i < ZdcEmapCond.length; i++) { custCond = eval("frm.custcond"+ZdcEmapCond[i]); if (custCond) { if (custCond.type == 'hidden' || (custCond.value && custCond.checked == true)) { // valueをエンコードして追加 condParamsCust += "&cond"+ZdcEmapCond[i]+"="+encodeURIComponent(custCond.value); } } } } return condParamsCust; } // 絞込条件転記 function CondGetFormCust(formTo) { var formFrom = document.formCustCond; if (!formFrom) return; var ElementsCount = formFrom.elements.length; // チェックボックスの数 for( i=0 ; i 0) { for(var i=0; i < ZdcEmapCond.length; i++) { custCond = eval("frm.custcond"+ZdcEmapCond[i]); if (custCond) { if (custCond.type == 'hidden' || (custCond.value && custCond.checked == true)) { if(CustCondJkn != ""){ CustCondJkn += " AND "; } CustCondJkn += custCond.value; } } } } return CustCondJkn; } // 現在地検索アプリ版 function getLocationAPL(){ //絞込項目取得 condParamStr = getCondParamsCust(); //url組み立て var url="sejapp://sms/location?"; url += condParamStr; open(url); } // 現在地検索拠点版 function getLocation(){ watchId=navigator.geolocation.getCurrentPosition(getGeolocation, handleErrorNM); } // 現在地検索コールバック function getGeolocation(pos){ var lat=pos.coords.latitude; var lon = pos.coords.longitude; // フラグ・自由項目取得 freeParamStr = getFreeParamsCust(); //絞込項目取得 condParamStr = getCondParamsCust(); //url組み立て var url="nmap.htm?datum=WGS84&lat="+lat+"&lon="+lon; url += freeParamStr; url += condParamStr; window.location.href=url; } function handleErrorNM(err) { ZdcEmapLocFinish(); } //店舗リストを更新する function updateList(lat, lon){ // 最初に確定した地図範囲ZdcEmapSearchBoxの緯度経度を取得 boxLatLon = ZDC.degToms(ZdcEmapSearchBox.getMin().lat) + "," + ZDC.degToms(ZdcEmapSearchBox.getMin().lon) + "," + ZDC.degToms(ZdcEmapSearchBox.getMax().lat) + "," + ZDC.degToms(ZdcEmapSearchBox.getMax().lon); var parm = ""; parm += "&latlon="+boxLatLon; // フラグ・自由項目取得 freeParamStr = getFreeParamsCust(); parm += freeParamStr; // 絞込条件取得 condParamStr = getCondParamsCust(); ZdcEmapSearchNearShop(lat, lon, "", "", parm, condParamStr, 1, 'ZdcEmapSearchNShopList'); } /* * 地図をリサイズ * ヘッダ画像追加で下がった分、地図を小さくする */ function resizeMapHeight(){ // 各パーツの高さを取得 var headerHeight = $('.cond-modal-header').height(); var formHeight = $('.map-search-menu').height(); var listHeight = $('#slide-control-open').height(); var bufferHeight = 25; var windowHeight = $(window).height(); // 地図エリアの高さを再算出 var partsHeightSum = (headerHeight + formHeight + listHeight + 25); var newMapHeight = windowHeight - partsHeightSum; // スケール・コピーライトが切れないように地図を上にずらす(iphoneのみ) adjustMapPosition(); // 地図エリアの縦幅をセットしなおす $('#ZdcEmapMap.map').css('height', newMapHeight + 'px'); } /* * デバイスごとにbodyにclassを設定 */ function setUaClass(){ // iPhone var uaInfoIphone = navigator.userAgent.indexOf('iPhone'); if(0 < uaInfoIphone){ $("body").addClass("iphone"); } // Android var uaInfoAndroid = navigator.userAgent.indexOf('Android'); if(0 < uaInfoAndroid){ $("body").addClass("android"); } } /* * 地図の位置調整 * スケール・コピーライトが切れないように地図を上にずらす(iphoneのみ) */ function adjustMapPosition(){ var screenHeight = window.screen.height; // Retina 4(iphone5, 5s, 5c, SE)のとき if(screenHeight == '568'){ $('body.z_map_body.iphone #ZdcEmapMap.map').css('transform', 'translateY(-16%)'); // RetinaHD 4.7(iphone6, 6s, 7, 8, SE2)のとき }else if(screenHeight == '667'){ $('body.z_map_body.iphone #ZdcEmapMap.map').css('transform', 'translateY(-15%)'); // RetinaHD 5.5(iphone6, 6s, 7, 8plus)のとき }else if(screenHeight == '736'){ $('body.z_map_body.iphone #ZdcEmapMap.map').css('transform', 'translateY(-13%)'); // iphoneX }else if(screenHeight == '812'){ $('body.z_map_body.iphone #ZdcEmapMap.map').css('transform', 'translateY(-11%)'); // それ以外 }else{ $('body.z_map_body.iphone #ZdcEmapMap.map').css('transform', 'translateY(-10%)'); } }