infowindow style okish

This commit is contained in:
lenovo
2022-11-14 07:01:52 +01:00
parent afcaec9a1f
commit e0c1b4118e
5 changed files with 158 additions and 43 deletions

View File

@@ -1,3 +1,4 @@
function attach_info_window(map, marker, events, infowindow) {
/*
@@ -5,27 +6,31 @@ function attach_info_window(map, marker, events, infowindow) {
* https://stackoverflow.com/questions/11106671/google-maps-api-multiple-markers-with-infowindows
*/
let window_content = '<div id="info_window">';
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) {
if (key > 0)
window_content += `<hr />`;
let presence = "en ligne";
if (events[key].irl)
presence = "en presentiel";
window_content += `
<a href="${events[key].url}">
<p>${events[key].title}</p>
</a>
<a class="infowindow_body" href="${events[key].url}">
<p>${events[key].title}</p>
</a>
`;
};
window_content += '</div>';
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: 150 };
let window_offset = { width: 0, height: 200 };
infowindow.setOptions({
//disableAutoPan: true,
@@ -47,3 +52,31 @@ function attach_info_window(map, marker, events, infowindow) {
});
}
/*
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;
*/

View File

@@ -9,6 +9,7 @@ const g_init_bounds = {
east: 180,
};
let g_indexes = {};
let g_infowindow = {};
function mp_init_map() {
@@ -47,7 +48,7 @@ function mp_init_map() {
let map_div = document.getElementById("ljdp_map");
//let filters_div = document.getElementById("ljdp_map_filters");
let infowindow = new google.maps.InfoWindow();
g_infowindow = new google.maps.InfoWindow();
/*
@@ -55,7 +56,7 @@ function mp_init_map() {
*/
g_map = create_map(map_div);
g_markers = create_markers(g_map, locations, infowindow);
g_markers = create_markers(g_map, locations, g_infowindow);
g_marker_cluster = draw_clusters(g_map, g_markers);
//console.log("locations:");
@@ -68,7 +69,7 @@ function mp_init_map() {
// add listener to close infowindow at any click on map
g_map.addListener('click', function() {
infowindow.close();
g_infowindow.close();
});
}