diff --git a/www/events.js b/www/events.js index 069071a..69c1243 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,15 +59,16 @@ 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'], - includeArrivals: true, + includearrivals: true, }; $.ajax({ type: "GET", @@ -151,6 +147,17 @@ function ajaxLoadEvents(stime, etime) { }; }); row += ''; + // setting up download links (3nd line) + var xmlurl = sprintf('%s?formatted=true&includearrivals=true&eventid=%s', config['ajax']['eventURL'], id); + var oTime = new Date(otime); + var stime = new Date(oTime.getTime()-10*1000.-oTime.getMilliseconds()); + var etime = new Date(oTime.getTime()+50*1000.-oTime.getMilliseconds()); + console.log(oTime, stime, etime); + var mseedurl = sprintf('%s?net=GE,GR,RN&cha=EH?,HH?&start=%04d-%02d-%02dT%02d:%02d:%02d&end=%04d-%02d-%02dT%02d:%02d:%02d', config['ajax']['mseedURL'], Number(stime.getUTCFullYear()), Number(stime.getUTCMonth())+1, Number(stime.getUTCDate()), Number(stime.getUTCHours()), Number(stime.getUTCMinutes()), Number(stime.getUTCSeconds()), Number(etime.getUTCFullYear()), Number(etime.getUTCMonth())+1, Number(etime.getUTCDate()), Number(etime.getUTCHours()), Number(etime.getUTCMinutes()), Number(etime.getUTCSeconds())); + row += '