Commit 95cbc500 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Minify JS

parent f791a1ee
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
$(document).ready(function(){var e=$("p.geolocationhint"),t=$("div.geolocation div.progress"),o=function(o,a,n){e.remove(),t.remove()},a=function(e){e.error?o(0,e.error):0==e.candidates.length?o():(resultTable=$("<table><tbody></tbody></table>"),resultBody=resultTable.children(),$.each(e.candidates,function(e,t){var o=t.ds100,a=t.name,n=t.distance;n=n.toFixed(1);var r=$(document.createElement("a"));r.attr("href",o),r.text(a),resultBody.append('<tr><td><a href="/'+o+'">'+a+"</a></td></tr>")}),t.replaceWith(resultTable))},n=function(e){$.post("/x/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude},a)},r=function(e){e.code==e.PERMISSION_DENIED?o():e.code==e.POSITION_UNAVAILABLE?o():(e.code,e.TIMEOUT,o())};navigator.geolocation?navigator.geolocation.getCurrentPosition(n,r):o()});
+3 −3
Original line number Diff line number Diff line
function travelynx_run_action(link, req, redir, err_callback) {
function tvly_run(link, req, redir, err_callback) {
	var error_icon = '<i class="material-icons">error</i>';
	var progressbar = $('<div class="progress"><div class="indeterminate"></div></div>');
	link.hide();
@@ -25,7 +25,7 @@ $(document).ready(function() {
			station: link.data('station'),
			train: link.data('train'),
		};
		travelynx_run_action(link, req, '/');
		tvly_run(link, req, '/');
	});
	$('.action-checkout').click(function() {
		var link = $(this);
@@ -34,7 +34,7 @@ $(document).ready(function() {
			station: link.data('station'),
			force: link.data('force'),
		};
		travelynx_run_action(link, req, '/' + req.station, function() {
		tvly_run(link, req, '/' + req.station, function() {
			link.append(' – Keine Echtzeitdaten vorhanden')
			link.data('force', true);
		});
+1 −0
Original line number Diff line number Diff line
function tvly_run(t,a,n,i){var c='<i class="material-icons">error</i>',o=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(o),$.post("/action",a,function(a){a.success?$(location).attr("href",n):(M.toast({html:c+" "+a.error}),o.remove(),i&&i(),t.append(" "+c),t.show())})}$(document).ready(function(){$(".action-checkin").click(function(){var t=$(this);tvly_run(t,{action:"checkin",station:t.data("station"),train:t.data("train")},"/")}),$(".action-checkout").click(function(){var t=$(this),a={action:"checkout",station:t.data("station"),force:t.data("force")};tvly_run(t,a,"/"+a.station,function(){t.append(" – Keine Echtzeitdaten vorhanden"),t.data("force",!0)})})});
+2 −2
Original line number Diff line number Diff line
@@ -10,9 +10,9 @@
	%= stylesheet '/static/css/local.css'
	%= javascript '/static/js/jquery-2.2.4.min.js'
	%= javascript '/static/js/materialize.min.js'
	%= javascript '/static/js/travelynx-actions.js'
	%= javascript '/static/js/travelynx-actions.min.js'
	% if (stash('with_geolocation')) {
		%= javascript '/static/js/geolocation.js'
		%= javascript '/static/js/geolocation.min.js'
	% }
</head>
<body>