PageSourceSearch

https://www.sante-numerique-normandie.fr/theme_front/theme_front_1…/drivers/OSM/geoloc.min.js?1789406637

js sante-numerique-normandie.fr collected 2026-10-10 00:09:37 UTC 11,679 bytes, 1 lines download raw bytes

1var geoloc=function(){"use strict";this.coBounds=L.latLngBounds();this.caGeocoderState=[];this.cbDebug=false;this.cbUseMapbox=false;this.caMapboxParams=false;this.caMarker=[];this.ciNbMarkers=0;if(js_constant["display_cluster"]==1){this.coMarkersCluster=L.markerClusterGroup()}};geoloc.prototype={debug:function(amLog){if(this.cbDebug){console.log(amLog)}},init:function(asMapId,aaOption){this.debug("init()");if(typeof aaOption=="undefined"){aaOption={}}this.coMapOption=aaOption;if(typeof aaOption.customLatitude!="undefined"&&aaOption.customLatitude!=""&&typeof aaOption.customLongitude!="undefined"&&aaOption.customLongitude!=""){this.coCenterLatLng=L.latLng(aaOption.customLatitude,aaOption.customLongitude);aaOption.center=this.coCenterLatLng}else if(typeof aaOption.customLatLng!="undefined"){this.coCenterLatLng=L.latLng(aaOption.customLatLng);aaOption.center=this.coCenterLatLng}var lsZoomPosition="";if(aaOption.hasOwnProperty("zoomControl")&&aaOption.zoomControl&&aaOption.hasOwnProperty("zoomControlPosition")){lsZoomPosition=aaOption.zoomControlPosition;aaOption.zoomControl=false;delete aaOption.zoomControlPosition}this.$coMap=$("#"+asMapId);var laLayers=[];if(typeof js_constant["mapbox_styles"]!="undefined"){if(typeof aaOption.mapTypeControl!="undefined"&&aaOption.mapTypeControl==true){laLayers=[]}var loStylesOptions=js_constant["mapbox_styles"];if(typeof loStylesOptions.token!="undefined"&&loStylesOptions.token!=""){this.cbUseMapbox=true;this.caMapboxParams=loStylesOptions;laLayers["MapBox"]=L.tileLayer("https://api.mapbox.com/styles/v1/"+loStylesOptions.username+"/"+loStylesOptions.style_id+"/tiles/256/{z}/{x}/{y}?access_token="+loStylesOptions.token)}}if(!this.cbUseMapbox){laLayers["OpenStreetMap"]=L.tileLayer("https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png")}aaOption.layers=[];for(var liIndex in laLayers){aaOption.layers.push(laLayers[liIndex])}if(typeof aaOption.scrollwheel!="undefined"&&aaOption.scrollwheel==false){aaOption.scrollWheelZoom=false}if(typeof aaOption.draggable!="undefined"&&aaOption.draggable==false){aaOption.dragging=false}this.coMap=L.map(asMapId,aaOption);if(typeof aaOption.mapTypeControl!="undefined"&&aaOption.mapTypeControl==true){L.control.layers(laLayers).addTo(this.coMap)}if(lsZoomPosition){L.control.zoom({position:lsZoomPosition}).addTo(this.coMap)}if(typeof aaOption.scaleControl!="undefined"&&aaOption.scaleControl==true){L.control.scale().addTo(this.coMap)}this.coMap.attributionControl.addAttribution('&copy; <a href="https://www.openstreetmap.org/copyright" class="osm_copyright">OpenStreetMap</a> contributors')},draw:function(){this.debug("draw()");if(typeof this.coMapOption.center!="undefined"&&this.coMapOption.centerMarker==true){this.setMarker(this.coMapOption.center)}this.fitBounds();var lsZoom=this.coMapOption.zoom;if(this.ciNbMarkers==1&&typeof lsZoom!="undefined"){this.setZoom(lsZoom)}if(this.ciNbMarkers==1&&js_constant["display_cluster"]==1){this.caMarker[0].addTo(this.coMap)}},getCenterLatLng:function(){return this.coCenterLatLng},fitBounds:function(aoGeoloc){this.debug("fitBounds()");if(typeof aoGeoloc=="undefined"){aoGeoloc=this}if(aoGeoloc.caGeocoderState.length==0){if(aoGeoloc.caMarker.length>=2){aoGeoloc.coMap.fitBounds(aoGeoloc.coBounds,{padding:[50,50]})}else if(aoGeoloc.caMarker.length==1){aoGeoloc.coMap.setView(aoGeoloc.coBounds.getCenter());aoGeoloc.coMap.setZoom(13)}}else{setTimeout(function(aoGeoloc){aoGeoloc.fitBounds(aoGeoloc)},50,aoGeoloc)}},setMarker:function(aoPosition,aaOption){this.debug("setMarker()");if(aoPosition===undefined){return}this.ciNbMarkers++;if(typeof aaOption=="undefined"){aaOption={}}if(typeof aaOption.customData=="undefined"){aaOption.customData=null}if(typeof aaOption.icon=="undefined"||aaOption.icon==""){aaOption.icon=goGeoloc.getMarkerIcon()}else if(typeof aaOption.icon=="string"){aaOption.icon=goGeoloc.getMarkerIconCard(aaOption.icon)}else if(aaOption.icon!="undefined"){delete aaOption.icon}var loMarker=L.marker(aoPosition,aaOption);if(typeof aaOption.InfoWindow!="undefined"){loMarker.bindPopup(aaOption.InfoWindow)}else{goGeoloc.setClickable(loMarker,false)}if(typeof aaOption.opened!="undefined"&&aaOption.opened==true){goGeoloc.setClickable(loMarker,true);var loNewPosition=L.latLng(loMarker.getLatLng().lat,loMarker.getLatLng().lng);
1this.coMap.setView(loNewPosition);this.getPopin(loMarker,aaOption.type,aaOption.id)}if(typeof aaOption.url!="undefined"&&aaOption.url!=""){if(window.location.pathname+window.location.search!=aaOption.url){goGeoloc.setClickable(loMarker,true);L.DomEvent.on(loMarker,"click",function(){location.href=aaOption.url})}}if(js_constant["display_cluster"]==1){this.coMarkersCluster.addLayer(loMarker)}else{loMarker.addTo(this.coMap)}if(typeof aaOption.id=="undefined"){this.caMarker.push(loMarker)}else{this.caMarker[aaOption.id]=loMarker}this.coBounds.extend(aoPosition);return loMarker},setMarkerFromLatLng:function(afLat,afLng,aaOption){this.debug("setMarkerFromLatLng()");if(!afLat||!afLng){return}var loLatLng=L.latLng(afLat,afLng);return this.setMarker(loLatLng,aaOption)},setMarkerFromAddress:function(asAddress,aaOption){this.debug("setMarkerFromAddress()");if(!asAddress){return}var loGeoloc=this;this.caGeocoderState.push(asAddress);if(this.cbUseMapbox){L.Control.Geocoder.mapbox(this.caMapboxParams.token).geocode(asAddress,function(aaResults){loGeoloc.callbackGeocode(aaResults,asAddress,loGeoloc,aaOption)})}else{L.Control.Geocoder.nominatim().geocode(asAddress,function(aaResults){loGeoloc.callbackGeocode(aaResults,asAddress,loGeoloc,aaOption)})}},callbackGeocode:function(aaResults,asAddress,aoGeoloc,aaOption){if(aaResults.length>0){for(var liIndex in aaResults){var loResult=aaResults[liIndex];if(typeof loResult.center!="undefined"){var loMarker=aoGeoloc.setMarker(loResult.center,aaOption);$(window).trigger("ideoportal.geoloc.callbackGeocode",[loMarker]);aoGeoloc.removeAddress(aoGeoloc,asAddress);aoGeoloc.setAddressCoords(asAddress,loResult.center.lat,loResult.center.lng);break}}}else{aoGeoloc.setAddressCoords(asAddress,0,0,function(aoCoords){if(typeof aoCoords.adr_latitude!="undefined"&&typeof aoCoords.adr_longitude!="undefined"){var loMarker=aoGeoloc.setMarkerFromLatLng(aoCoords.adr_latitude,aoCoords.adr_longitude,aaOption);$(window).trigger("ideoportal.geoloc.callbackGeocode",[loMarker])}aoGeoloc.removeAddress(aoGeoloc,asAddress)})}},removeAddress:function(aoGeoloc,asAddress){var liIndex=aoGeoloc.caGeocoderState.indexOf(asAddress);if(liIndex!==-1){aoGeoloc.caGeocoderState.splice(liIndex,1)}},getMarkers:function(){return this.caMarker},getMarker:function(amId){return this.caMarker[amId]},resetMarkers:function(){this.caMarker=[]},getMarkerIcon:function(){this.debug("getMarkerIcon()");var lsPinpointPath="";if(goIdeoportal.getJsConstant("pinpoint_img")!==null){lsPinpointPath=goIdeoportal.getJsConstant("pinpoint_img")}else if(typeof images_skin_path!=="undefined"){lsPinpointPath=images_skin_path+"picto/pinpoint.png"}else{lsPinpointPath=images_front_path+"module/geoloc/pinpoint.png"}return L.icon(this.addMarkerOptions({iconUrl:lsPinpointPath}))},getMarkerIconCard:function(asUrl){this.debug("getMarkerIconCard() "+asUrl);return L.icon(this.addMarkerOptions({iconUrl:asUrl}))},addMarkerOptions:function(aoOptions){var liPinpointWidth=parseInt(goIdeoportal.getJsConstant("pinpoint_width"))?parseInt(goIdeoportal.getJsConstant("pinpoint_width")):60;var liPinpointHeight=parseInt(goIdeoportal.getJsConstant("pinpoint_height"))?parseInt(goIdeoportal.getJsConstant("pinpoint_height")):70;var liPinpointAnchorX=parseInt(goIdeoportal.getJsConstant("pinpoint_anchor_x"))?parseInt(goIdeoportal.getJsConstant("pinpoint_anchor_x")):30;var liPinpointAnchorY=parseInt(goIdeoportal.getJsConstant("pinpoint_anchor_y"))?parseInt(goIdeoportal.getJsConstant("pinpoint_anchor_y")):68;aoOptions.iconSize=[liPinpointWidth,liPinpointHeight];aoOptions.iconAnchor=[liPinpointAnchorX,liPinpointAnchorY];return aoOptions},getMarkerOptions:function(aoMarker){this.debug("getMarkerOptions()");return aoMarker.options},onMarkerEvent:function(asEvent,aoMarker,aoCallback){this.debug("onMarkerEvent()");L.DomEvent.on(aoMarker,asEvent,aoCallback)},setClickable:function(aoMarker,abClickable){this.debug("setClickable()");if(typeof aoMarker.valueOf()._icon!="undefined"){if(abClickable){aoMarker.valueOf()._icon.style.cursor="grab"}else{aoMarker.valueOf()._icon.style.cursor="none"}}},setZoom:function(aiZoom){this.coMap.setZoom(aiZoom)},openPopin:function(amId){var loMarker=goGeoloc.getMarker(amId);var loNewPosition=L.latLng(loMarker.getLatLng().lat,loMarker.getLatLng().lng);
1this.coMap.setView(loNewPosition);loMarker.fire("click");$("html, body").animate({scrollTop:this.$coMap.offset().top},500)},getPopin:function(aoMarker,asType,amId){var lsCompId="";if(typeof geoloc_comp_id!="undefined"){lsCompId="&comp_id="+geoloc_comp_id}var loInfowindow=L.popup().setLatLng(aoMarker.getLatLng()).setContent("").openOn(this.coMap).setContent("Chargement...");$.ajax({type:"GET",url:goIdeoportal.getServiceAjaxUrl("geoloc","getPopin",{type:encodeURIComponent(asType),id:amId})+"&"+(new Date).getDate()+lsCompId,success:function(response){loInfowindow.setContent(response)}})},setAddressCoords:function(asAddress,afLat,afLng,aoHandleData){$.ajax({type:"GET",url:goIdeoportal.getServiceAjaxUrl("geoloc","setAddressCoords",{address:encodeURIComponent(asAddress),lat:afLat,lng:afLng})+"&"+(new Date).getDate(),dataType:"json",success:function(aoResponse){if(typeof aoHandleData!="undefined"){aoHandleData(aoResponse)}}})},activateMarkerClusterer:function(){this.debug("activateMarkerClusterer()");if(js_constant["display_cluster"]==1){this.coMap.addLayer(this.coMarkersCluster)}},loadItineraire:function(amAddressId){this.debug("loadItineraire()");var loGeoloc=this;var lsAddressStart=document.getElementById("adrDepart"+amAddressId).value;if(loGeoloc.cbUseMapbox){L.Control.Geocoder.mapbox(loGeoloc.caMapboxParams.token).geocode(lsAddressStart,function(aaResults){if(aaResults.length>0){for(var liIndex in aaResults){var loResult=aaResults[liIndex];if(typeof loResult.center!="undefined"){loGeoloc.callbackItinerary(amAddressId,loResult.center,loGeoloc);break}}}})}else{L.Control.Geocoder.nominatim().geocode(lsAddressStart,function(aaResults){if(aaResults.length>0){for(var liIndex in aaResults){var loResult=aaResults[liIndex];if(typeof loResult.center!="undefined"){loGeoloc.callbackItinerary(amAddressId,loResult.center,loGeoloc);break}}}})}},callbackItinerary:function(amAddressId,aoPositionStart,aoGeoloc){aoGeoloc.debug("callbackItinerary()");var loMarker=aoGeoloc.getMarker(amAddressId);if(aoGeoloc.cbUseMapbox){aoGeoloc.debug("callbackItinerary() route Mapbox");var loRouting=L.Routing.control({waypoints:[aoPositionStart,loMarker.getLatLng()],router:L.Routing.mapbox(aoGeoloc.caMapboxParams.token),geocoder:L.Control.Geocoder.mapbox(aoGeoloc.caMapboxParams.token)})}else{aoGeoloc.debug("callbackItinerary() route OSM");var loRouting=L.Routing.control({waypoints:[aoPositionStart,loMarker.getLatLng()],router:new L.Routing.osrmv1({language:"fr",profile:"car"}),geocoder:L.Control.Geocoder.nominatim({})})}loRouting.on("routingstart",function(){aoGeoloc.debug("routingstart")}).on("routingerror",function(){aoGeoloc.debug("routingerror");$("#error_geocoding").show()}).addTo(aoGeoloc.coMap)},addKml:function(asKml){var loTrack=new L.KML(asKml+"?"+(new Date).getDate(),{async:true});this.coMap.addLayer(loTrack)},refresh:function(){if(this.coMap!==undefined){this.coMap.invalidateSize();this.draw()}},getMapZoom:function(){return this.coMap._zoom},getMapLat:function(){return this.coMap._lastCenter.lat},getMapLng:function(){return this.coMap._lastCenter.lng}};var goGeoloc=new geoloc;

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.