This commit is contained in:
Kasper D. Fischer 2014-05-12 16:16:01 +00:00
parent 43178d916e
commit 14d988b0b4
Notes: subgit 2018-03-07 17:58:51 +01:00
r633 www/branches/life
3 changed files with 22 additions and 11 deletions

View File

@ -87,12 +87,9 @@ function ajaxLoadEvents(stime, etime) {
var location
// try to use location with reverse geolocation lookup (nominatim), check cache first
// use getLocation if it fails or description -> text if it also fails
if ( geolocationTable[id] ) {
location = geolocationTable[id];
} else {
location = getGeolocation(id, lat, lng);
( location ) ? null : location = $(this).find('description > text').text();
};
( location = geolocationTable[id] ) ? null : location = getGeolocation(id, lat, lng);
( location ) ? null : location = getLocation(lat, lng)[0];
( location ) ? null : $(this).find('description > text').text();
// create table row: Date, Time, Mag, Location
if ( !eventTable[id] && $.inArray(type, config['event']['typeWhitelist'] )+1 && $.inArray(evaluationStatus, config['event']['evaluationBlacklist'])<0 && Number(mag)+0.05 >= config['event']['minMag'] ) {
// general event info (1st line)

View File

@ -106,6 +106,7 @@ $(document).ready(function() {
// create a map in the "map" div, set the view to a given place and zoom
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
new L.Control.Zoom({ position: 'topright' }).addTo(map);
new L.control.scale({position: 'bottomright', imperial: false}).addTo(map);
// add MapQuestOSM tile layer
// L.tileLayer.grayscale('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',
@ -135,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 = {};