This commit is contained in:
Kasper D. Fischer 2014-06-13 15:04:44 +00:00
commit 91b1f6f28c
Notes: subgit 2018-03-07 17:59:03 +01:00
r700 www/branches/life
4 changed files with 30 additions and 16 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
www/dlsv
www/event.xml
www/events.xml
www/geolocation.js
www/geolocationTable.js
www/stations.xml

View File

@ -66,33 +66,44 @@ function getGeolocation(id, lat, lng) {
};
/* Load events using ajax */
function ajaxLoadEvents(stime, etime, id, target) {
function ajaxLoadEvents(stime, etime, id, url, target) {
var mapBounds = map.getBounds();
var request_data = {};
var rtime;
var ajax_url = config['ajax']['eventURL'];
if ( stime == '' || !stime ) {
stime = new Date();
stime.setDate(stime.getDate()-config['map']['timespan']);
};
if ( id ) {
request_data = { eventid: id };
rtime = new Date();
rtime.setDate(rtime.getDate()-config['ajax']['timespan']);
} else {
request_data = {
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
orderby: 'time-asc',
minlat: sprintf('%.2f', mapBounds.getSouth()-config['map']['latlngDelta']),
maxlat: sprintf('%.2f', mapBounds.getNorth()+config['map']['latlngDelta']),
minlon: sprintf('%.2f', mapBounds.getWest()-config['map']['latlngDelta']),
maxlon: sprintf('%.2f', mapBounds.getEast()+config['map']['latlngDelta']),
minmag: sprintf('%.1f', config['event']['minMag']-config['event']['minMagDelta']),
};
if ( etime ) {
request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate());
rtime = stime;
};
if ( url ) {
var ajax_url = url;
request_data = {};
} else {
if ( id ) {
request_data = { eventid: id };
} else {
request_data = {
starttime: sprintf("%d-%02d-%02d", rtime.getFullYear(), rtime.getMonth()+1, rtime.getDate()),
orderby: 'time-asc',
minlat: sprintf('%.2f', mapBounds.getSouth()-config['map']['latlngDelta']),
maxlat: sprintf('%.2f', mapBounds.getNorth()+config['map']['latlngDelta']),
minlon: sprintf('%.2f', mapBounds.getWest()-config['map']['latlngDelta']),
maxlon: sprintf('%.2f', mapBounds.getEast()+config['map']['latlngDelta']),
minmag: sprintf('%.1f', config['event']['minMag']-config['event']['minMagDelta']),
};
if ( etime ) {
request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate());
};
};
};
if ( etime == '' || !etime ) { etime = new Date(); };
$.ajax({
type: "GET",
url: config['ajax']['eventURL'],
url: ajax_url,
data: request_data,
dataType: "xml",
success: function (xml) {

View File

@ -178,6 +178,7 @@ $(document).ready(function() {
eventLayer = new L.MarkerGroup().addTo(map);
// load events
ajaxLoadEvents('', '', '', 'events.xml');
ajaxLoadEvents();
specialEvents.map(function(id) {
ajaxLoadEvents('', '', id)

View File

@ -97,6 +97,7 @@ var config = {
stationURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/station/1/query',
nominatimURL: '//open.mapquestapi.com/nominatim/v1/reverse.php',
// nominatimURL: '//nominatim.openstreetmap.org/reverse',
timespan: 60,
},
event: {
evaluationBlacklist: ['automatic', 'preliminary', 'rejected'],