diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2021-06-27 11:16:07 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2021-06-27 11:16:07 +0200 | 
| commit | fa0c4f8837bd3270a739ce5d7b4b82473ea67268 (patch) | |
| tree | 2a6cf281ed2d8925574a771c7725cffcb2cdc418 /static/v0/js | |
| parent | 5b0c3d3bf6ab35ca3ecb10914a350894e1e8cc7e (diff) | |
show line types in stop search
Diffstat (limited to 'static/v0/js')
| -rw-r--r-- | static/v0/js/geolocation.js | 39 | 
1 files changed, 39 insertions, 0 deletions
diff --git a/static/v0/js/geolocation.js b/static/v0/js/geolocation.js index 2f93db7..4e868b0 100644 --- a/static/v0/js/geolocation.js +++ b/static/v0/js/geolocation.js @@ -1,6 +1,13 @@  document.addEventListener("DOMContentLoaded", function() {  	const geoLocationButton = document.getElementById('geolocationsearch'); +	const mkTextNode = function(className, textContent) { +		const node = document.createElement("span"); +		node.className = className; +		node.textContent = textContent; +		return node +	} +  	const processResult = function(results) {  		const list = document.createElement("ul");  		list.className = "stops"; @@ -9,6 +16,7 @@ document.addEventListener("DOMContentLoaded", function() {  			const listentry = document.createElement("li");  			const link = document.createElement("a");  			const note = document.createElement("span"); +			const lines = document.createElement("span");  			link.className = "name";  			link.textContent = result.name; @@ -21,8 +29,39 @@ document.addEventListener("DOMContentLoaded", function() {  				note.textContent = result.distance + " m"  			} +			lines.className = "lines"; + +			if (result.products.nationalExpress) { +				lines.appendChild(mkTextNode("longdistance", "ICE")); +			} +			if (result.products.national) { +				lines.appendChild(mkTextNode("longdistance", "IC")); +			} +			if (result.products.regionalExp) { +				lines.appendChild(mkTextNode("longdistance", "RE")); +			} +			if (result.products.regional) { +				lines.appendChild(mkTextNode("longdistance", "R")); +			} +			if (result.products.suburban) { +				lines.appendChild(mkTextNode("suburban", "S")); +			} +			if (result.products.tram) { +				lines.appendChild(mkTextNode("tram", "T")); +			} +			if (result.products.bus) { +				lines.appendChild(mkTextNode("bus", "Bus")); +			} +			if (result.products.ferry) { +				lines.appendChild(mkTextNode("bus", "Fähre")); +			} +			if (result.products.taxi) { +				lines.appendChild(mkTextNode("taxi", "AST")); +			} +  			listentry.appendChild(link);  			listentry.appendChild(note); +			listentry.appendChild(lines);  			list.appendChild(listentry);  		}  		geoLocationButton.replaceWith(list);  | 
