summaryrefslogtreecommitdiff
path: root/public/static
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-02 10:05:15 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-02 10:05:15 +0200
commit3de5de7db2b7eebe000c6534bfd020405921ccdc (patch)
treec57f9ea7cddbd99f21dd1a16760ddeabdc0079ce /public/static
parent1bf128936d1af615bcbbf6aeb6d6ce5ab8179975 (diff)
Finish public-facing exposed user status (opt-in)
Diffstat (limited to 'public/static')
-rw-r--r--public/static/js/travelynx-actions.js25
-rw-r--r--public/static/js/travelynx-actions.min.js2
l---------public/static/v9 (renamed from public/static/v7)0
3 files changed, 23 insertions, 4 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js
index 015a35d..cb4f975 100644
--- a/public/static/js/travelynx-actions.js
+++ b/public/static/js/travelynx-actions.js
@@ -21,10 +21,23 @@ function tvly_update() {
$.get('/ajax/status_card.html', function(data) {
$('.statuscol').html(data);
tvly_reg_handlers();
- setTimeout(tvly_update, 15000);
+ setTimeout(tvly_update, 20000);
}).fail(function() {
$('.sync-failed-marker').css('display', 'block');
- setTimeout(tvly_update, 15000);
+ setTimeout(tvly_update, 20000);
+ });
+}
+function tvly_update_public() {
+ var user_name;
+ $('.publicstatuscol').each(function() {
+ user_name = $(this).data('user');
+ });
+ $.get('/ajax/status/' + user_name + '.html', function(data) {
+ $('.publicstatuscol').html(data);
+ setTimeout(tvly_update_public, 20000);
+ }).fail(function() {
+ $('.sync-failed-marker').css('display', 'block');
+ setTimeout(tvly_update_public, 20000);
});
}
function tvly_reg_handlers() {
@@ -92,6 +105,12 @@ function tvly_reg_handlers() {
$(document).ready(function() {
tvly_reg_handlers();
if ($('.statuscol .autorefresh').length) {
- setTimeout(tvly_update, 15000);
+ setTimeout(tvly_update, 20000);
+ }
+});
+$(document).ready(function() {
+ tvly_reg_handlers();
+ if ($('.publicstatuscol .autorefresh').length) {
+ setTimeout(tvly_update_public, 20000);
}
});
diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js
index 7bf9922..1276162 100644
--- a/public/static/js/travelynx-actions.min.js
+++ b/public/static/js/travelynx-actions.min.js
@@ -1 +1 @@
-function tvly_run(t,a,e){var n='<i class="material-icons">error</i>',c=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(c),$.post("/action",a,function(a){a.success?$(location).attr("href",a.redirect_to):(M.toast({html:n+" "+a.error}),c.remove(),e&&e(),t.append(" "+n),t.show())})}function tvly_update(){$.get("/ajax/status_card.html",function(t){$(".statuscol").html(t),tvly_reg_handlers(),setTimeout(tvly_update,15e3)}).fail(function(){$(".sync-failed-marker").css("display","block"),setTimeout(tvly_update,15e3)})}function tvly_reg_handlers(){$(".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,function(){t.append(" – Ohne Echtzeitdaten auschecken?"),t.data("force",!0)})}),$(".action-undo").click(function(){var t=$(this);tvly_run(t,{action:"undo",undo_id:t.data("id")})}),$(".action-cancelled-from").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_from",station:t.data("station"),train:t.data("train")})}),$(".action-cancelled-to").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_to",station:t.data("station"),force:!0})}),$(".action-delete").click(function(){var t=$(this),a={action:"delete",id:t.data("id"),checkin:t.data("checkin"),checkout:t.data("checkout")};really_delete=confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden."),really_delete&&tvly_run(t,a)})}$(document).ready(function(){tvly_reg_handlers(),$(".statuscol .autorefresh").length&&setTimeout(tvly_update,15e3)});
+function tvly_run(t,e,a){var n='<i class="material-icons">error</i>',c=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(c),$.post("/action",e,function(e){e.success?$(location).attr("href",e.redirect_to):(M.toast({html:n+" "+e.error}),c.remove(),a&&a(),t.append(" "+n),t.show())})}function tvly_update(){$.get("/ajax/status_card.html",function(t){$(".statuscol").html(t),tvly_reg_handlers(),setTimeout(tvly_update,2e4)}).fail(function(){$(".sync-failed-marker").css("display","block"),setTimeout(tvly_update,2e4)})}function tvly_update_public(){var t;$(".publicstatuscol").each(function(){t=$(this).data("user")}),$.get("/ajax/status/"+t+".html",function(t){$(".publicstatuscol").html(t),setTimeout(tvly_update_public,2e4)}).fail(function(){$(".sync-failed-marker").css("display","block"),setTimeout(tvly_update_public,2e4)})}function tvly_reg_handlers(){$(".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),e={action:"checkout",station:t.data("station"),force:t.data("force")};tvly_run(t,e,function(){t.append(" – Ohne Echtzeitdaten auschecken?"),t.data("force",!0)})}),$(".action-undo").click(function(){var t=$(this);tvly_run(t,{action:"undo",undo_id:t.data("id")})}),$(".action-cancelled-from").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_from",station:t.data("station"),train:t.data("train")})}),$(".action-cancelled-to").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_to",station:t.data("station"),force:!0})}),$(".action-delete").click(function(){var t=$(this),e={action:"delete",id:t.data("id"),checkin:t.data("checkin"),checkout:t.data("checkout")};really_delete=confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden."),really_delete&&tvly_run(t,e)})}$(document).ready(function(){tvly_reg_handlers(),$(".statuscol .autorefresh").length&&setTimeout(tvly_update,2e4)}),$(document).ready(function(){tvly_reg_handlers(),$(".publicstatuscol .autorefresh").length&&setTimeout(tvly_update_public,2e4)});
diff --git a/public/static/v7 b/public/static/v9
index 945c9b4..945c9b4 120000
--- a/public/static/v7
+++ b/public/static/v9