Compare commits
2 Commits
main
...
support/if
Author | SHA1 | Date | |
---|---|---|---|
b7e13d7649 | |||
a3138ae638 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2,6 +2,7 @@
|
|||||||
scripts/mkEvents.csh -text
|
scripts/mkEvents.csh -text
|
||||||
www/.htaccess -text
|
www/.htaccess -text
|
||||||
www/copyright.inc.de -text
|
www/copyright.inc.de -text
|
||||||
|
www/eventsXML.js -text
|
||||||
www/external/TileLayer.Grayscale.js -text
|
www/external/TileLayer.Grayscale.js -text
|
||||||
www/external/css/dvf.css -text
|
www/external/css/dvf.css -text
|
||||||
www/external/css/leaflet.label.css -text
|
www/external/css/leaflet.label.css -text
|
||||||
|
183
www/events.js
183
www/events.js
@ -22,91 +22,8 @@
|
|||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* adding row(s) to a table and format date strings afterwards */
|
/* process loaded events */
|
||||||
function addTableRow(row, table) {
|
function processEvents(xml, target) {
|
||||||
var added = $('#'+table+' tbody').append(row);
|
|
||||||
added.find('.tablesorter-childRow td').hide();
|
|
||||||
$('#'+table).find('td.utctime-date').each(function() {
|
|
||||||
$.localtime.formatObject($(this), "dd.MM.yyyy");
|
|
||||||
$(this).removeClass('utctime-date');
|
|
||||||
$(this).addClass('localtime-date');
|
|
||||||
});
|
|
||||||
$('#'+table).find('td.utctime-time').each(function() {
|
|
||||||
$.localtime.formatObject($(this), "HH:mm");
|
|
||||||
$(this).removeClass('utctime-time');
|
|
||||||
$(this).addClass('localtime-time');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* do reverse geolocation lookup */
|
|
||||||
function getGeolocation(id, lat, lng) {
|
|
||||||
if ( !geolocationTable[id] ) {
|
|
||||||
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng, zoom: 10, format: "json" } )
|
|
||||||
.done(function( json ) {
|
|
||||||
var city = json.address["city"];
|
|
||||||
var country = json.address["country"];
|
|
||||||
var countryCode = json.address["country_code"].toUpperCase();
|
|
||||||
geolocationTable[id] = city;
|
|
||||||
( country != "Deutschland" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
|
|
||||||
if ( city ) {
|
|
||||||
$("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]);
|
|
||||||
var sort = [[0,1],[1,1],[2,1]];
|
|
||||||
$("#eventstable").trigger("update", [true]);
|
|
||||||
$("#eventstable").trigger("updateCache");
|
|
||||||
$("#eventstable").trigger("sorton", [sort]);
|
|
||||||
} else {
|
|
||||||
console.log("Nominatim did not provide a city tag for "+lat+" / "+lng);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.fail(function( jqxhr, textStatus, error ) {
|
|
||||||
var err = textStatus + ", " + error;
|
|
||||||
console.log( "Request Failed: " + err );
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Load events using ajax */
|
|
||||||
function ajaxLoadEvents(stime, etime, eventid, 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']);
|
|
||||||
rtime = new Date();
|
|
||||||
rtime.setDate(rtime.getDate()-Math.min(config['ajax']['timespan'], config['map']['timespan']));
|
|
||||||
} else {
|
|
||||||
rtime = stime;
|
|
||||||
};
|
|
||||||
if ( url ) {
|
|
||||||
var ajax_url = url;
|
|
||||||
request_data = {};
|
|
||||||
} else {
|
|
||||||
if ( eventid ) {
|
|
||||||
request_data = { eventid: eventid };
|
|
||||||
} else {
|
|
||||||
request_data = {
|
|
||||||
starttime: sprintf("%d-%02d-%02d", rtime.getFullYear(), rtime.getMonth()+1, rtime.getDate()),
|
|
||||||
orderby: 'time',
|
|
||||||
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: ajax_url,
|
|
||||||
data: request_data,
|
|
||||||
dataType: "xml",
|
|
||||||
success: function (xml) {
|
|
||||||
$(xml).find('event').each(function () {
|
$(xml).find('event').each(function () {
|
||||||
var id = $(this).attr('publicID').split('/')[2];
|
var id = $(this).attr('publicID').split('/')[2];
|
||||||
var mag = $(this).find('magnitude > mag > value').text();
|
var mag = $(this).find('magnitude > mag > value').text();
|
||||||
@ -145,14 +62,14 @@ function ajaxLoadEvents(stime, etime, eventid, url, target) {
|
|||||||
+ sprintf('Download <a class="xml-link" target="_blank" download="%s.xml" href="%s">QuakeML</a> or <a class="mseed-link" target="_blank" download="%s.mseed" href="%s">miniSEED</a>', id, xmlurl, id, mseedurl)
|
+ sprintf('Download <a class="xml-link" target="_blank" download="%s.xml" href="%s">QuakeML</a> or <a class="mseed-link" target="_blank" download="%s.mseed" href="%s">miniSEED</a>', id, xmlurl, id, mseedurl)
|
||||||
+ '</td></tr>';
|
+ '</td></tr>';
|
||||||
// add row to table
|
// add row to table
|
||||||
if ( stime <= oTime && etime >= oTime ) {
|
if ( sTime <= oTime && eTime >= oTime ) {
|
||||||
addTableRow(row, 'eventstable');
|
addTableRow(row, 'eventstable');
|
||||||
};
|
};
|
||||||
if ( target ) {
|
if ( target ) {
|
||||||
addTableRow(row, target);
|
addTableRow(row, target);
|
||||||
}
|
}
|
||||||
// create marker
|
// create marker
|
||||||
if ((stime <= oTime && etime >= oTime ) || ( id == eventid )) {
|
if ((sTime <= oTime && eTime >= oTime ) || ( id == eventid )) {
|
||||||
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag), type);
|
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag), type);
|
||||||
var text = sprintf('<h3 eventid="%s">%s</h3>', id, location)
|
var text = sprintf('<h3 eventid="%s">%s</h3>', id, location)
|
||||||
+ sprintf('<p>Ereignis: %s</br>', id)
|
+ sprintf('<p>Ereignis: %s</br>', id)
|
||||||
@ -165,7 +82,94 @@ function ajaxLoadEvents(stime, etime, eventid, url, target) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
};
|
||||||
|
|
||||||
|
/* adding row(s) to a table and format date strings afterwards */
|
||||||
|
function addTableRow(row, table) {
|
||||||
|
var added = $('#'+table+' tbody').append(row);
|
||||||
|
added.find('.tablesorter-childRow td').hide();
|
||||||
|
$('#'+table).find('td.utctime-date').each(function() {
|
||||||
|
$.localtime.formatObject($(this), "dd.MM.yyyy");
|
||||||
|
$(this).removeClass('utctime-date');
|
||||||
|
$(this).addClass('localtime-date');
|
||||||
|
});
|
||||||
|
$('#'+table).find('td.utctime-time').each(function() {
|
||||||
|
$.localtime.formatObject($(this), "HH:mm");
|
||||||
|
$(this).removeClass('utctime-time');
|
||||||
|
$(this).addClass('localtime-time');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* do reverse geolocation lookup */
|
||||||
|
function getGeolocation(id, lat, lng) {
|
||||||
|
if ( !geolocationTable[id] ) {
|
||||||
|
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng, zoom: 10, format: "json" } )
|
||||||
|
.done(function( json ) {
|
||||||
|
var city = json.address["city"];
|
||||||
|
var country = json.address["country"];
|
||||||
|
var countryCode = json.address["country_code"].toUpperCase();
|
||||||
|
geolocationTable[id] = city;
|
||||||
|
( country != "Deutschland" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
|
||||||
|
if ( city ) {
|
||||||
|
$("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]);
|
||||||
|
var sort = [[0,1],[1,1],[2,1]];
|
||||||
|
$("#eventstable").trigger("update", [true]);
|
||||||
|
$("#eventstable").trigger("updateCache");
|
||||||
|
$("#eventstable").trigger("sorton", [sort]);
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.fail(function( jqxhr, textStatus, error ) {
|
||||||
|
var err = textStatus + ", " + error;
|
||||||
|
console.log( "Request Failed: " + err );
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Load events using ajax */
|
||||||
|
function ajaxLoadEvents(startup, stime, etime, eventid, 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']);
|
||||||
|
rtime = new Date();
|
||||||
|
rtime.setDate(rtime.getDate()-Math.min(config['ajax']['timespan'], config['map']['timespan']));
|
||||||
|
} else {
|
||||||
|
rtime = stime;
|
||||||
|
};
|
||||||
|
if ( url ) {
|
||||||
|
var ajax_url = url;
|
||||||
|
request_data = {};
|
||||||
|
} else {
|
||||||
|
if ( eventid ) {
|
||||||
|
request_data = { eventid: eventid };
|
||||||
|
} else {
|
||||||
|
request_data = {
|
||||||
|
starttime: sprintf("%d-%02d-%02d", rtime.getFullYear(), rtime.getMonth()+1, rtime.getDate()),
|
||||||
|
orderby: 'time',
|
||||||
|
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(); };
|
||||||
|
if ( startup ) {
|
||||||
|
processEvents(eventsXML, false);
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
data: request_data,
|
||||||
|
dataType: "xml",
|
||||||
|
success: function ( xml ) { processEvents(xml, target) },
|
||||||
complete: function () {
|
complete: function () {
|
||||||
var sort = [[0,1],[1,1],[2,1]];
|
var sort = [[0,1],[1,1],[2,1]];
|
||||||
$("#eventstable").trigger("update", [true]);
|
$("#eventstable").trigger("update", [true]);
|
||||||
@ -180,6 +184,7 @@ function ajaxLoadEvents(stime, etime, eventid, url, target) {
|
|||||||
console.log( "Request Failed: " + err );
|
console.log( "Request Failed: " + err );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
// create events csv download link
|
// create events csv download link
|
||||||
request_data['format'] = 'text';
|
request_data['format'] = 'text';
|
||||||
if ( eventid == '' || !eventid ) { $('#events-csv-link').attr('href', config['ajax']['eventURL']+'?'+$.param(request_data)) };
|
if ( eventid == '' || !eventid ) { $('#events-csv-link').attr('href', config['ajax']['eventURL']+'?'+$.param(request_data)) };
|
||||||
@ -281,6 +286,7 @@ function toggleFilteredMarkers() {
|
|||||||
/* Highlight the first event of the event list on the map if no
|
/* Highlight the first event of the event list on the map if no
|
||||||
* other event is selected */
|
* other event is selected */
|
||||||
function highlightFirstEvent() {
|
function highlightFirstEvent() {
|
||||||
|
$('div.info').show()
|
||||||
var highlightStyle = {
|
var highlightStyle = {
|
||||||
color: config['event']['markerColorH'],
|
color: config['event']['markerColorH'],
|
||||||
fillColor: config['event']['markerColorH'],
|
fillColor: config['event']['markerColorH'],
|
||||||
@ -306,6 +312,7 @@ function highlightFirstEvent() {
|
|||||||
$(this).text('Karte (rot)');
|
$(this).text('Karte (rot)');
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
$('div.info').hide()
|
||||||
};
|
};
|
||||||
|
|
||||||
function highlightEvent( id ) {
|
function highlightEvent( id ) {
|
||||||
|
1
www/eventsXML.js
Normal file
1
www/eventsXML.js
Normal file
File diff suppressed because one or more lines are too long
@ -15,7 +15,6 @@
|
|||||||
<link rel="stylesheet" href="external/leaflet.css" />
|
<link rel="stylesheet" href="external/leaflet.css" />
|
||||||
<!-- link rel="stylesheet" href="external/css/dvf.css" type="text/css" media="screen" / -->
|
<!-- link rel="stylesheet" href="external/css/dvf.css" type="text/css" media="screen" / -->
|
||||||
<link rel="stylesheet" href="external/css/leaflet.label.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="external/css/leaflet.label.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="external/easyPrint.css"/>
|
|
||||||
|
|
||||||
<!-- jQuery & jQueryUI -->
|
<!-- jQuery & jQueryUI -->
|
||||||
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||||
@ -38,7 +37,6 @@
|
|||||||
<script type="text/javascript" src="external/leaflet-dvf.markers.min.js"></script>
|
<script type="text/javascript" src="external/leaflet-dvf.markers.min.js"></script>
|
||||||
<script type="text/javascript" src="external/leaflet.label.js"></script>
|
<script type="text/javascript" src="external/leaflet.label.js"></script>
|
||||||
<script src="external/jQuery.print.js"></script>
|
<script src="external/jQuery.print.js"></script>
|
||||||
<script src="external/leaflet.easyPrint.js"></script>
|
|
||||||
|
|
||||||
<!-- Map, Events & Stations -->
|
<!-- Map, Events & Stations -->
|
||||||
<script type="text/javascript" src="misc.js"></script>
|
<script type="text/javascript" src="misc.js"></script>
|
||||||
@ -47,6 +45,7 @@
|
|||||||
<script type="text/javascript" src="map.js"></script>
|
<script type="text/javascript" src="map.js"></script>
|
||||||
<script type="text/javascript" src="events.js"></script>
|
<script type="text/javascript" src="events.js"></script>
|
||||||
<script type="text/javascript" src="stations.js"></script>
|
<script type="text/javascript" src="stations.js"></script>
|
||||||
|
<script type="text/javascript" src="eventsXML.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
13
www/map.js
13
www/map.js
@ -183,11 +183,12 @@ $(document).ready(function() {
|
|||||||
eventLayer = new L.MarkerGroup().addTo(map);
|
eventLayer = new L.MarkerGroup().addTo(map);
|
||||||
|
|
||||||
// load events
|
// load events
|
||||||
ajaxLoadEvents('', '', '', 'events.xml');
|
ajaxLoadEvents(true);
|
||||||
ajaxLoadEvents();
|
// ajaxLoadEvents(false, '', '', '', 'events.xml');
|
||||||
specialEvents.map(function(id) {
|
ajaxLoadEvents(false);
|
||||||
ajaxLoadEvents('', '', id)
|
// specialEvents.map(function(id) {
|
||||||
});
|
// ajaxLoadEvents(false, '', '', id)
|
||||||
|
//});
|
||||||
toggleFilteredMarkers();
|
toggleFilteredMarkers();
|
||||||
|
|
||||||
// bind popupopen event
|
// bind popupopen event
|
||||||
@ -216,5 +217,5 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// print icon
|
// print icon
|
||||||
L.easyPrint().addTo(map);
|
// L.easyPrint().addTo(map);
|
||||||
});
|
});
|
||||||
|
@ -106,12 +106,12 @@ var config = {
|
|||||||
markerColorH: 'red',
|
markerColorH: 'red',
|
||||||
minMag: 1.2,
|
minMag: 1.2,
|
||||||
minMagDelta: 0.1,
|
minMagDelta: 0.1,
|
||||||
typeWhitelist: ['earthquake', 'induced or triggered event', 'quarry blast', 'explosion'],
|
typeWhitelist: ['earthquake', 'induced or triggered event'],
|
||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
zoomDefault: 9,
|
zoomDefault: 9,
|
||||||
zoomFocus: 12,
|
zoomFocus: 12,
|
||||||
centerDefault: [51.85, 7.0],
|
centerDefault: [51.65, 7.2],
|
||||||
timespan: 180,
|
timespan: 180,
|
||||||
latlngDelta: 0.1,
|
latlngDelta: 0.1,
|
||||||
},
|
},
|
||||||
@ -129,7 +129,7 @@ var config = {
|
|||||||
NL_WIT: 3,
|
NL_WIT: 3,
|
||||||
NL_WTSB: 3,
|
NL_WTSB: 3,
|
||||||
},
|
},
|
||||||
networkBlacklist: ['NL', 'X5'],
|
networkBlacklist: ['NL', 'X5', '1A'],
|
||||||
},
|
},
|
||||||
tab: {
|
tab: {
|
||||||
active: 0,
|
active: 0,
|
||||||
@ -211,4 +211,7 @@ $(document).ready(function() {
|
|||||||
}).bind("ajaxStop", function() {
|
}).bind("ajaxStop", function() {
|
||||||
$("#spinner").hide();
|
$("#spinner").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// hide info container
|
||||||
|
$('div.info').hide()
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user