PageSourceSearch

https://www.unat.asso.fr/wp-content/themes/unat/js/map.js?ver=1.0

js unat.asso.fr collected 2026-10-02 04:29:41 UTC 5,997 bytes, 185 lines download raw bytes

1(function ($, window) {
2
3	var iconMarker = L.icon({
4		iconUrl: '/wp-content/themes/unat/img/leaflet/marker-icon.png',
5		iconSize:     [25, 25], // size of the icon
6		iconAnchor:   [9, 25], // point of the icon which will correspond to marker's location
7		popupAnchor:  [0, -25] // point from which the popup should open relative to the iconAnchor
8	});
9	
10	var iconMarkerSelected = L.icon({
11		iconUrl: '/wp-content/themes/unat/img/leaflet/marker-icon-hover.png',
12		iconSize:     [25, 25], // size of the icon
13		iconAnchor:   [9, 25], // point of the icon which will correspond to marker's location
14		popupAnchor:  [0, -25] // point from which the popup should open relative to the iconAnchor
15	});
16
17
18	// on change l'icon au clic
19	function markerOnClick(e){
20		//initIcon();
21		e.target.setIcon(iconMarkerSelected);
22	}
23
24	function initIcon(){
25		$(".leaflet-marker-pane img").each(function(){
26			$(this).attr('src','/wp-content/themes/unat/img/leaflet/marker-icon.png');
27		});
28	}
29
30	function markerFunction(id, markers){
31		for (var i in markers){
32			var markerID = markers[i].options.title;
33			if (markerID == id){
34				markers[i].openPopup();
35			};
36		}
37	}
38		
39	
40
41	// Map for page "Trouver un membre" 
42	if($("#map").length && $("#listing-membres").length ) {   
43		$( '<div id="map" class="map"></div>' ).insertAfter( "#map" );
44		$("#map").remove();
45			
46		// Create map and set center and zoom.
47		var map = L.map('map', { // The `L` stands for the Leaflet library.
48			scrollWheelZoom: false,
49			center: [48.866667, 2.333333],
50			zoom: 5
51		});
52
53		map.zoomControl.setPosition('topright');
54
55		var baseLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
56			attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
57		});
58		
59		// Add basemap to map.
60		map.addLayer(baseLayer);
61	
62		var markers = [];
63
64		$('#listing-membres .item-membres .item-membre').each(function() {
65			var lat = $(this).find('.lat').html();
66			var lng = $(this).find('.lng').html();
67			var title = $(this).find('.title').html();
68			var idMembre = $(this).find('.idMembre').html();
69			var url = $(this).find('.url').html();
70			var type = $(this).find('.type').html();
71			var adresse = $(this).find('.adresse').html();
72			var code_postal = $(this).find('.code_postal').html();
73			var ville = $(this).find('.ville').html();
74			
75			
76			var latlngs = [];
77		
78
79			marker = L.marker([lat, lng], {title: "marker-" + idMembre, icon: iconMarker}).on('click', markerOnClick);
80
81			var popupContent = '<div class="popup-inside">'
82                +'<a href="'+url+'" target="_blank">'+
83                	'<div class="titre_popup">'+title+'</div>'+
84					'<div class="adresse">'+adresse+'</div>'+
85					'<div class="ville">'+ville+'</div>'+
86					'<div class="code_postal">'+code_postal+'</div>'
87                +'</div></a>'
88			+'</div>';
89
90			marker.bindPopup(popupContent);
91			markers.push(marker);
92			latlngs.push(marker.getLatLng());
93			marker.getPopup().on('remove', function() {
94				initIcon();
95			});
96
97			L.featureGroup(markers).addTo(map);		
98		});
99		
100		//relier point carte avec son lien
101		$('#listing-membres .item-membre').hover(function() {
102			initIcon();
103			var idMembre = $(this).find('.idMembre').html();
104			var titleMarqueur = "marker-"+idMembre;
105			markerFunction(titleMarqueur, markers);
106			$("img[title='"+titleMarqueur+"']").attr('src','/wp-content/themes/unat/img/leaflet/marker-icon-hover.png');
107		});		
108	}
109
110	// Map for page "Trouver une UNAT" 
111	if($("#map").length && $("#listing-unats").length ) {   
112		$( '<div id="map" class="map"></div>' ).insertAfter( "#map" );
113		$("#map").remove();
114			
115		// Create map and set center and zoom.
116		var map = L.map('map', { // The `L` stands for the Leaflet library.
117			scrollWheelZoom: false,
118			center: [46.5605327, 2.2086141],
119			zoom: 5
120		});
121
122		map.zoomControl.setPosition('topright');
123
124		var baseLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
125			attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
126		});
127		
128		// Add basemap to map.
129		map.addLayer(baseLayer);
130	
131		var markers = [];
132
133		$('#listing-unats .item-unats .item-unat').each(function() {
134			var lat = $(this).find('.lat').html();
135			var lng = $(this).find('.lng').html();
136			var title = $(this).find('.title').html();
137			var idUnat = $(this).find('.idUnat').html();
138			var url = $(this).find('.url').html();
139			var adresse = $(this).find('.adresse').html();
140			var code_postal = $(this).find('.code_postal').html();
141			var ville = $(this).find('.ville').html();
142			var telephone = $(this).find('.telephone').html();
143			var mail = $(this).find('.mail').html();
144			
145			
146			var latlngs = [];
147		
148
149			marker = L.marker([lat, lng], {title: "marker-" + idUnat, icon: iconMarker}).on('click', markerOnClick);
150
151			var popupContent = '<div class="popup-inside">'
152                +'<a href="'+url+'" target="_blank">'+
153                	'<div class="titre_popup">'+title+'</div>'+
154					'<div class="adresse">'+adresse+' - </div>'+
155					'<div class="code_postal">'+code_postal+'</div>'+
156					'<div class="ville">'+ville+'</div>'+
157					'<div class="tel">Téléphone : '+telephone+'</div>'+
158					'<div class="mail">E-mail : '+mail+'</div>'
159                +'</div></a>'
160			+'</div>';
161
162			marker.bindPopup(popupContent);
163			markers.push(marker);
164			latlngs.push(marker.getLatLng());
165			marker.getPopup().on('remove', function() {
166				initIcon();
167			});
168
169			L.featureGroup(markers).addTo(map);		
170		});
171		
172		//relier point carte avec son lien
173		$('#listing-unats .item-unat').hover(function() {
174			initIcon();
175			var idUnat = $(this).find('.idUnat').html();
176			var titleMarqueur = "marker-"+idUnat;
177			markerFunction(titleMarqueur, markers);
178			$("img[title='"+titleMarqueur+"']").attr('src','/wp-content/themes/unat/img/leaflet/marker-icon-hover.png');
179		});		
180	}
181
182
183	
184	
185})(jQuery, this);

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.