/*---------------------------------------------------- アコーディオン ----------------------------------------------------*/ $(function(){ $(".cate_ttl").on("click", function() { if( !$(this).hasClass("modal_open") ){ $(this).toggleClass("close"); $(this).next(".cate_cont").slideToggle(300); updatemenustate(); } }); }); function menuToggle( blink ){ if( typeof blink=="undefined" ) blink = false; $("#sidebar_btn").toggleClass("close"); $("#sidebar_btn_thumb").toggleClass("close"); $("#sidebar_btn_thumb").next("#sidebar").toggleClass("close"); $("#colors").toggleClass("close"); if( blink ){ setTimeout( function(){ menublink( 2 ); }, 300 ); } } function menublink( count ){ $("#sidebar_btn").animate({"opacity":0.5},300,"swing",function(){ $("#sidebar_btn").animate({"opacity":1.0},300,"swing",function(){ if( count>0 ) menublink( count-1 ); }); }); } $(function(){ $("#sidebar_btn").on("click", function() { menuToggle(); }); }); var timer = null; $(window).on('load', function() { timer = setTimeout(function(){ timer = null; menuToggle( true ); // $("#sidebar").off("click"); }, 4000); }); $(function(){ $("#sidebar").on("click", function() { if( timer ){ clearTimeout( timer ); timer = null; // $("#sidebar").off("click"); } climbingrecordinput( false ); }); }); /*メニューのタブ表示非表示*/ /* $(function(){ $("#cb_accident").change(function() { var cb = $('#cb_accident').prop('checked'); if(cb){ $("#sidebar_btn_thumb").addClass('on inactive'); }else{ $("#sidebar_btn_thumb").removeClass('on'); } }); }); */ /*メニューのタブ切り替え*/ $(function(){ $("#sidebar_btn_thumb").on("click", function() { $(this).toggleClass("inactive"); $("#analyzerthumb").toggleClass('on'); $("#analyzermenu").toggleClass('off'); if( $("#sidebar_btn").hasClass("close") ) menuToggle(); }); }); /*---------------------------------------------------- モーダル ----------------------------------------------------*/ $(function(){ $('.modal_open').each(function(){ $(this).on('click',function(e){ var target = $(this).data('target'); var modal = document.getElementById(target); $('.modeless').fadeOut(); marker.clearMarker(); $(modal).fadeIn(); e.stopPropagation(); var anchor = $(this).data('anchor'); if( anchor ){ var cont = $(modal).find(".modal_cont"); cont.scrollTop( 0 ); setTimeout( function(){ var contpos = cont.position(); var anchorpos = $(modal).find("#"+target+"_"+anchor).position(); cont.scrollTop( anchorpos['top']-contpos['top'] ); }, 100 ); } }); }); $('.modal_close').on('click',function(){ $(this).closest('.modalwrap').fadeOut(); return false; }); $('.modeless_close').on('click',function(){ $(this).closest('.modeless').fadeOut(); marker.clearMarker(); return false; }); }); $(function(){ }); $(function(){ smoke.confirm( "ログインすることで各種機能をご利用いただけます", function(e){ if( e ){ location.href = "https://www.mt-compass.com/login.php?url="+encodeURIComponent("analyzer/"+window.location.search); } }, { 'ok':"ログインへ", 'cancel':"閉じる", 'classname':"", 'reverseButtons':true } ); }); var _BaseMap; var pointroute; var climbingrecord; var marker; var menublock = {"premiummenu":1,"footprint":1,"busyroute":0,"accidenthazard":0,"pointroute":0,"basemap":0}; class cInitialArea { constructor(){ } OnScrollEnd(){ } } $(function(){ var _InitialArea = new cInitialArea(); _BaseMap = new cBaseMap( "map", posx, posy, zoom, Array(), areaBounds ); var footprint = new cFootPrint( _BaseMap.map ); var mobile = new cMobile( _BaseMap.map ); pointroute = new cPointRoute( _BaseMap.map ); climbingrecord = new cClimbingRecord( _BaseMap.map ); marker = new cMarker( _BaseMap.map ); var footprintblock = $("#footprint").find("div.cate_cont"); var template = footprintblock.find("div.template"); for( var type in footprint.FootPrints ){ var node = template.clone(); node.removeClass( "template" ); var checked = footprint.FootPrints[type]['default']?true:false; var checkbox = node.find("input:checkbox"); checkbox.prop({'name':"footprint_"+type,'value':type,'checked':checked}); node.find("span").html(""+footprint.FootPrints[type]['name']); footprintblock.append( node ); checkbox.on( "change", function(){ footprint.showFootPrint( $(this).val(), $(this).prop('checked') ); updatemenustate(); } ); } template.remove(); var mobileblock = $("#mobile").find(".pulldown_sub"); var template = mobileblock.find("div.template"); for( var type in mobile.Mobile ){ var node = template.clone(); node.removeClass( "template" ); var checked = mobile.Mobile[type]['default']?true:false; var radio = node.find("input:radio"); radio.prop({'value':type,'checked':checked}); node.find("span").html(""+mobile.Mobile[type]['name']); mobileblock.append( node ); radio.on( "change", function(){ mobile.setMobile( $(this).val(), $(this).prop('checked') ); updatemenustate(); } ); if( checked ) mobile.setMobile( type ); } template.remove(); for( var id in menublock ){ if( menublock[id]==0 ){ $("#"+id+" .cate_ttl").addClass("close"); $("#"+id+" .cate_cont").css({'display':"none"}); } var checked = false; $("#"+id).find("input[type=checkbox]").each( function( index ){ if( $(this).prop("checked") ){ checked = true; } } ); if( checked ) $("#"+id+" .cate_ttl").addClass("checked"); } var type = $("#basemap").find("input:radio[name='maptype']:checked").val(); _BaseMap.setMapType( type ); pointroute.showPoint( $("#pointroute").find("select[name='pointtype']").val(), $("#pointroute").find("input:checkbox[name='mtpoint']").prop('checked') ); // 山頂・ルート・標高図 山頂アイコン footprint.setYear( $("#footprint").find("select[name='footprintyear']").val() ); // フットプリント 年 for( var type in footprint.FootPrints ){ footprint.showFootPrint( type, $("#footprint").find("input:checkbox[name='footprint_"+type+"']").prop('checked') ); // フットプリント 種類 } }); function getviewcenter( coord ){ var extent = _BaseMap.map.getView().calculateExtent(_BaseMap.map.getSize()); var coordinate; if( typeof coord=="undefined" ){ coordinate = ol.extent.getCenter( extent ); } else { coordinate = Array.from( coord ); } if( $(window).width()<=768 && !$("#sidebar").hasClass("close") ){ var up = ol.extent.getHeight(extent)*120/$(window).height(); if( typeof coord=="undefined" ){ coordinate[1] += up; } else { coordinate[1] -= up; } } return coordinate; } function accidenthazarddetail( point, id ){ window.open( point+"detail.php?id="+id ); } function climbingrecordshow( id, id2, add ){ if( typeof add=="undefined" ) add = false; setProgress( "climbingrecord", true ); $.ajax( { 'type':"POST", 'url':"ajax/climbingrecordpoint.php", 'dataType':"json", 'data':{'id':id,'id2':id2}, 'context':this, } ).done( function( data, textStatus, jqXHR ){ if( data['code']==0 ){ marker.setZIndex( 100 ); marker.setImg( "img/flagr.png" ); marker.showMarker( data['lon'], data['lat'] ); var modal = document.getElementById("climbingrecord"); var cont = $(modal).find(".modal_cont"); cont.find("dt").html(data['name']); cont.find("input[name='id']").val( id ); cont.find("input[name='id2']").val( id2 ); var list = cont.find("div.dialist"); list.empty(); for( var record of data['record'] ){ var rc; if( record['report']>0 ){ if( record['isrecord']==1 ){ rc = "登山記録確認"; } else { rc = "登山記録作成"; } } else { rc = "削除"; } list.append( $("

").addClass("txt").html(record['date']+rc) ); } $(modal).fadeIn(); climbingrecordmodal(); if( add && data['record'].length==0 ) climbingrecordedit( false ); } else { smoke.alert( data['message'] ); } } ).fail( function( jqXHR, textStatus, errorThrown ){ smoke.alert( "エラーが発生しました。" ); } ).always( function( data, textStatus, jqXHR ){ setProgress( "climbingrecord", false ); } ); } function climbingrecordmodal(){ var modal = document.getElementById("climbingrecord"); $(modal).find(".existsrecord").css({'display':"block"}); $(modal).find(".recordlist").css({'display':"block"}); $(modal).find(".recorddate").css({'display':"none"}); $(modal).find(".newrecord").css({'display':"none"}); } function climbingrecordedit( back ){ if( typeof back=="undefined" ) back = true; var modal = document.getElementById("climbingrecord"); $(modal).find(".recordlist").css({'display':"none"}); $(modal).find(".recorddate").css({'display':"block"}); $(modal).find(".recorddate").find("input").val(""); $(modal).find(".recorddate").find(".back").css({'display':back?"block":"none"}); } function climbingrecordeditcancel(){ var modal = document.getElementById("climbingrecord"); $(modal).find(".recordlist").css({'display':"block"}); $(modal).find(".recorddate").css({'display':"none"}); } function climbingrecordadd( node ){ node.disabled = "disabled"; var data = {}; $(node).closest("form").find("input").each( function( index, elm ){ data[elm.name] = $(elm).val(); } ); if( data['day']=="" ){ smoke.alert( "日付を指定してください。" ); node.disabled = ""; return; } $.ajax( { 'type':"POST", 'url':"ajax/climbingrecordadd.php", 'dataType':"json", 'data':data, 'context':this, } ).done( function( data, textStatus, jqXHR ){ if( data['code']==0 ){ climbingrecordshow( data['id'], data['id2'] ); climbingrecord.showClimbingRecord( true ); } else { smoke.alert( data['message'] ); } } ).fail( function( jqXHR, textStatus, errorThrown ){ smoke.alert( "エラーが発生しました。" ); } ).always( function( data, textStatus, jqXHR ){ node.disabled = ""; } ); } function climbingrecordnew( lonlat ){ marker.setZIndex( 100 ); marker.setImg( "img/flagr.png" ); marker.showMarker( lonlat[0], lonlat[1] ); var modal = document.getElementById("climbingrecord"); $(modal).find(".existsrecord").css({'display':"none"}); $(modal).find(".newrecord").css({'display':"block"}); $(modal).find(".newrecord").find("input").val(""); $(modal).find(".newrecord").find("input[name='lat']" ).val( lonlat[1] ); $(modal).find(".newrecord").find("input[name='lon']" ).val( lonlat[0] ); } function climbingrecordremove( node, id, id2, day ){ smokeconfirm( "登頂記録を削除してよろしいですか?", function(){ $.ajax( { 'type':"POST", 'url':"ajax/climbingrecordremove.php", 'dataType':"json", 'data':{'id':id,'id2':id2,'day':day}, 'context':this, } ).done( function( data, textStatus, jqXHR ){ if( data['code']==0 ){ $(node).closest("p").remove(); climbingrecord.showClimbingRecord( true ); } else { smoke.alert( data['message'] ); } } ).fail( function( jqXHR, textStatus, errorThrown ){ smoke.alert( "エラーが発生しました。" ); } ).always( function( data, textStatus, jqXHR ){ } ); } ); } function climbingrecordinput( on ){ if( on ){ var cr = $("#premiummenu").find("input:checkbox[name='climbingrecord']"); if( cr.prop('checked')==false ) cr.click(); pointroute.clickPointEvent( climbingrecordpointclick ); $("#pointroute").find("select[name='pointtype']").val("all").change(); var mp = $("#pointroute").find("input:checkbox[name='mtpoint']"); if( mp.prop('checked')==false ) mp.click(); $("div.togglebtn#climbingrecordinput").addClass("on"); } else { $("div.togglebtn#climbingrecordinput").removeClass("on"); pointroute.clickPointEvent( null ); $("#climbingrecord").fadeOut(); marker.clearMarker(); } } function climbingrecordpointclick( feature, coordinate ){ if( $("div.togglebtn#climbingrecordinput").hasClass("on") ){ climbingrecordshow( feature.get("id"), null, true ); } } function climbingrecordpointover( feature, coordinate, target ){ if( $("div.togglebtn#climbingrecordinput").hasClass("on") ){ target.css( 'cursor', "pointer" ); } } function OnMapClick( coordinate ){ if( $("div.togglebtn#climbingrecordinput").hasClass("on") ){ var modal = document.getElementById("climbingrecord"); $(modal).fadeIn(); climbingrecordnew( convertLonLat(coordinate) ); } } function climbingrecordadd2( node ){ node.disabled = "disabled"; var data = {}; $(node).closest("form").find("input").each( function( index, elm ){ data[elm.name] = $(elm).val(); } ); if( data['point']=="" ){ smoke.alert( "地点名を入力してください。" ); node.disabled = ""; return; } if( data['day']=="" ){ smoke.alert( "日付を指定してください。" ); node.disabled = ""; return; } $.ajax( { 'type':"POST", 'url':"ajax/climbingrecordadd.php", 'dataType':"json", 'data':data, 'context':this, } ).done( function( data, textStatus, jqXHR ){ if( data['code']==0 ){ climbingrecordshow( data['id'], data['id2'] ); climbingrecord.showClimbingRecord( true ); } else { smoke.alert( data['message'] ); } } ).fail( function( jqXHR, textStatus, errorThrown ){ smoke.alert( "エラーが発生しました。" ); } ).always( function( data, textStatus, jqXHR ){ node.disabled = ""; } ); } function updatemenustate(){ var analyzermenu = {}; for( var id in menublock ){ analyzermenu[id] = {}; analyzermenu[id]['open'] = $("#"+id+" .cate_ttl").hasClass("close")?0:1; var checked = false; $("#"+id).find("input[type=checkbox]").each( function( index ){ if( $(this).prop("checked") ){ checked = true; analyzermenu[id][$(this).prop("name")] = 1; } else { analyzermenu[id][$(this).prop("name")] = 0; } } ); if( checked ) $("#"+id+" .cate_ttl").addClass("checked"); else $("#"+id+" .cate_ttl").removeClass("checked"); $("#"+id).find("select").each( function( index ){ analyzermenu[id][$(this).prop("name")] = $(this).val(); } ); $("#"+id).find("input[type=radio]:checked").each( function( index ){ analyzermenu[id][$(this).prop("name")] = $(this).val(); } ); } }