resolve some errors in php logic, like strlen with str containing space that is interpreted as array instead of string
This commit is contained in:
82
plug/map_prof/scripts/mp_info_window.js
Normal file
82
plug/map_prof/scripts/mp_info_window.js
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
function attach_info_window(map, marker, events, infowindow) {
|
||||
|
||||
/*
|
||||
* https://developers.google.com/maps/documentation/javascript/infowindows
|
||||
* https://stackoverflow.com/questions/11106671/google-maps-api-multiple-markers-with-infowindows
|
||||
*/
|
||||
|
||||
let window_content = `
|
||||
<div id="infowindow_limits">
|
||||
<div class="infowindow">
|
||||
<div class="infowindow_head">
|
||||
<p>${events[0].location.address}</p>
|
||||
<div id="infowindow_close" onclick="g_infowindow.close()"></div>
|
||||
</div>
|
||||
`;
|
||||
for (key in events) {
|
||||
window_content += `
|
||||
<a class="infowindow_body" href="${events[key].url}">
|
||||
<p>${events[key].title}</p>
|
||||
</a>
|
||||
`;
|
||||
};
|
||||
window_content += `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
marker.addListener('click', () => {
|
||||
|
||||
let view_center = map.getCenter();
|
||||
// height must be half css value (mp_info_windows.css -> '--size: XXXpx;')
|
||||
let window_offset = { width: 0, height: 275 };
|
||||
|
||||
infowindow.setOptions({
|
||||
//disableAutoPan: true,
|
||||
disableAutoPan: false,
|
||||
content: window_content,
|
||||
|
||||
/* dimensions */
|
||||
//maxWidth: 400,
|
||||
//minWidth: 400,
|
||||
|
||||
/* center window */
|
||||
position: view_center,
|
||||
pixelOffset: window_offset,
|
||||
|
||||
//shouldFocus: false,
|
||||
});
|
||||
|
||||
infowindow.open(map);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
event : {}
|
||||
- heure_de_debut : "";
|
||||
- heure_de_fin : "";
|
||||
- categorie : "";
|
||||
- date : "";
|
||||
- pays : "";
|
||||
- ville : "";
|
||||
- adresse : "";
|
||||
- prenom : "";
|
||||
- nom : "";
|
||||
- irl : bool;
|
||||
- id : x;
|
||||
- index : x (default null);
|
||||
- title : "";
|
||||
- url : "";
|
||||
- location : {}
|
||||
- street : "";
|
||||
- city : "";
|
||||
- country : "";
|
||||
- address : "";
|
||||
- approximate : bool;
|
||||
- coordinates : {}
|
||||
- lat : x;
|
||||
- lng : x;
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user