Creating more config paramters. Removing unused function sleep.
This commit is contained in:
		
							parent
							
								
									8886ea4abb
								
							
						
					
					
						commit
						3f3754a5e4
					
				
				
				Notes:
				
					subgit
				
				2018-03-07 17:58:48 +01:00 
			
			r615 www/trunk
| @ -25,8 +25,7 @@ | ||||
| /* do reverse geolocation lookup */ | ||||
| function getGeolocation(id, lat, lng) { | ||||
| 	if ( !geolocationTable[id] ) { | ||||
| 		// $.getJSON( "//nominatim.openstreetmap.org/reverse", { lat: lat, lon: lng, zoom: 10, format: "json" } )
 | ||||
| 		$.getJSON( "//open.mapquestapi.com/nominatim/v1/reverse.php", { lat: lat, lon: lng, zoom: 10, format: "json" } ) | ||||
| 		$.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"]; | ||||
| @ -57,28 +56,26 @@ function ajaxLoadEvents(stime, etime) { | ||||
| 	var E = mapBounds.getEast(); | ||||
| 	var S = mapBounds.getSouth(); | ||||
| 	var W = mapBounds.getWest(); | ||||
| 	var d = 0.1; | ||||
| 	if ( !stime ) { | ||||
| 		var stime = new Date(); | ||||
| 		stime.setDate(stime.getDate()-180); | ||||
| 		stime.setDate(stime.getDate()-config['map']['timespan']); | ||||
| 	}; | ||||
| 	if ( !etime ) { | ||||
| 		var etime = new Date(); | ||||
| 		etime.setDate(etime.getDate()+1); | ||||
| 	}; | ||||
| 	var url = "https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query" | ||||
| 	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-d, | ||||
| 		maxlat: N+d, | ||||
| 		minlon: W-d, | ||||
| 		maxlon: E+d, | ||||
| 		minmag: config['event']['minMag']-0.1, | ||||
| 		minlat: S-config['map']['latlngDelta'], | ||||
| 		maxlat: N+config['map']['latlngDelta'], | ||||
| 		minlon: W-config['map']['latlngDelta'], | ||||
| 		maxlon: E+config['map']['latlngDelta'], | ||||
| 		minmag: config['event']['minMag']-config['event']['minMagDelta'], | ||||
| 	}; | ||||
| 	$.ajax({ | ||||
| 		type: "GET", | ||||
| 		url: url, | ||||
| 		url: config['ajax']['eventURL'], | ||||
| 		data: request_data, | ||||
| 		dataType: "xml", | ||||
| 		success: function (xml) { | ||||
|  | ||||
							
								
								
									
										27
									
								
								www/misc.js
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								www/misc.js
									
									
									
									
									
								
							| @ -30,21 +30,9 @@ function mag2radius(mag) { | ||||
| }; | ||||
| 
 | ||||
| /* set height of eventlist div */ | ||||
| function sleep(milliseconds) { | ||||
|   var start = new Date().getTime(); | ||||
|   for (var i = 0; i < 1e7; i++) { | ||||
|     if ((new Date().getTime() - start) > milliseconds){ | ||||
|       break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /* setInfoHeight */ | ||||
| function setInfoHeight() { | ||||
| 	var height = $('div.map').height() - 36; | ||||
| 	$('div.info').height(height); | ||||
| 	//$('.tab').height(height-80);
 | ||||
| 	//$('#eventtable').height(height-100);
 | ||||
| }; | ||||
| 
 | ||||
| /* get region and regionID of a location */ | ||||
| @ -89,16 +77,26 @@ var eventTable = {}; | ||||
| var eventDetails = {}; | ||||
| var stationTable = {}; | ||||
| var config = { | ||||
| 	ajax: { | ||||
| 		timeout: 150000, // 15 seconds
 | ||||
| 		eventURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query', | ||||
| 		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',
 | ||||
| 	}, | ||||
| 	event: { | ||||
| 		evaluationBlacklist: ['automatic', 'preliminary'], | ||||
| 		markerOpacity: 0.3, | ||||
| 		minMag: 1.2, | ||||
| 		minMagDelta: 0.1, | ||||
| 		typeWhitelist: ['earthquake', 'induced or triggered event'], | ||||
| 	}, | ||||
| 	map: { | ||||
| 		zoomDefault: 9, | ||||
| 		zoomFocus: 12, | ||||
| 		centerDefault: [51.85, 7.0], | ||||
| 		timespan: 180, | ||||
| 		latlngDelta: 0.1, | ||||
| 	}, | ||||
| 	station: { | ||||
| 		markerOpacity: 0.5, | ||||
| @ -110,15 +108,16 @@ var config = { | ||||
|  **********************************************************************/ | ||||
| $(document).ready(function() { | ||||
| 	// AJAX setup
 | ||||
| 	$.ajaxSetup({timeout: 15000}); // 15 seconds
 | ||||
| 	$.ajaxSetup({timeout: config['ajax']['timeout']}); | ||||
| 
 | ||||
| 	// adjust height of infocontainer
 | ||||
| 	setInfoHeight(); | ||||
| 
 | ||||
| 	// create tabs
 | ||||
| 	var tabOptions = { | ||||
| 		active: 0, | ||||
| 		disabled: [2, 3], | ||||
| 	}; | ||||
| 	$('#tabs').tabs(tabOptions); | ||||
| 	// $('.ui-tabs-nav').sortable();
 | ||||
| }); | ||||
| 
 | ||||
|  | ||||
| @ -29,11 +29,9 @@ function loadStations(stime, etime) { | ||||
| 	var E = mapBounds.getEast(); | ||||
| 	var S = mapBounds.getSouth(); | ||||
| 	var W = mapBounds.getWest(); | ||||
| 	var d = 0.1; | ||||
| 	var url = "https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/station/1/query"; | ||||
| 	if ( !stime ) { | ||||
| 		var stime = new Date(); | ||||
| 		stime.setDate(stime.getDate()-180); | ||||
| 		stime.setDate(stime.getDate()-config['map']['timespan']); | ||||
| 	}; | ||||
| 	if ( !etime ) { | ||||
| 		var etime = new Date(); | ||||
| @ -42,14 +40,14 @@ function loadStations(stime, etime) { | ||||
| 	var request_data = { | ||||
| 		endafter: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), | ||||
| 		startbefore: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()), | ||||
| 		minlat: S-d, | ||||
| 		maxlat: N+d, | ||||
| 		minlon: W-d, | ||||
| 		maxlon: E+d, | ||||
| 		minlat: S-config['map']['latlngDelta'], | ||||
| 		maxlat: N+config['map']['latlngDelta'], | ||||
| 		minlon: W-config['map']['latlngDelta'], | ||||
| 		maxlon: E+config['map']['latlngDelta'], | ||||
| 	}; | ||||
| 	$.ajax({ | ||||
| 		type: "GET", | ||||
| 		url: url, | ||||
| 		url: config['ajax']['stationURL'], | ||||
| 		dataType: "xml", | ||||
| 		data: request_data, | ||||
| 		success: function (xml) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user