diff --git a/www/events.js b/www/events.js index 14b4501..a632b48 100644 --- a/www/events.js +++ b/www/events.js @@ -51,11 +51,6 @@ function getGeolocation(id, lat, lng) { /* Load events using ajax */ function ajaxLoadEvents(stime, etime) { - var mapBounds = map.getBounds(); - var N = mapBounds.getNorth(); - var E = mapBounds.getEast(); - var S = mapBounds.getSouth(); - var W = mapBounds.getWest(); if ( !stime ) { var stime = new Date(); stime.setDate(stime.getDate()-config['map']['timespan']); @@ -64,13 +59,14 @@ function ajaxLoadEvents(stime, etime) { var etime = new Date(); etime.setDate(etime.getDate()+1); }; + var mapBounds = map.getBounds(); var request_data = { starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), endtime: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()), - minlat: S-config['map']['latlngDelta'], - maxlat: N+config['map']['latlngDelta'], - minlon: W-config['map']['latlngDelta'], - maxlon: E+config['map']['latlngDelta'], + minlat: mapBounds.getSouth()-config['map']['latlngDelta'], + maxlat: mapBounds.getNorth()+config['map']['latlngDelta'], + minlon: mapBounds.getWest()-config['map']['latlngDelta'], + maxlon: mapBounds.getEast()+config['map']['latlngDelta'], minmag: config['event']['minMag']-config['event']['minMagDelta'], }; $.ajax({ @@ -89,7 +85,7 @@ function ajaxLoadEvents(stime, etime) { var evaluationStatus = $(this).find('evaluationStatus').text(); var type = $(this).find('type').last().text(); var location - // try use location with reverse geolocation lookup (nominatim), check cache first + // 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]; @@ -99,14 +95,28 @@ function ajaxLoadEvents(stime, etime) { }; // 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) var row = '
Ereignis: %s', id) + + sprintf('Type: %s', type) + + sprintf('Magnitude: %3.1f', Number(mag)) + sprintf('Ort: %.4f °N, %.4f °O ', Number(lat), Number(lng)) + sprintf('Zeit: %sZ
', otime.split('.')[0], otime.split('.')[0]); marker.bindPopup(text); @@ -206,7 +218,7 @@ function ajaxLoadEventInfo(id) { }; }); row = row + ''; - $('#eventstable > tbody > tr.tablesorter-childRow > td[eventid='+id+']').html(row); + $('#eventstable > tbody > tr.event-details > td[eventid='+id+']').html(row); }); }, complete: function () { @@ -228,7 +240,6 @@ function toggleFilteredMarkers() { eventTable[$(this).attr("eventid")].setStyle({opacity: 1, strokeOpacity: 1, fillOpacity: config['event']['markerOpacity']}); }; }); - // hide filtered events in map $("#eventstable > tbody > tr.filtered > td > a.map-link").each( function() { if ( $(this).attr("eventid") ) { @@ -272,7 +283,7 @@ function highlightEvent( id ) { }; var normalStyle = { fillColor: config['event']['markerColor'], - color: config['event']['markerColorH'] + color: config['event']['markerColor'] }; $("#eventstable > tbody > tr:not(.filtered)").find("a.map-link").each( function() { if ( $(this).attr("eventid") ) { @@ -320,20 +331,16 @@ $(document).ready(function() { showProcessing: true, } }); - // hide child rows $('#eventstable > tbody > tr.tablesorter-childRow td').hide(); - // update map after filtering $('#eventstable').bind('filterEnd', function(){ toggleFilteredMarkers(); }); - // highlight first event $('#eventstable').bind('sortEnd', function(){ highlightFirstEvent(); }); - // show / hide event info $('#eventstable').delegate('.toggle', 'click' , function(){ // load event details @@ -342,7 +349,6 @@ $(document).ready(function() { // toggle visibility of selected row $(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').toggle('slow'); - // mark currently selected row and remove class selected from all other rows // hide other rows $(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').addClass('selected-now'); @@ -357,12 +363,12 @@ $(document).ready(function() { var selected = $(this).hasClass('selected'); if ( selected ) { $(this).removeClass('selected'); + highlightFirstEvent(); } else { $(this).addClass('selected'); + highlightEvent($(this).attr('eventid')); }; }); - return false; }); - }); diff --git a/www/index.html.de b/www/index.html.de index 71f8620..72277a4 100644 --- a/www/index.html.de +++ b/www/index.html.de @@ -7,42 +7,42 @@ - + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - + @@ -72,7 +72,7 @@ -