PageSourceSearch

https://www.eaubonne.fr/wp-content/cache/min/1/wp-content/themes/e…/libs/nova-osm/nova-osm.js?ver=1782810687

js eaubonne.fr collected 2026-10-02 11:40:24 UTC 8,620 bytes, 44 lines download raw bytes

1(function($){$.fn.osm=function(options){this.$canvas=$(this)
2this.$markers=this.$canvas.find('.marker')
3this.throttle=function(callback,delay){var last;var timer;return function(){var context=this;var now=+new Date();var args=arguments;if(last&&now<last+delay){clearTimeout(timer);timer=setTimeout(function(){last=now;callback.apply(context,args)},delay)}else{last=now;callback.apply(context,args)}}}
4this.debounce=function(callback,delay){var timer;return function(){var args=arguments;var context=this;clearTimeout(timer);timer=setTimeout(function(){callback.apply(context,args)},delay)}}
5this.initialize=function(){var defaults_settings={zoom:14,lat:0,lng:0,paddingBreakpoint:1200,padding:[40,40,40,40],markerCluster:!0,markers:{},mapboxToken:'',forceTileLayer:'',disableScrollZoom:!0,};this.settings=$.extend({},defaults_settings,options);if(typeof L.markerClusterGroup!=='function'){this.settings.markerCluster=!1}
6this.settings.padding={top:this.settings.padding[0],right:this.settings.padding[1],bottom:this.settings.padding[2],left:this.settings.padding[3],}
7this.initializeMap();return this}
8this.initializeMap=function(){var self=this,map,latLng=self.newLatLng(self.settings.lat,self.settings.lng);promises=[];map=L.map(self[0]).setView(latLng,parseInt(self.settings.zoom));if(this.settings.disableScrollZoom==!0){map.scrollWheelZoom.disable()}
9var tileLayer='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';if(this.settings.mapboxToken!==''){var tileLayer='https://api.mapbox.com/styles/v1/mapbox/streets-v9/tiles/256/{z}/{x}/{y}@2x?access_token='+this.settings.mapboxToken}
10if(this.settings.forceTileLayer!==''){var tileLayer=this.settings.forceTileLayer}
11var attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>';L.tileLayer(tileLayer,{attribution:attribution,}).addTo(map);map.markers=[];map.bounds=[];if(self.settings.markerCluster){map.clusterGroup=L.markerClusterGroup()}
12for(var i=0;i<self.settings.markers.length;i++){promises=self.addMarker(map,self.settings.markers[i],promises)}
13if(self.settings.markerCluster){map.addLayer(map.clusterGroup)}
14self.addMapEvents(map);self.map=map;Promise.all(promises).then(function(data){self.center()})}
15this.newLatLng=function(lat,lng){return L.latLng(parseFloat(lat),parseFloat(lng))},this.getWindowSize=function(){var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;return{width:x,height:y}},this.addMarker=function(map,marker,promises){var self=this,bounds;var marker_defaults_settings={file:'',lat:'',lng:'',html:'',iconUrl:'',iconSize:[32,37],};marker=$.extend({},marker_defaults_settings,marker);if(typeof marker.iconSize==='string'){marker.iconSize=marker.iconSize.split(',')}
16if(marker.file!==''){var extension=marker.file.split('.').pop()
17if(extension=='kmz'){var kmz=marker.file;promises.push(fetch(kmz).then(function(response){if(response.status===200||response.status===0){return Promise.resolve(response.blob())}else{return Promise.reject(new Error(response.statusText))}}).then(JSZip.loadAsync).then(function(zip){var kml='';var zipPromises=[];var imgFormats=['jpg','jpeg','png','gif','svg'];zip.forEach(function(relativePath,file){var extension=relativePath.split('.').pop();if(extension=='kml'){zipPromises.push(zip.file(relativePath).async('string').then(function(kml){var imgPromises=[];var editedKml=kml;zip.forEach(function(relativePath,file){var extension=relativePath.split('.').pop();var mimetype='';if(imgFormats.indexOf(extension)){if(extension=='jpg'){mimetype='image/jpeg'}else if(extension=='svg'){mimetype='image/svg+xml'}else{mimetype='image/'+extension}
18imgPromises.push(zip.file(relativePath).async('base64').then(function(content){editedKml=editedKml.replace(relativePath,'data:'+mimetype+';base64,'+content)}))}});return Promise.all(imgPromises).then(function(data){return editedKml})}))}});return Promise.all(zipPromises).then(function(data){return data[0]})}).then(function success(kml){var parser=new DOMParser();kml=parser.parseFromString(kml,'text/xml');for(var i=kml.getElementsByTagName('description').length-1;i>=0;i--){kml.getElementsByTagName('description')[i].textContent=self.linkify(kml.getElementsByTagName('description')[i].textContent)}
19var track=new L.KML(kml)
20if(self.settings.markerCluster){map.clusterGroup.addLayer(track)}else{track.addTo(map)}
21bounds=track.getBounds()
22map.bounds.push(bounds.getNorthEast());
22map.bounds.push(bounds.getSouthWest())},function error(e){console.log('Une erreur est survenue sur l\'affichage d\'un kmz')}))}else if(extension=='kml'){promises.push(fetch(marker.file).then(function(response){return response.text()}).then(function(kml){var parser=new DOMParser();kml=parser.parseFromString(kml,'text/xml');for(var i=kml.getElementsByTagName('description').length-1;i>=0;i--){kml.getElementsByTagName('description')[i].textContent=self.linkify(kml.getElementsByTagName('description')[i].textContent)}
23var track=new L.KML(kml)
24if(self.settings.markerCluster){map.clusterGroup.addLayer(track)}else{track.addTo(map)}
25bounds=track.getBounds()
26map.bounds.push(bounds.getNorthEast());map.bounds.push(bounds.getSouthWest())}))}else if(extension=='geojson'){promises.push(fetch(marker.file).then(function(response){return response.json()}).then(function(data){var track=new L.geoJSON(data,{onEachFeature:function(feature,layer){if(feature.properties&&(feature.properties.name||feature.properties.nom||feature.properties.popupContent)){var content='<div class="infowindow">';content+='<div class="infowindow-body">';if(feature.properties.name){content+='<h3 class="infowindow-title">'+feature.properties.name+'</h3>'}
27if(feature.properties.nom){content+='<h3 class="infowindow-title">'+feature.properties.nom+'</h3>'}
28if(feature.properties.popupContent){content+='<div class="infowindow-text">'+feature.properties.popupContent+'</div>'}
29content+='</div>';content+='</div>';if(content!==''){layer.bindPopup(content)}}}})
30if(self.settings.markerCluster){map.clusterGroup.addLayer(track)}else{track.addTo(map)}
31bounds=track.getBounds()
32map.bounds.push(bounds.getNorthEast());
32map.bounds.push(bounds.getSouthWest())}))}}
33if(marker.lat!==''&&marker.lng!==''){var latLng=self.newLatLng(marker.lat,marker.lng),new_marker;if(marker.iconUrl!==''){var icon=L.icon({iconUrl:marker.iconUrl,iconSize:[marker.iconSize[0],marker.iconSize[1]],iconAnchor:(marker.iconAnchor!=undefined&&marker.iconAnchor!=='')?marker.iconAnchor:[marker.iconSize[0]/2,marker.iconSize[1]],popupAnchor:(marker.popupAnchor!=undefined&&marker.popupAnchor!=='')?marker.popupAnchor:[0,(marker.iconSize[1]*-1)]});new_marker=L.marker(latLng,{icon:icon})}else{new_marker=L.marker(latLng)}
34if(marker.html!==''){new_marker.bindPopup(marker.html,{maxWidth:600})}
35map.bounds.push([marker.lat,marker.lng]);map.markers.push(new_marker);if(self.settings.markerCluster){map.clusterGroup.addLayer(new_marker)}else{new_marker.addTo(map)}}
36return promises}
37this.addMapEvents=function(map){var self=this;map.on('popupopen',function(e){var px=map.project(e.popup._latlng);px.y-=e.popup._container.clientHeight/2
38if(self.getWindowSize().width>parseInt(self.settings.paddingBreakpoint)){px.x=px.x-(self.settings.padding.left/2)+(self.settings.padding.right/2)
39px.y=px.y-(self.settings.padding.top/2)+(self.settings.padding.bottom/2)}
40map.panTo(map.unproject(px),{animate:!0})});$(window).on('resize',debounce(function(e){self.center()},150))}
41this.center=function(){var self=this;if(self.map.bounds.length){bounds=new L.LatLngBounds(self.map.bounds);if(self.getWindowSize().width>parseInt(self.settings.paddingBreakpoint)){self.map.fitBounds(bounds,{paddingTopLeft:[self.settings.padding.left,self.settings.padding.top],paddingBottomRight:[self.settings.padding.right,self.settings.padding.bottom],maxZoom:this.settings.zoom,})}else{self.map.fitBounds(bounds,{maxZoom:this.settings.zoom})}}}
42this.refresh=function(){var self=this;self.map.invalidateSize(!0)}
43this.linkify=function(inputText){var replacedText,replacePattern1,replacePattern2,replacePattern3;replacePattern1=/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;replacedText=inputText.replace(replacePattern1,'<a href="$1" target="_blank">$1</a>');replacePattern2=/(^|[^\/])(www\.[\S]+(\b|$))/gim;replacedText=replacedText.replace(replacePattern2,'$1<a href="http://$2" target="_blank">$2</a>');replacePattern3=/(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;replacedText=replacedText.replace(replacePattern3,'<a href="mailto:$1">$1</a>');return replacedText}
44return this.initialize()}}(jQuery))

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.