diff --git a/www/events.js b/www/events.js
index 33e0ece..bef9f19 100644
--- a/www/events.js
+++ b/www/events.js
@@ -74,7 +74,7 @@ function ajaxLoadEvents(stime, etime) {
maxlat: N+d,
minlon: W-d,
maxlon: E+d,
- minmag: minMag-0.1,
+ minmag: config['event']['minMag']-0.1,
};
$.ajax({
type: "GET",
@@ -92,10 +92,17 @@ function ajaxLoadEvents(stime, etime) {
var evaluationMode = $(this).find('evaluationMode').text();
var evaluationStatus = $(this).find('evaluationStatus').text();
var type = $(this).find('type').last().text();
- var location = getLocation(Number(lat), Number(lng))[0];
- ( location ) ? null : location = $(this).find('description > text').text();
+ var location
+ // try 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();
+ };
// create table row: Date, Time, Mag, Location
- if ( !eventTable[id] && ( type == 'earthquake' || type == 'induced or triggered event' || type == 'outside of network interest') && evaluationMode != 'automatic' && evaluationStatus != 'preliminary' && Number(mag)+0.05 >= minMag ) {
+ if ( !eventTable[id] && $.inArray(type, config['event']['typeWhitelist'] )+1 && $.inArray(evaluationStatus, config['event']['evaluationBlacklist'])<0 && Number(mag)+0.05 >= config['event']['minMag'] ) {
var row = '
'
+ ''+otime.split('.')[0]+'Z | '
+ ''+otime.split('.')[0]+'Z | '
@@ -123,8 +130,6 @@ function ajaxLoadEvents(stime, etime) {
+ sprintf('Ort: %.4f °N, %.4f °O ', Number(lat), Number(lng))
+ sprintf('Zeit: %sZ', otime.split('.')[0], otime.split('.')[0]);
marker.bindPopup(text);
- // try to get better location with reverse geolocation lookup (nominatim), check cache first
- ( geolocationTable[id] ) ? $("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]) : getGeolocation(id, lat, lng);
};
});
},
@@ -198,7 +203,7 @@ function toggleFilteredMarkers() {
// show all shown events in map
$("#eventstable > tbody > tr:not(.filtered) > td > a.map-link").each( function() {
if ( $(this).attr("eventid") ) {
- eventTable[$(this).attr("eventid")].setStyle({opacity: 1, strokeOpacity: 1, fillOpacity: eventMarkerOpacity});
+ eventTable[$(this).attr("eventid")].setStyle({opacity: 1, strokeOpacity: 1, fillOpacity: config['event']['markerOpacity']});
};
});
diff --git a/www/map.js b/www/map.js
index 4075a49..7150158 100644
--- a/www/map.js
+++ b/www/map.js
@@ -34,7 +34,7 @@ function addStationMarker(id, lat, lng) {
color: "#1C771C",
weight: 1,
opacity: 1,
- fillOpacity: stationMarkerOpacity,
+ fillOpacity: config['station']['markerOpacity'],
className: id+' stationMarker',
}).addTo(stationLayer);
stationTable[id] = marker;
@@ -47,7 +47,7 @@ function addEventMarker(id, lat, lng, mag) {
color: "#FFF500",
weight: 1,
opacity: 1,
- fillOpacity: eventMarkerOpacity,
+ fillOpacity: config['event']['markerOpacity'],
className: id+' eventMarker',
};
var marker = L.circle(L.latLng(lat, lng), mag2radius(mag), markerOptions).addTo(eventLayer);
@@ -84,14 +84,14 @@ function initMapLink() {
$(this).removeClass('selected');
$(this).text('Karte');
eventTable[$(this).attr('eventid')].setStyle(normalStyle);
- map.setView(mapCentreDefault, zoomDefault);
+ map.setView(config['map']['centerDefault'], config['map']['zoomDefault']);
highlightFirstEvent();
// unselected -> selected
} else {
$(this).addClass('selected');
$(this).text('im Fokus (rot)');
eventTable[$(this).attr('eventid')].setStyle(highlightStyle);
- map.setView(eventTable[$(this).attr('eventid')].getLatLng(), zoomFocus);
+ map.setView(eventTable[$(this).attr('eventid')].getLatLng(), config['map']['zoomFocus']);
};
});
return false;
@@ -104,7 +104,7 @@ function initMapLink() {
$(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 }).setView(mapCentreDefault, zoomDefault);
+ map = L.map('map', { zoomControl: false }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
new L.Control.Zoom({ position: 'topright' }).addTo(map);
// add MapQuestOSM tile layer
diff --git a/www/misc.js b/www/misc.js
index 7821717..bdde136 100644
--- a/www/misc.js
+++ b/www/misc.js
@@ -84,16 +84,26 @@ $( window ).resize(function() {
});
/* create global vars */
-var map
+var map;
var eventTable = {};
var eventDetails = {};
var stationTable = {};
-var eventMarkerOpacity = 0.3;
-var stationMarkerOpacity = 0.5;
-var zoomFocus = 12;
-var zoomDefault = 9;
-var mapCentreDefault = [51.85, 7.0];
-var minMag = 1.2;
+var config = {
+ event: {
+ evaluationBlacklist: ['automatic', 'preliminary'],
+ markerOpacity: 0.3,
+ minMag: 1.2,
+ typeWhitelist: ['earthquake', 'induced or triggered event'],
+ },
+ map: {
+ zoomDefault: 9,
+ zoomFocus: 12,
+ centerDefault: [51.85, 7.0],
+ },
+ station: {
+ markerOpacity: 0.5,
+ },
+};
/**********************************************************************
* document ready *