Show event details when selecting a marker. Hide when popup closes. TODO: do this without a global variable.

This commit is contained in:
Kasper D. Fischer 2014-05-12 16:10:29 +00:00
parent 4ed2af95c0
commit 3161f1542e
Notes: subgit 2018-03-07 17:58:51 +01:00
r632 www/trunk
2 changed files with 18 additions and 5 deletions

View File

@ -136,12 +136,24 @@ $(document).ready(function() {
map.on('popupopen', function() {
// convert date/time to localtime
$("div.leaflet-popup span.utctime").each(function(){$(this).addClass("localtime").removeClass("utctime");$.localtime.formatObject($(this), "dd.MM.yyyy - HH:mm")});
var eventid = $("div.leaflet-popup h3").attr("eventid");
if ( eventid ) {
// highlight event in table
highlightEvent(eventid);
openMarkerID = $("div.leaflet-popup h3").attr("eventid");
if ( openMarkerID ) {
// update city in popup
$("div.leaflet-popup h3").text(geolocationTable[eventid]);
$("div.leaflet-popup h3").text(geolocationTable[openMarkerID]);
// highlight event in table and show details
// highlightEvent(eventid);
$('#eventstable > tbody > tr > td > a.toggle').each(function() {
if ( $(this).attr('eventid') == openMarkerID ) {
$(this)[0].click();
};
});
};
});
map.on('popupclose', function() {
$('#eventstable > tbody > tr > td > a.toggle').each(function() {
if ( $(this).attr('eventid') == openMarkerID ) {
$(this)[0].click();
};
});
});
});

View File

@ -73,6 +73,7 @@ $( window ).resize(function() {
/* create global vars */
var map;
var openMarkerID;
var eventTable = {};
var eventDetails = {};
var stationTable = {};