summaryrefslogtreecommitdiff
path: root/public/static
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-21 16:27:32 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-21 16:27:32 +0200
commit95cbc500ae6841ff552a7b299c127c0754fb3a23 (patch)
tree33079214873c668bff2633f05cc969f7e8107bb0 /public/static
parentf791a1ee6c52b94f6a8894362c683a33c9437bb9 (diff)
Minify JS
Diffstat (limited to 'public/static')
-rw-r--r--public/static/js/geolocation.min.js1
-rw-r--r--public/static/js/travelynx-actions.js6
-rw-r--r--public/static/js/travelynx-actions.min.js1
3 files changed, 5 insertions, 3 deletions
diff --git a/public/static/js/geolocation.min.js b/public/static/js/geolocation.min.js
new file mode 100644
index 0000000..50cd010
--- /dev/null
+++ b/public/static/js/geolocation.min.js
@@ -0,0 +1 @@
+$(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()});
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js
index 91953a6..70c5d39 100644
--- a/public/static/js/travelynx-actions.js
+++ b/public/static/js/travelynx-actions.js
@@ -1,4 +1,4 @@
-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);
});
diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js
new file mode 100644
index 0000000..2ecfe38
--- /dev/null
+++ b/public/static/js/travelynx-actions.min.js
@@ -0,0 +1 @@
+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)})})});