merge.
This commit is contained in:
commit
6501b3fff7
Notes:
subgit
2018-03-07 17:58:59 +01:00
r670 www/branches/life
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
www/dlsv
|
||||
www/event.xml
|
||||
www/geolocation.js
|
||||
www/geolocationTable.js
|
||||
www/stations.xml
|
||||
|
@ -22,6 +22,22 @@
|
||||
$Id$
|
||||
*/
|
||||
|
||||
/* 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] ) {
|
||||
@ -50,17 +66,16 @@ function getGeolocation(id, lat, lng) {
|
||||
};
|
||||
|
||||
/* Load events using ajax */
|
||||
function ajaxLoadEvents(stime, etime, id) {
|
||||
function ajaxLoadEvents(stime, etime, id, target) {
|
||||
var mapBounds = map.getBounds();
|
||||
var request_data = {};
|
||||
if ( stime == '' || !stime ) {
|
||||
stime = new Date();
|
||||
stime.setDate(stime.getDate()-config['map']['timespan']);
|
||||
};
|
||||
if ( id ) {
|
||||
if ( id == 'bug2014jptq' ) console.log('Loading special event '+id);
|
||||
request_data = { eventid: id };
|
||||
} else {
|
||||
if ( !stime ) {
|
||||
stime = new Date();
|
||||
stime.setDate(stime.getDate()-config['map']['timespan']);
|
||||
};
|
||||
request_data = {
|
||||
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
|
||||
orderby: 'time-asc',
|
||||
@ -74,6 +89,7 @@ function ajaxLoadEvents(stime, etime, id) {
|
||||
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'],
|
||||
@ -87,8 +103,8 @@ function ajaxLoadEvents(stime, etime, id) {
|
||||
var lng = $(this).find('origin > longitude > value').text();
|
||||
var lat = $(this).find('origin > latitude > value').text();
|
||||
var depth = $(this).find('origin > depth > value').text();
|
||||
var evaluationMode = $(this).find('evaluationMode').text();
|
||||
var evaluationStatus = $(this).find('evaluationStatus').text();
|
||||
var evaluationMode = $(this).find('origin > evaluationMode').text();
|
||||
var evaluationStatus = $(this).find('origin > evaluationStatus').text();
|
||||
var type = $(this).find('type').last().text();
|
||||
var location
|
||||
// get location, try this in order:
|
||||
@ -97,13 +113,12 @@ function ajaxLoadEvents(stime, etime, id) {
|
||||
location = ( geolocationTable[id] || getGeolocation(id, lat, lng) );
|
||||
// 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'] ) {
|
||||
if ( id == 'bug2014jptq' ) console.log('Adding row for special event '+id);
|
||||
// general event info (1st line)
|
||||
var row = '<tr class="tablesorter-hasChildRow">'
|
||||
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
||||
+ '<td class="utctime-time">'+otime.split('.')[0]+'Z</td>'
|
||||
+ sprintf('<td class="ar">%.1f</td>', Number(mag))
|
||||
+ '<td><a href="#" class="toggle" eventid="'+id+'">'+location+'</a><a class="map-link" href="#" eventid="'+id+'">Karte</a></td>'
|
||||
+ '<td><a href="#" class="toggle" eventid="'+id+'">'+location+'</a> <a class="map-link" href="#" eventid="'+id+'">Karte</a></td>'
|
||||
+ '</tr>';
|
||||
// setting up event details (2nd line)
|
||||
row += '<tr class="tablesorter-childRow event-details">'
|
||||
@ -111,28 +126,22 @@ function ajaxLoadEvents(stime, etime, id) {
|
||||
// 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());
|
||||
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()));
|
||||
var sTime = new Date(oTime.getTime()-10*1000.-oTime.getMilliseconds());
|
||||
var eTime = new Date(oTime.getTime()+50*1000.-oTime.getMilliseconds());
|
||||
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 += '<tr class="tablesorter-childRow event-download">'
|
||||
+ '<td colspan="4" eventid="'+id+'">'
|
||||
+ sprintf('Download <a class="xml-link" target="_blank" href="%s">QuakeML</a> or <a class="mseed-link" target="_blank" href="%s">miniSEED</a>', xmlurl, mseedurl)
|
||||
+ '</td></tr>';
|
||||
// add row to table
|
||||
var added = $('#eventstable tbody').append(row);
|
||||
added.find('.tablesorter-childRow td').hide();
|
||||
$('#eventstable').find('td.utctime-date').each(function() {
|
||||
$.localtime.formatObject($(this), "dd.MM.yyyy");
|
||||
$(this).removeClass('utctime-date');
|
||||
$(this).addClass('localtime-date');
|
||||
});
|
||||
$('#eventstable').find('td.utctime-time').each(function() {
|
||||
$.localtime.formatObject($(this), "HH:mm");
|
||||
$(this).removeClass('utctime-time');
|
||||
$(this).addClass('localtime-time');
|
||||
});
|
||||
if ( stime <= oTime && etime >= oTime ) {
|
||||
addTableRow(row, 'eventstable');
|
||||
};
|
||||
if ( target ) {
|
||||
addTableRow(row, target);
|
||||
}
|
||||
// create marker
|
||||
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag));
|
||||
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag), type);
|
||||
var text = sprintf('<h3 eventid="%s">%s</h3>', id, location)
|
||||
+ sprintf('<p>Ereignis: %s</br>', id)
|
||||
+ sprintf('Type: %s</br>', type)
|
||||
@ -159,6 +168,9 @@ function ajaxLoadEvents(stime, etime, id) {
|
||||
console.log( "Request Failed: " + err );
|
||||
}
|
||||
});
|
||||
// create events csv download link
|
||||
request_data['format'] = 'text';
|
||||
if ( id == '' || !id ) { $('#events-csv-link').attr('href', config['ajax']['eventURL']+'?'+$.param(request_data)) };
|
||||
};
|
||||
|
||||
/* ajaxLoadEventInfo */
|
||||
@ -242,13 +254,13 @@ 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: config['event']['markerOpacity']});
|
||||
map.addLayer(eventTable[$(this).attr("eventid")]);
|
||||
};
|
||||
});
|
||||
// hide filtered events in map
|
||||
$("#eventstable > tbody > tr.filtered > td > a.map-link").each( function() {
|
||||
if ( $(this).attr("eventid") ) {
|
||||
eventTable[$(this).attr("eventid")].setStyle({opacity: 0, strokeOpacity: 0, fillOpacity: 0});
|
||||
map.removeLayer(eventTable[$(this).attr("eventid")]);
|
||||
};
|
||||
});
|
||||
highlightFirstEvent();
|
||||
@ -385,4 +397,23 @@ $(document).ready(function() {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// update selection / type info
|
||||
$("#events-timespan").text(config['map']['timespan']);
|
||||
$("#events-minmag").text(sprintf('%.1f', config['event']['minMag']));
|
||||
config['event']['typeWhitelist'].map(function(type) {
|
||||
var typetext;
|
||||
( $("#events-type").text() == "Symbole:" ) ? typetext = ' ' : typetext = ', ';
|
||||
switch ( type ) {
|
||||
case 'earthquake':
|
||||
typetext += 'tektonisches Erdbeben (Stern)';
|
||||
break;
|
||||
case 'induced or triggered event':
|
||||
typetext += '(bergbau-)induziertes Ereignis (Kreis)';
|
||||
break;
|
||||
case 'quarry blast':
|
||||
typetext += 'Steinbruchsprengung (Rad)';
|
||||
break;
|
||||
};
|
||||
$("#events-type").append(typetext);
|
||||
});
|
||||
});
|
||||
|
@ -40,12 +40,21 @@
|
||||
<!-- Map, Events & Stations -->
|
||||
<script type="text/javascript" src="misc.js"></script>
|
||||
<script type="text/javascript" src="geolocation.js"></script>
|
||||
<script type="text/javascript" src="specialevents.js"></script>
|
||||
<script type="text/javascript" src="map.js"></script>
|
||||
<script type="text/javascript" src="events.js"></script>
|
||||
<script type="text/javascript" src="stations.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>
|
||||
<div class="noscript">
|
||||
<h1>Kein JavaScript verfügbar!</h1>
|
||||
<p>Diese Seite benötigt JavaScript. Bitte schalten Sie JavaScript ein.</p>
|
||||
<h1>JavaScript disabled!</h1>
|
||||
<p>This page requires JavaScript to work. Please enable JavaScript.</p>
|
||||
</div>
|
||||
</noscript>
|
||||
<div class="info" id="tabs">
|
||||
<ul>
|
||||
<li><a href="#eventstab"><span>Ereignisse</span></a></li>
|
||||
@ -90,7 +99,15 @@
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Nominatim Search Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img alt="Mapquest Logo" src="//developer.mapquest.com/content/osm/mq_logo.png" /></p>
|
||||
<p class="table-caption">
|
||||
Ereignisse der letzten <span id="events-timespan">180</span> Tage ab Magnitude <span id="events-minmag">1.2</span> im Bereich der Karte und besondere Ereignisse in angrenzenden Bereichen. Download als <a id="events-csv-link" href="link" download="events.csv">CSV-Datei</a>.
|
||||
</p>
|
||||
<p class="table-caption">
|
||||
<span id="events-type">Symbole:</span>
|
||||
</p>
|
||||
<p class="table-caption">
|
||||
Nominatim Search Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img alt="Mapquest Logo" src="//developer.mapquest.com/content/osm/mq_logo.png" />
|
||||
</p>
|
||||
</div>
|
||||
<!-- Stations -->
|
||||
<div class="tab" id="stationstab">
|
||||
@ -129,7 +146,7 @@
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Download als <a id="stations-csv-link" href="link" download="stations.csv">CSV</a></p>
|
||||
<p class="table-caption">Download als <a id="stations-csv-link" href="link" download="stations.csv">CSV-Datei</a>.</p>
|
||||
</div>
|
||||
<!-- More -->
|
||||
<div class="tab" id="moretab"></div>
|
||||
|
12
www/main.css
12
www/main.css
@ -13,6 +13,15 @@
|
||||
height: 100%;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
div.noscript {
|
||||
z-index: 20000;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgb(255, 255, 255);
|
||||
}
|
||||
div.info {
|
||||
z-index: 10000;
|
||||
position: absolute;
|
||||
@ -64,4 +73,7 @@
|
||||
td.ar {
|
||||
text-align: right;
|
||||
}
|
||||
p.table-caption {
|
||||
font-size: smaller;
|
||||
}
|
||||
</style>
|
||||
|
23
www/map.js
23
www/map.js
@ -41,11 +41,9 @@ function addStationMarker(id, lat, lng, station) {
|
||||
};
|
||||
|
||||
/* add event marker */
|
||||
function addEventMarker(id, lat, lng, mag) {
|
||||
if ( id == 'bug2014jptq' ) console.log('Adding marker for special event '+id);
|
||||
function addEventMarker(id, lat, lng, mag, type) {
|
||||
if ( eventTable[id] ) {
|
||||
return eventTable[id];
|
||||
console.log('Marker allready exists ID: '+id);
|
||||
} else {
|
||||
var markerOptions = {
|
||||
gradient: true,
|
||||
@ -58,7 +56,19 @@ function addEventMarker(id, lat, lng, mag) {
|
||||
className: id+' eventMarker',
|
||||
radius: mag2radius(mag)
|
||||
};
|
||||
var marker = L.circleMarker(L.latLng(lat, lng), markerOptions);
|
||||
var marker;
|
||||
switch ( type ) {
|
||||
case 'earthquake':
|
||||
marker = L.starMarker(L.latLng(lat, lng), markerOptions);
|
||||
break;
|
||||
case 'quarry blast':
|
||||
markerOptions['numberOfPoints'] = 7;
|
||||
markerOptions['innerRadius'] = 0.3*markerOptions['radius'];
|
||||
marker = L.starMarker(L.latLng(lat, lng), markerOptions);
|
||||
break;
|
||||
default:
|
||||
marker = L.circleMarker(L.latLng(lat, lng), markerOptions);
|
||||
};
|
||||
eventLayer.addLayer(marker);
|
||||
eventTable[id] = marker;
|
||||
return marker;
|
||||
@ -169,8 +179,9 @@ $(document).ready(function() {
|
||||
|
||||
// load events
|
||||
ajaxLoadEvents();
|
||||
//ajaxLoadEvents([], [], ['bug2014jptq', 'gfz2013yvko']);
|
||||
ajaxLoadEvents([], [], 'bug2014jptq');
|
||||
specialEvents.map(function(id) {
|
||||
ajaxLoadEvents('', '', id)
|
||||
});
|
||||
toggleFilteredMarkers();
|
||||
|
||||
// bind popupopen event
|
||||
|
9
www/specialevents.js
Normal file
9
www/specialevents.js
Normal file
@ -0,0 +1,9 @@
|
||||
/* $Id$ */
|
||||
var specialEvents = [
|
||||
'bug2014jptq', // Seeheim-Jugenheim
|
||||
'bug2014infb', // Troisdorf
|
||||
'bug2014ilxd', // Bassum
|
||||
'bug2014gfzw', // Darmstadt
|
||||
'bug2014datb', // Groningen
|
||||
'bug2013yvko', // Haltern 3.4
|
||||
];
|
@ -105,6 +105,10 @@ function loadStations(stime, etime) {
|
||||
$("#stationstable > tbody > tr:even").addClass("odd");
|
||||
$("#stationstable > tbody > tr:odd").addClass("even");
|
||||
stationLayer.bringToFront();
|
||||
},
|
||||
error: function( jqxhr, textStatus, error ) {
|
||||
var err = textStatus + ", " + error;
|
||||
console.log( "Request Failed: " + err );
|
||||
}
|
||||
});
|
||||
// create stations csv download link
|
||||
|
Loading…
Reference in New Issue
Block a user