diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2016-05-14 13:39:03 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2016-05-14 13:39:03 +0200 | 
| commit | 6f4e73168ff685e98a9ff918649095d6b48d9a8b (patch) | |
| tree | e476db4c65495f518004eb7ceeb37047c7956c45 | |
| parent | c34271a75d7f88f8b80f0f410bf6f30dcd79043f (diff) | |
more fancy geolocation errors
| -rw-r--r-- | public/static/default.css | 26 | ||||
| -rw-r--r-- | public/static/geolocation.js | 26 | 
2 files changed, 40 insertions, 12 deletions
| diff --git a/public/static/default.css b/public/static/default.css index ec13fb0..7c98d30 100644 --- a/public/static/default.css +++ b/public/static/default.css @@ -443,9 +443,29 @@ div.error {  	color: #ee0000;  } -span.error { -	font-size: 120%; -	color: #ee0000; +div.candidatelist div.error { +	font-size: 110%; +	color: #000000; +	font-weight: normal; +	padding:3px 6px 2px 6px; +	-webkit-border-radius: 30px; +	-moz-border-radius: 30px; +	border-radius: 30px; +	border-color: #ee0000; +	border-width: 1px; +	border-style: solid; +	background-color: #ffeeee; +	margin-top: 0.3em; +	margin-left: auto; +	margin-right: auto; +	max-width: 25em; +} + +div.candidatelist div.errshort { +	font-family: Monospace; +	margin-top: 2em; +	font-size: 100%; +	color: #aaaaaa;  }  pre { diff --git a/public/static/geolocation.js b/public/static/geolocation.js index f34e1e1..f571762 100644 --- a/public/static/geolocation.js +++ b/public/static/geolocation.js @@ -2,19 +2,27 @@ $(document).ready(function() {  	var removeStatus = function() {  		$('div.candidatestatus').remove();  	}; -	var showError = function(str) { -		var errnode = $(document.createElement('span')); +	var showError = function(oneline, str) { +		var errnode = $(document.createElement('div'));  		errnode.attr('class', 'error');  		errnode.text(str); + +		if (oneline) { +			var shortnode = $(document.createElement('div')); +			shortnode.attr('class', 'errshort'); +			shortnode.text(oneline); +			errnode.append(shortnode); +		} +  		$('div.candidatelist').append(errnode);  	};  	var processResult = function(data) {  		removeStatus();  		if (data.error) { -			showError(data.error); +			showError('Backend-Fehler', data.error);  		} else if (data.candidates.length == 0) { -			showError('Keine Bahnhöfe in 70km Umkreis gefunden'); +			showError(null, 'Keine Bahnhöfe in 70km Umkreis gefunden');  		} else {  			$.each(data.candidates, function(i, candidate) { @@ -39,13 +47,13 @@ $(document).ready(function() {  	var processError = function(error) {  		removeStatus();  		if (error.code == error.PERMISSION_DENIED) { -			showError('Standortanfrage abglehnt. Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.'); +			showError('geolocation.error.PERMISSION_DENIED', 'Standortanfrage nicht möglich. Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.');  		} else if (error.code == error.POSITION_UNAVAILABLE) { -			showError('Standort konnte nicht ermittelt werden (Service nicht verfügbar)'); +			showError('geolocation.error.POSITION_UNAVAILABLE', 'Standort konnte nicht ermittelt werden (Service nicht verfügbar)');  		} else if (error.code == error.TIMEOUT) { -			showError('Standort konnte nicht ermittelt werden (Timeout)'); +			showError('geolocation.error.TIMEOUT', 'Standort konnte nicht ermittelt werden (Timeout)');  		} else { -			showError('Standort konnte nicht ermittelt werden (unbekannter Fehler)'); +			showError('unknown geolocatior.error code', 'Standort konnte nicht ermittelt werden (unbekannter Fehler)');  		}  	}; @@ -54,6 +62,6 @@ $(document).ready(function() {  		$('div.candidatestatus').text('Position wird bestimmt…');  	} else {  		removeStatus(); -		showError('Standortanfragen werden von diesem Browser nicht unterstützt'); +		showError(null, 'Standortanfragen werden von diesem Browser nicht unterstützt');  	}  }); | 
