Merging changes from trunk.
r614 www/branches/life
30
.gitattributes
vendored
@ -1,17 +1,17 @@
|
|||||||
* text=auto !eol
|
* text=auto !eol
|
||||||
www/TileLayer.Grayscale.js -text
|
www/external/TileLayer.Grayscale.js -text
|
||||||
www/first.png -text
|
www/external/first.png -text
|
||||||
www/jquery.localtime-0.9.1.min.js -text
|
www/external/jquery.localtime-0.9.1.min.js -text
|
||||||
www/jquery.tablesorter.min.js -text
|
www/external/jquery.tablesorter.min.js -text
|
||||||
www/jquery.tablesorter.pager.css -text
|
www/external/jquery.tablesorter.pager.css -text
|
||||||
www/jquery.tablesorter.pager.min.js -text
|
www/external/jquery.tablesorter.pager.min.js -text
|
||||||
www/jquery.tablesorter.widgets.min.js -text
|
www/external/jquery.tablesorter.widgets.min.js -text
|
||||||
www/last.png -text
|
www/external/last.png -text
|
||||||
www/leaflet.css -text
|
www/external/leaflet.css -text
|
||||||
www/leaflet.js -text
|
www/external/leaflet.js -text
|
||||||
|
www/external/next.png -text
|
||||||
|
www/external/prev.png -text
|
||||||
|
www/external/sprintf.min.js -text
|
||||||
|
www/external/theme.blue.css -text
|
||||||
|
www/external/widget-pager.js -text
|
||||||
www/logo_RUB_155x30.png -text
|
www/logo_RUB_155x30.png -text
|
||||||
www/next.png -text
|
|
||||||
www/prev.png -text
|
|
||||||
www/sprintf.min.js -text
|
|
||||||
www/theme.blue.css -text
|
|
||||||
www/widget-pager.js -text
|
|
||||||
|
115
www/events.js
@ -1,3 +1,27 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
* events.js *
|
||||||
|
* script for event specific functions and setup *
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/* License
|
||||||
|
Copyright 2014 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the Free
|
||||||
|
Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
/* do reverse geolocation lookup */
|
/* do reverse geolocation lookup */
|
||||||
function getGeolocation(id, lat, lng) {
|
function getGeolocation(id, lat, lng) {
|
||||||
if ( !geolocationTable[id] ) {
|
if ( !geolocationTable[id] ) {
|
||||||
@ -50,7 +74,7 @@ function ajaxLoadEvents(stime, etime) {
|
|||||||
maxlat: N+d,
|
maxlat: N+d,
|
||||||
minlon: W-d,
|
minlon: W-d,
|
||||||
maxlon: E+d,
|
maxlon: E+d,
|
||||||
minmag: minMag-0.1,
|
minmag: config['event']['minMag']-0.1,
|
||||||
};
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@ -68,10 +92,17 @@ function ajaxLoadEvents(stime, etime) {
|
|||||||
var evaluationMode = $(this).find('evaluationMode').text();
|
var evaluationMode = $(this).find('evaluationMode').text();
|
||||||
var evaluationStatus = $(this).find('evaluationStatus').text();
|
var evaluationStatus = $(this).find('evaluationStatus').text();
|
||||||
var type = $(this).find('type').last().text();
|
var type = $(this).find('type').last().text();
|
||||||
var location = getLocation(Number(lat), Number(lng))[0];
|
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();
|
( location ) ? null : location = $(this).find('description > text').text();
|
||||||
|
};
|
||||||
// create table row: Date, Time, Mag, Location
|
// 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 = '<tr class="tablesorter-hasChildRow">'
|
var row = '<tr class="tablesorter-hasChildRow">'
|
||||||
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
||||||
+ '<td class="utctime-time">'+otime.split('.')[0]+'Z</td>'
|
+ '<td class="utctime-time">'+otime.split('.')[0]+'Z</td>'
|
||||||
@ -99,8 +130,6 @@ function ajaxLoadEvents(stime, etime) {
|
|||||||
+ sprintf('Ort: %.4f °N, %.4f °O </br>', Number(lat), Number(lng))
|
+ sprintf('Ort: %.4f °N, %.4f °O </br>', Number(lat), Number(lng))
|
||||||
+ sprintf('Zeit: <span class="utctime">%sZ</span></p>', otime.split('.')[0], otime.split('.')[0]);
|
+ sprintf('Zeit: <span class="utctime">%sZ</span></p>', otime.split('.')[0], otime.split('.')[0]);
|
||||||
marker.bindPopup(text);
|
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);
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -119,7 +148,8 @@ function ajaxLoadEvents(stime, etime) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// add row to table
|
/* add row to table
|
||||||
|
obsolete */
|
||||||
function addEventRow(id, props) {
|
function addEventRow(id, props) {
|
||||||
$('#eventstable').tablesorter({
|
$('#eventstable').tablesorter({
|
||||||
sortList: "[[0,0], [1,1]], [2,1]",
|
sortList: "[[0,0], [1,1]], [2,1]",
|
||||||
@ -167,6 +197,79 @@ function addEventRow(id, props) {
|
|||||||
$("#eventstable").trigger("update", [true]);
|
$("#eventstable").trigger("update", [true]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* toggles visibility of filtered markers
|
||||||
|
* only events in the event list are shown */
|
||||||
|
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']});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
highlightFirstEvent();
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Highlight the first event of the event list on the map if no
|
||||||
|
* other event is selected */
|
||||||
|
function highlightFirstEvent() {
|
||||||
|
var highlightStyle = {
|
||||||
|
color: 'red',
|
||||||
|
fillColor: '#f03',
|
||||||
|
};
|
||||||
|
var normalStyle = {
|
||||||
|
fillColor: "#FFF500",
|
||||||
|
color: "#FFF500"
|
||||||
|
};
|
||||||
|
$("#eventstable a.map-link").each( function() {
|
||||||
|
if ( $(this).attr("eventid") ) {
|
||||||
|
eventTable[$(this).attr("eventid")].setStyle(normalStyle);
|
||||||
|
$(this).removeClass('first');
|
||||||
|
$(this).text('Karte');
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$("#eventstable > tbody > tr:not(.filtered)").first().find("a.map-link").each(function() {
|
||||||
|
if ( $(this).attr("eventid") ) {
|
||||||
|
eventTable[$(this).attr("eventid")].setStyle(highlightStyle);
|
||||||
|
$(this).addClass('first');
|
||||||
|
$(this).text('Karte (rot)');
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function highlightEvent( id ) {
|
||||||
|
var highlightStyle = {
|
||||||
|
color: 'red',
|
||||||
|
fillColor: '#f03',
|
||||||
|
};
|
||||||
|
var normalStyle = {
|
||||||
|
fillColor: "#FFF500",
|
||||||
|
color: "#FFF500"
|
||||||
|
};
|
||||||
|
$("#eventstable > tbody > tr:not(.filtered)").find("a.map-link").each( function() {
|
||||||
|
if ( $(this).attr("eventid") ) {
|
||||||
|
if ( $(this).attr("eventid") == id ) {
|
||||||
|
eventTable[$(this).attr("eventid")].setStyle(highlightStyle);
|
||||||
|
$(this).addClass('first');
|
||||||
|
$(this).text('Karte (rot)');
|
||||||
|
} else {
|
||||||
|
eventTable[$(this).attr("eventid")].setStyle(normalStyle);
|
||||||
|
$(this).removeClass('first');
|
||||||
|
$(this).text('Karte');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* document ready *
|
||||||
|
**********************************************************************/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// tablesorter for event list
|
// tablesorter for event list
|
||||||
$("#eventstable").tablesorter(
|
$("#eventstable").tablesorter(
|
||||||
|
0
www/first.png → www/external/first.png
vendored
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 720 B |
0
www/last.png → www/external/last.png
vendored
Before Width: | Height: | Size: 737 B After Width: | Height: | Size: 737 B |
0
www/next.png → www/external/next.png
vendored
Before Width: | Height: | Size: 736 B After Width: | Height: | Size: 736 B |
0
www/prev.png → www/external/prev.png
vendored
Before Width: | Height: | Size: 745 B After Width: | Height: | Size: 745 B |
@ -16,29 +16,29 @@
|
|||||||
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
||||||
|
|
||||||
<!-- Localtime -->
|
<!-- Localtime -->
|
||||||
<script type="text/javascript" src="jquery.localtime-0.9.1.min.js"></script>
|
<script type="text/javascript" src="external/jquery.localtime-0.9.1.min.js"></script>
|
||||||
|
|
||||||
<!-- Tablesorter: required -->
|
<!-- Tablesorter: required -->
|
||||||
<link rel="stylesheet" href="theme.blue.css">
|
<link rel="stylesheet" href="external/theme.blue.css">
|
||||||
<script src="jquery.tablesorter.min.js"></script>
|
<script src="external/jquery.tablesorter.min.js"></script>
|
||||||
<!-- script src="widget-scroller.js"></script -->
|
<!-- script src="external/widget-scroller.js"></script -->
|
||||||
<script src="jquery.tablesorter.widgets.min.js"></script>
|
<script src="external/jquery.tablesorter.widgets.min.js"></script>
|
||||||
<script src="jquery.tablesorter.pager.min.js"></script>
|
<script src="external/jquery.tablesorter.pager.min.js"></script>
|
||||||
|
|
||||||
<!-- misc functions -->
|
<!-- misc functions -->
|
||||||
<script src="misc.js"></script>
|
<script src="misc.js"></script>
|
||||||
<script src="geolocation.js"></script>
|
<script src="geolocation.js"></script>
|
||||||
<script src="sprintf.min.js"></script>
|
<script src="external/sprintf.min.js"></script>
|
||||||
|
|
||||||
<!-- Tablesorter: pager -->
|
<!-- Tablesorter: pager -->
|
||||||
<link rel="stylesheet" href="jquery.tablesorter.pager.css">
|
<link rel="stylesheet" href="external/jquery.tablesorter.pager.css">
|
||||||
<script src="widget-pager.js"></script>
|
<script src="external/widget-pager.js"></script>
|
||||||
<script src="events.js"></script>
|
<script src="events.js"></script>
|
||||||
|
|
||||||
<!-- Leaflet -->
|
<!-- Leaflet -->
|
||||||
<link rel="stylesheet" href="leaflet.css" />
|
<link rel="stylesheet" href="external/leaflet.css" />
|
||||||
<script src="leaflet.js"></script>
|
<script src="external/leaflet.js"></script>
|
||||||
<!-- script src="TileLayer.Grayscale.js"></script -->
|
<!-- script src="external/TileLayer.Grayscale.js"></script -->
|
||||||
<script src="map.js"></script>
|
<script src="map.js"></script>
|
||||||
|
|
||||||
<!-- Stations -->
|
<!-- Stations -->
|
||||||
@ -56,11 +56,11 @@
|
|||||||
<!-- Ereignisse -->
|
<!-- Ereignisse -->
|
||||||
<div class="tab" id="eventstab">
|
<div class="tab" id="eventstab">
|
||||||
<div class="pager events" id="eventspager">
|
<div class="pager events" id="eventspager">
|
||||||
<img src="first.png" class="first" alt="First" />
|
<img src="external/first.png" class="first" alt="First" />
|
||||||
<img src="prev.png" class="prev" alt="Prev" />
|
<img src="external/prev.png" class="prev" alt="Prev" />
|
||||||
<span class="pagedisplay"></span>
|
<span class="pagedisplay"></span>
|
||||||
<img src="next.png" class="next" alt="Next" />
|
<img src="external/next.png" class="next" alt="Next" />
|
||||||
<img src="last.png" class="last" alt="Last" />
|
<img src="external/last.png" class="last" alt="Last" />
|
||||||
<select class="pagesize" title="Select page size">
|
<select class="pagesize" title="Select page size">
|
||||||
<option value="5">5</option>
|
<option value="5">5</option>
|
||||||
<option value="10">10</option>
|
<option value="10">10</option>
|
||||||
@ -95,11 +95,11 @@
|
|||||||
<!-- Stations -->
|
<!-- Stations -->
|
||||||
<div class="tab" id="stationstab">
|
<div class="tab" id="stationstab">
|
||||||
<div class="pager stationspager" id="stationspager">
|
<div class="pager stationspager" id="stationspager">
|
||||||
<img src="first.png" class="stationsfirst" alt="First" />
|
<img src="external/first.png" class="stationsfirst" alt="First" />
|
||||||
<img src="prev.png" class="stationsprev" alt="Prev" />
|
<img src="external/prev.png" class="stationsprev" alt="Prev" />
|
||||||
<span class="stationspagedisplay"></span>
|
<span class="stationspagedisplay"></span>
|
||||||
<img src="next.png" class="stationsnext" alt="Next" />
|
<img src="external/next.png" class="stationsnext" alt="Next" />
|
||||||
<img src="last.png" class="stationslast" alt="Last" />
|
<img src="external/last.png" class="stationslast" alt="Last" />
|
||||||
<select class="stationspagesize" title="Select page size">
|
<select class="stationspagesize" title="Select page size">
|
||||||
<option value="5">5</option>
|
<option value="5">5</option>
|
||||||
<option value="10">10</option>
|
<option value="10">10</option>
|
||||||
|
100
www/map.js
@ -1,72 +1,26 @@
|
|||||||
/* toggles visibility of filtered markers
|
/**********************************************************************
|
||||||
* only events in the event list are shown */
|
* map.js *
|
||||||
function toggleFilteredMarkers() {
|
* script for map specific functions and setup *
|
||||||
// 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});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// hide filtered events in map
|
/* License
|
||||||
$("#eventstable > tbody > tr.filtered > td > a.map-link").each( function() {
|
Copyright 2014 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||||
if ( $(this).attr("eventid") ) {
|
|
||||||
eventTable[$(this).attr("eventid")].setStyle({opacity: 0, strokeOpacity: 0, fillOpacity: 0});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
highlightFirstEvent();
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Highlight the first event of the event list on the map if no
|
This program is free software: you can redistribute it and/or modify it
|
||||||
* other event is selected */
|
under the terms of the GNU General Public License as published by the Free
|
||||||
function highlightFirstEvent() {
|
Software Foundation, either version 3 of the License, or (at your option)
|
||||||
var highlightStyle = {
|
any later version.
|
||||||
color: 'red',
|
|
||||||
fillColor: '#f03',
|
|
||||||
};
|
|
||||||
var normalStyle = {
|
|
||||||
fillColor: "#FFF500",
|
|
||||||
color: "#FFF500"
|
|
||||||
};
|
|
||||||
$("#eventstable a.map-link").each( function() {
|
|
||||||
if ( $(this).attr("eventid") ) {
|
|
||||||
eventTable[$(this).attr("eventid")].setStyle(normalStyle);
|
|
||||||
$(this).removeClass('first');
|
|
||||||
$(this).text('Karte');
|
|
||||||
};
|
|
||||||
});
|
|
||||||
$("#eventstable > tbody > tr:not(.filtered)").first().find("a.map-link").each(function() {
|
|
||||||
if ( $(this).attr("eventid") ) {
|
|
||||||
eventTable[$(this).attr("eventid")].setStyle(highlightStyle);
|
|
||||||
$(this).addClass('first');
|
|
||||||
$(this).text('Karte (rot)');
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function highlightEvent( id ) {
|
This program is distributed in the hope that it will be useful, but
|
||||||
var highlightStyle = {
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
color: 'red',
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
fillColor: '#f03',
|
for more details.
|
||||||
};
|
|
||||||
var normalStyle = {
|
You should have received a copy of the GNU General Public License along
|
||||||
fillColor: "#FFF500",
|
with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
color: "#FFF500"
|
|
||||||
};
|
$Id$
|
||||||
$("#eventstable > tbody > tr:not(.filtered)").find("a.map-link").each( function() {
|
*/
|
||||||
if ( $(this).attr("eventid") ) {
|
|
||||||
if ( $(this).attr("eventid") == id ) {
|
|
||||||
eventTable[$(this).attr("eventid")].setStyle(highlightStyle);
|
|
||||||
$(this).addClass('first');
|
|
||||||
$(this).text('Karte (rot)');
|
|
||||||
} else {
|
|
||||||
eventTable[$(this).attr("eventid")].setStyle(normalStyle);
|
|
||||||
$(this).removeClass('first');
|
|
||||||
$(this).text('Karte');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* add station marker */
|
/* add station marker */
|
||||||
function addStationMarker(id, lat, lng) {
|
function addStationMarker(id, lat, lng) {
|
||||||
@ -80,7 +34,7 @@ function addStationMarker(id, lat, lng) {
|
|||||||
color: "#1C771C",
|
color: "#1C771C",
|
||||||
weight: 1,
|
weight: 1,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
fillOpacity: stationMarkerOpacity,
|
fillOpacity: config['station']['markerOpacity'],
|
||||||
className: id+' stationMarker',
|
className: id+' stationMarker',
|
||||||
}).addTo(stationLayer);
|
}).addTo(stationLayer);
|
||||||
stationTable[id] = marker;
|
stationTable[id] = marker;
|
||||||
@ -93,7 +47,7 @@ function addEventMarker(id, lat, lng, mag) {
|
|||||||
color: "#FFF500",
|
color: "#FFF500",
|
||||||
weight: 1,
|
weight: 1,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
fillOpacity: eventMarkerOpacity,
|
fillOpacity: config['event']['markerOpacity'],
|
||||||
className: id+' eventMarker',
|
className: id+' eventMarker',
|
||||||
};
|
};
|
||||||
var marker = L.circle(L.latLng(lat, lng), mag2radius(mag), markerOptions).addTo(eventLayer);
|
var marker = L.circle(L.latLng(lat, lng), mag2radius(mag), markerOptions).addTo(eventLayer);
|
||||||
@ -130,27 +84,27 @@ function initMapLink() {
|
|||||||
$(this).removeClass('selected');
|
$(this).removeClass('selected');
|
||||||
$(this).text('Karte');
|
$(this).text('Karte');
|
||||||
eventTable[$(this).attr('eventid')].setStyle(normalStyle);
|
eventTable[$(this).attr('eventid')].setStyle(normalStyle);
|
||||||
map.setView(mapCentreDefault, zoomDefault);
|
map.setView(config['map']['centerDefault'], config['map']['zoomDefault']);
|
||||||
highlightFirstEvent();
|
highlightFirstEvent();
|
||||||
// unselected -> selected
|
// unselected -> selected
|
||||||
} else {
|
} else {
|
||||||
$(this).addClass('selected');
|
$(this).addClass('selected');
|
||||||
$(this).text('im Fokus (rot)');
|
$(this).text('im Fokus (rot)');
|
||||||
eventTable[$(this).attr('eventid')].setStyle(highlightStyle);
|
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;
|
return false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************
|
/**********************************************************************
|
||||||
* document ready *
|
* document ready *
|
||||||
******************/
|
**********************************************************************/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// create a map in the "map" div, set the view to a given place and zoom
|
// 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);
|
new L.Control.Zoom({ position: 'topright' }).addTo(map);
|
||||||
|
|
||||||
// add MapQuestOSM tile layer
|
// add MapQuestOSM tile layer
|
||||||
|
63
www/misc.js
@ -1,10 +1,35 @@
|
|||||||
// calculate marker radius from magnitude, both formulas have equal radii at mag=1.2
|
/**********************************************************************
|
||||||
|
* misc.js *
|
||||||
|
* script for unspecific functions and setup *
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/* License
|
||||||
|
Copyright 2014 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the Free
|
||||||
|
Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* calculate marker radius from magnitude
|
||||||
|
* both formulas have equal radii at mag=1.2 */
|
||||||
function mag2radius(mag) {
|
function mag2radius(mag) {
|
||||||
return 400*mag; // radius proportional to magagnitude
|
return 400*mag; // radius proportional to magagnitude
|
||||||
// return 8.104*Math.pow(30,mag) // radius proportional to energy
|
// return 8.104*Math.pow(30,mag) // radius proportional to energy
|
||||||
};
|
};
|
||||||
|
|
||||||
// set height of eventlist div
|
/* set height of eventlist div */
|
||||||
function sleep(milliseconds) {
|
function sleep(milliseconds) {
|
||||||
var start = new Date().getTime();
|
var start = new Date().getTime();
|
||||||
for (var i = 0; i < 1e7; i++) {
|
for (var i = 0; i < 1e7; i++) {
|
||||||
@ -13,6 +38,8 @@ function sleep(milliseconds) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* setInfoHeight */
|
||||||
function setInfoHeight() {
|
function setInfoHeight() {
|
||||||
var height = $('div.map').height() - 36;
|
var height = $('div.map').height() - 36;
|
||||||
$('div.info').height(height);
|
$('div.info').height(height);
|
||||||
@ -51,24 +78,36 @@ function getLocation(lat, lng) {
|
|||||||
return [ region, regionID ];
|
return [ region, regionID ];
|
||||||
};
|
};
|
||||||
|
|
||||||
// window resize
|
/* window resize */
|
||||||
$( window ).resize(function() {
|
$( window ).resize(function() {
|
||||||
setInfoHeight();
|
setInfoHeight();
|
||||||
});
|
});
|
||||||
|
|
||||||
// create global vars
|
/* create global vars */
|
||||||
var map
|
var map;
|
||||||
var eventTable = {};
|
var eventTable = {};
|
||||||
var eventDetails = {};
|
var eventDetails = {};
|
||||||
var stationTable = {};
|
var stationTable = {};
|
||||||
var eventMarkerOpacity = 0.3;
|
var config = {
|
||||||
var stationMarkerOpacity = 0.5;
|
event: {
|
||||||
var zoomFocus = 12;
|
evaluationBlacklist: ['automatic', 'preliminary'],
|
||||||
var zoomDefault = 9;
|
markerOpacity: 0.3,
|
||||||
var mapCentreDefault = [51.85, 7.0];
|
minMag: 1.2,
|
||||||
var minMag = 1.2;
|
typeWhitelist: ['earthquake', 'induced or triggered event'],
|
||||||
|
},
|
||||||
|
map: {
|
||||||
|
zoomDefault: 9,
|
||||||
|
zoomFocus: 12,
|
||||||
|
centerDefault: [51.85, 7.0],
|
||||||
|
},
|
||||||
|
station: {
|
||||||
|
markerOpacity: 0.5,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// run when ready
|
/**********************************************************************
|
||||||
|
* document ready *
|
||||||
|
**********************************************************************/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// AJAX setup
|
// AJAX setup
|
||||||
$.ajaxSetup({timeout: 15000}); // 15 seconds
|
$.ajaxSetup({timeout: 15000}); // 15 seconds
|
||||||
|
@ -1,4 +1,28 @@
|
|||||||
// Load the stations using ajax
|
/**********************************************************************
|
||||||
|
* stations.js *
|
||||||
|
* script for station specific functions and setup *
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/* License
|
||||||
|
Copyright 2014 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the Free
|
||||||
|
Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Load the stations using ajax */
|
||||||
function loadStations(stime, etime) {
|
function loadStations(stime, etime) {
|
||||||
var mapBounds = map.getBounds();
|
var mapBounds = map.getBounds();
|
||||||
var N = mapBounds.getNorth();
|
var N = mapBounds.getNorth();
|
||||||
@ -57,6 +81,7 @@ function loadStations(stime, etime) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* initStationTable */
|
||||||
function initStationTable() {
|
function initStationTable() {
|
||||||
// tablesorter for station list
|
// tablesorter for station list
|
||||||
$("#stationstable").tablesorter(
|
$("#stationstable").tablesorter(
|
||||||
@ -113,6 +138,10 @@ function initStationTable() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* document ready *
|
||||||
|
**********************************************************************/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadStations();
|
loadStations();
|
||||||
});
|
});
|
||||||
|