Unverified Commit e154a8ae authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

show loading icon when clicking on a stop in stop list

parent eb5f4b06
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -24,7 +24,11 @@ $(document).ready(function() {
			const res = $(document.createElement('p'));
			$.each(stops, function(i, stop) {
				const parts = stop.split(';');
				res.append($('<a class="tablerow" href="/s/' + parts[0] + '"><span>' + parts[1] + '</span></a>'));
				const node = $('<a class="tablerow" href="/s/' + parts[0] + '"><span>' + parts[1] + '</span></a>');
				node.click(function() {
					$('nav .preloader-wrapper').addClass('active');
				});
				res.append(node);
			});
			$('p.geolocationhint').text('Letzte Ziele:');
			getPlaceholder().replaceWith(res);
@@ -46,7 +50,11 @@ $(document).ready(function() {
					name = candidate.name,
					distance = candidate.distance.toFixed(1);

				res.append($('<a class="tablerow" href="/s/' + ds100 + '"><span>' + name + '</span></a>'));
				const node = $('<a class="tablerow" href="/s/' + ds100 + '"><span>' + name + '</span></a>');
				node.click(function() {
					$('nav .preloader-wrapper').addClass('active');
				});
				res.append(node);
			});
			getPlaceholder().replaceWith(res);
		}
+1 −1
Original line number Diff line number Diff line
$(document).ready(function(){function i(){return $("div.geolocation div.progress")}function e(e){$.post("/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude},o)}function t(e){e.code==e.PERMISSION_DENIED?n("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.","geolocation.error.PERMISSION_DENIED"):e.code==e.POSITION_UNAVAILABLE?n("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):e.code==e.TIMEOUT?n("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):n("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")}const n=function(e,t,n){var o=$(document.createElement("div")),t=(o.attr("class","error"),o.text(t),$(document.createElement("strong"))),e=(t.text(e+" "),o.prepend(t),$("div.geolocation").append(o),$("div.geolocation").data("recent"));if(e){t=e.split("|");const r=$(document.createElement("p"));$.each(t,function(e,t){t=t.split(";");r.append($('<a class="tablerow" href="/s/'+t[0]+'"><span>'+t[1]+"</span></a>"))}),$("p.geolocationhint").text("Letzte Ziele:"),i().replaceWith(r)}else i().remove()},o=function(e){if(e.error)n("Backend-Fehler:",e.error,null);else if(0==e.candidates.length)n("Keine Bahnhöfe in 70km Umkreis gefunden","",null);else{const r=$(document.createElement("p"));$.each(e.candidates,function(e,t){var n=t.ds100,o=t.name;t.distance.toFixed(1);r.append($('<a class="tablerow" href="/s/'+n+'"><span>'+o+"</span></a>"))}),i().replaceWith(r)}},r=$("div.geolocation > button");r.data("recent");function a(){r.replaceWith($('<p class="geolocationhint">Stationen in der Umgebung:</p><div class="progress"><div class="indeterminate"></div></div>')),navigator.geolocation.getCurrentPosition(e,t)}r.length&&(navigator.geolocation?navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(function(e){"prompt"===e.state?r.on("click",a):a()}):r.on("click",a):n("Standortanfragen werden von diesem Browser nicht unterstützt","",null))});
$(document).ready(function(){function i(){return $("div.geolocation div.progress")}function e(e){$.post("/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude},o)}function n(e){e.code==e.PERMISSION_DENIED?t("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.","geolocation.error.PERMISSION_DENIED"):e.code==e.POSITION_UNAVAILABLE?t("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):e.code==e.TIMEOUT?t("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):t("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")}const t=function(e,n,t){var o=$(document.createElement("div")),n=(o.attr("class","error"),o.text(n),$(document.createElement("strong"))),e=(n.text(e+" "),o.prepend(n),$("div.geolocation").append(o),$("div.geolocation").data("recent"));if(e){n=e.split("|");const r=$(document.createElement("p"));$.each(n,function(e,n){n=n.split(";"),n=$('<a class="tablerow" href="/s/'+n[0]+'"><span>'+n[1]+"</span></a>");n.click(function(){$("nav .preloader-wrapper").addClass("active")}),r.append(n)}),$("p.geolocationhint").text("Letzte Ziele:"),i().replaceWith(r)}else i().remove()},o=function(e){if(e.error)t("Backend-Fehler:",e.error,null);else if(0==e.candidates.length)t("Keine Bahnhöfe in 70km Umkreis gefunden","",null);else{const r=$(document.createElement("p"));$.each(e.candidates,function(e,n){var t=n.ds100,o=n.name,n=(n.distance.toFixed(1),$('<a class="tablerow" href="/s/'+t+'"><span>'+o+"</span></a>"));n.click(function(){$("nav .preloader-wrapper").addClass("active")}),r.append(n)}),i().replaceWith(r)}},r=$("div.geolocation > button");r.data("recent");function a(){r.replaceWith($('<p class="geolocationhint">Stationen in der Umgebung:</p><div class="progress"><div class="indeterminate"></div></div>')),navigator.geolocation.getCurrentPosition(e,n)}r.length&&(navigator.geolocation?navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(function(e){"prompt"===e.state?r.on("click",a):a()}):r.on("click",a):t("Standortanfragen werden von diesem Browser nicht unterstützt","",null))});