diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-12-08 21:04:34 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-12-08 21:04:34 +0100 |
commit | 875dd4e0b5773f2f52841d2effdfdd110b852aa0 (patch) | |
tree | dc90710c8dc066075fc26fb0224b8ee1048b97f3 /public | |
parent | 315a94affedffda8ab4be62cebf2b62c3f5f0d78 (diff) |
confirm undo of checkins after 15 minutes1.11.2
Diffstat (limited to 'public')
-rw-r--r-- | public/service-worker.js | 26 | ||||
-rw-r--r-- | public/static/css/material-icons.css | 8 | ||||
-rw-r--r-- | public/static/js/travelynx-actions.js | 12 | ||||
-rw-r--r-- | public/static/js/travelynx-actions.min.js | 2 | ||||
-rw-r--r-- | public/static/manifest.json | 12 | ||||
l--------- | public/static/v31 (renamed from public/static/v29) | 0 |
6 files changed, 34 insertions, 26 deletions
diff --git a/public/service-worker.js b/public/service-worker.js index 4832988..8268bd0 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,19 +1,19 @@ -const CACHE_NAME = 'static-cache-v30'; +const CACHE_NAME = 'static-cache-v31'; const FILES_TO_CACHE = [ '/favicon.ico', '/offline.html', - '/static/v30/css/light.min.css', - '/static/v30/css/dark.min.css', - '/static/v30/css/material-icons.css', - '/static/v30/css/local.css', - '/static/v30/fonts/MaterialIcons-Regular.woff2', - '/static/v30/fonts/MaterialIcons-Regular.woff', - '/static/v30/fonts/MaterialIcons-Regular.ttf', - '/static/v30/js/jquery-3.4.1.min.js', - '/static/v30/js/materialize.min.js', - '/static/v30/js/travelynx-actions.min.js', - '/static/v30/js/autocomplete.min.js', - '/static/v30/js/geolocation.min.js', + '/static/v31/css/light.min.css', + '/static/v31/css/dark.min.css', + '/static/v31/css/material-icons.css', + '/static/v31/css/local.css', + '/static/v31/fonts/MaterialIcons-Regular.woff2', + '/static/v31/fonts/MaterialIcons-Regular.woff', + '/static/v31/fonts/MaterialIcons-Regular.ttf', + '/static/v31/js/jquery-3.4.1.min.js', + '/static/v31/js/materialize.min.js', + '/static/v31/js/travelynx-actions.min.js', + '/static/v31/js/autocomplete.min.js', + '/static/v31/js/geolocation.min.js', ]; self.addEventListener('install', (evt) => { diff --git a/public/static/css/material-icons.css b/public/static/css/material-icons.css index 04b8309..d2806ec 100644 --- a/public/static/css/material-icons.css +++ b/public/static/css/material-icons.css @@ -2,12 +2,12 @@ font-family: 'Material Icons'; font-style: normal; font-weight: 400; - src: url(/static/v30/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ + src: url(/static/v31/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ src: local('Material Icons'), local('MaterialIcons-Regular'), - url(/static/v30/fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(/static/v30/fonts/MaterialIcons-Regular.woff) format('woff'), - url(/static/v30/fonts/MaterialIcons-Regular.ttf) format('truetype'); + url(/static/v31/fonts/MaterialIcons-Regular.woff2) format('woff2'), + url(/static/v31/fonts/MaterialIcons-Regular.woff) format('woff'), + url(/static/v31/fonts/MaterialIcons-Regular.ttf) format('truetype'); } .material-icons { diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index 7f60df6..f42b491 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -164,11 +164,19 @@ function tvly_reg_handlers() { }); $('.action-undo').click(function() { var link = $(this); + var now = Date.now() / 1000; + var checkints = parseInt(link.data('checkints')); var req = { action: 'undo', undo_id: link.data('id'), }; - tvly_run(link, req); + var do_checkout = true; + if (now - checkints > 900) { + do_checkout = confirm("Checkin wirklich rückgängig machen? Er kann ggf. nicht wiederholt werden."); + } + if (do_checkout) { + tvly_run(link, req); + } }); $('.action-cancelled-from').click(function() { var link = $(this); @@ -196,7 +204,7 @@ function tvly_reg_handlers() { checkin: link.data('checkin'), checkout: link.data('checkout'), }; - really_delete = confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden."); + var really_delete = confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden."); if (really_delete) { tvly_run(link, req); } diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js index 14bdb21..9efef3f 100644 --- a/public/static/js/travelynx-actions.min.js +++ b/public/static/js/travelynx-actions.min.js @@ -1 +1 @@ -var j_departure=0,j_duration=0,j_arrival=0,j_dest="",j_stops=[];function upd_journey_data(){$(".countdown").each(function(){var t=$(this).data("journey");t&&(t=t.split(";"),j_departure=parseInt(t[0]),j_arrival=parseInt(t[1]),j_duration=j_arrival-j_departure);var e=$(this).data("dest");e&&(j_dest=e);var a=$(this).data("route");if(a)for(var n in a=a.split("|"),j_stops=[],a){for(var o=a[n].split(";"),r=1;r<5;r++)o[r]=parseInt(o[r]);j_stops.push(o)}})}function upd_countdown(){var t=Date.now()/1e3;t<j_departure?$(".countdown").text("Abfahrt in "+Math.round((j_departure-t)/60)+" Minuten"):0<j_arrival&&(t<j_arrival?$(".countdown").text("Ankunft in "+Math.round((j_arrival-t)/60)+" Minuten"):$(".countdown").text("Ziel erreicht"))}function hhmm(t){var e=new Date(1e3*t),a=e.getHours(),n=e.getMinutes();return(a<10?"0"+a:a)+":"+(n<10?"0"+n:n)}function odelay(t,e){return t<e?" (+"+(e-t)/60+")":t==e?"":" ("+(e-t)/60+")"}function tvly_run(e,t,a){var n='<i class="material-icons">error</i>',o=$('<div class="progress"><div class="indeterminate"></div></div>');e.hide(),e.after(o),$.post("/action",t,function(t){t.success?$(location).attr("href",t.redirect_to):(M.toast({html:n+" "+t.error}),o.remove(),a&&a(),e.append(" "+n),e.show())})}function tvly_update(){$.get("/ajax/status_card.html",function(t){$(".statuscol").html(t),tvly_reg_handlers(),upd_journey_data(),setTimeout(tvly_update,4e4)}).fail(function(){$(".sync-failed-marker").css("display","block"),upd_countdown(),setTimeout(tvly_update,5e3)})}function tvly_update_public(){var t;$(".publicstatuscol").each(function(){t=$(this).data("user")}),$.get("/ajax/status/"+t+".html",function(t){$(".publicstatuscol").html(t),upd_journey_data(),setTimeout(tvly_update_public,4e4)}).fail(function(){$(".sync-failed-marker").css("display","block"),upd_countdown(),setTimeout(tvly_update_public,5e3)})}function tvly_journey_progress(){var t=Date.now()/1e3,e=0;if(0<j_duration){for(stop in(e=1-(j_arrival-t)/j_duration)<0&&(e=0),1<e&&(e=1),$(".progress .determinate").css("width",100*e+"%"),j_stops){var a=j_stops[stop][0],n=j_stops[stop][1],o=j_stops[stop][2],r=j_stops[stop][3],i=j_stops[stop][4];if(a==j_dest){$(".next-stop").html("");break}if(0!=o&&0<o-t){$(".next-stop").html(a+"<br/>"+hhmm(o)+odelay(n,o));break}if(0!=i&&0<i-t){$(".next-stop").html(a+"<br/>"+hhmm(o)+" → "+hhmm(i)+odelay(r,i));break}}setTimeout(tvly_journey_progress,5e3)}}function tvly_reg_handlers(){$(".action-checkin").click(function(){var t=$(this),e={action:"checkin",station:t.data("station"),train:t.data("train"),dest:t.data("dest")};tvly_run(t,e)}),$(".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),e={action:"undo",undo_id:t.data("id")};tvly_run(t,e)}),$(".action-cancelled-from").click(function(){var t=$(this),e={action:"cancelled_from",station:t.data("station"),train:t.data("train")};tvly_run(t,e)}),$(".action-cancelled-to").click(function(){var t=$(this),e={action:"cancelled_to",station:t.data("station"),force:!0};tvly_run(t,e)}),$(".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)}),$(".action-share").click(function(){var t=$(this).data("text"),e=$(this).data("url");if(navigator.share)shareObj={text:t},e&&(shareObj.url=e),navigator.share(shareObj);else{var a=document.createElement("textarea");e&&(t+=" "+e),a.value=t,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),a.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(a),M.toast({html:"Text kopiert: „"+t+"“"})}})}$(document).ready(function(){tvly_reg_handlers(),$(".statuscol .autorefresh").length&&(upd_journey_data(),setTimeout(tvly_update,4e4),setTimeout(tvly_journey_progress,5e3)),$(".publicstatuscol .autorefresh").length&&(upd_journey_data(),setTimeout(tvly_update_public,4e4),setTimeout(tvly_journey_progress,5e3)),$("a[href]").click(function(){$("nav .preloader-wrapper").addClass("active")})}); +function upd_journey_data(){$(".countdown").each(function(){var t=$(this).data("journey");t&&(t=t.split(";"),j_departure=parseInt(t[0]),j_arrival=parseInt(t[1]),j_duration=j_arrival-j_departure);var e=$(this).data("dest");e&&(j_dest=e);var a=$(this).data("route");if(a){a=a.split("|"),j_stops=[];for(var n in a){for(var o=a[n].split(";"),r=1;r<5;r++)o[r]=parseInt(o[r]);j_stops.push(o)}}})}function upd_countdown(){var t=Date.now()/1e3;j_departure>t?$(".countdown").text("Abfahrt in "+Math.round((j_departure-t)/60)+" Minuten"):j_arrival>0&&(j_arrival>t?$(".countdown").text("Ankunft in "+Math.round((j_arrival-t)/60)+" Minuten"):$(".countdown").text("Ziel erreicht"))}function hhmm(t){var e=new Date(1e3*t),a=e.getHours(),n=e.getMinutes();return(a<10?"0"+a:a)+":"+(n<10?"0"+n:n)}function odelay(t,e){return t<e?" (+"+(e-t)/60+")":t==e?"":" ("+(e-t)/60+")"}function tvly_run(t,e,a){var n='<i class="material-icons">error</i>',o=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(o),$.post("/action",e,function(e){e.success?$(location).attr("href",e.redirect_to):(M.toast({html:n+" "+e.error}),o.remove(),a&&a(),t.append(" "+n),t.show())})}function tvly_update(){$.get("/ajax/status_card.html",function(t){$(".statuscol").html(t),tvly_reg_handlers(),upd_journey_data(),setTimeout(tvly_update,4e4)}).fail(function(){$(".sync-failed-marker").css("display","block"),upd_countdown(),setTimeout(tvly_update,5e3)})}function tvly_update_public(){var t;$(".publicstatuscol").each(function(){t=$(this).data("user")}),$.get("/ajax/status/"+t+".html",function(t){$(".publicstatuscol").html(t),upd_journey_data(),setTimeout(tvly_update_public,4e4)}).fail(function(){$(".sync-failed-marker").css("display","block"),upd_countdown(),setTimeout(tvly_update_public,5e3)})}function tvly_journey_progress(){var t=Date.now()/1e3,e=0;if(j_duration>0){e=1-(j_arrival-t)/j_duration,e<0&&(e=0),e>1&&(e=1),$(".progress .determinate").css("width",100*e+"%");for(stop in j_stops){var a=j_stops[stop][0],n=j_stops[stop][1],o=j_stops[stop][2],r=j_stops[stop][3],i=j_stops[stop][4];if(a==j_dest){$(".next-stop").html("");break}if(0!=o&&o-t>0){$(".next-stop").html(a+"<br/>"+hhmm(o)+odelay(n,o));break}if(0!=i&&i-t>0){$(".next-stop").html(a+"<br/>"+hhmm(o)+" → "+hhmm(i)+odelay(r,i));break}}setTimeout(tvly_journey_progress,5e3)}}function tvly_reg_handlers(){$(".action-checkin").click(function(){var t=$(this);tvly_run(t,{action:"checkin",station:t.data("station"),train:t.data("train"),dest:t.data("dest")})}),$(".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),e=Date.now()/1e3,a=parseInt(t.data("checkints")),n={action:"undo",undo_id:t.data("id")},o=!0;e-a>900&&(o=confirm("Checkin wirklich rückgängig machen? Er kann ggf. nicht wiederholt werden.")),o&&tvly_run(t,n)}),$(".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")};confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden.")&&tvly_run(t,e)}),$(".action-share").click(function(){var t=$(this).data("text"),e=$(this).data("url");if(navigator.share)shareObj={text:t},e&&(shareObj.url=e),navigator.share(shareObj);else{var a=document.createElement("textarea");e&&(t+=" "+e),a.value=t,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),a.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(a),M.toast({html:"Text kopiert: „"+t+"“"})}})}var j_departure=0,j_duration=0,j_arrival=0,j_dest="",j_stops=[];$(document).ready(function(){tvly_reg_handlers(),$(".statuscol .autorefresh").length&&(upd_journey_data(),setTimeout(tvly_update,4e4),setTimeout(tvly_journey_progress,5e3)),$(".publicstatuscol .autorefresh").length&&(upd_journey_data(),setTimeout(tvly_update_public,4e4),setTimeout(tvly_journey_progress,5e3)),$("a[href]").click(function(){$("nav .preloader-wrapper").addClass("active")})}); diff --git a/public/static/manifest.json b/public/static/manifest.json index f18ba61..8e67133 100644 --- a/public/static/manifest.json +++ b/public/static/manifest.json @@ -3,27 +3,27 @@ "short_name": "Travelynx", "scope": "/", "icons": [{ - "src": "/static/v30/icons/icon-128x128.png", + "src": "/static/v31/icons/icon-128x128.png", "sizes": "128x128", "type": "image/png" }, { - "src": "/static/v30/icons/icon-144x144.png", + "src": "/static/v31/icons/icon-144x144.png", "sizes": "144x144", "type": "image/png" }, { - "src": "/static/v30/icons/icon-152x152.png", + "src": "/static/v31/icons/icon-152x152.png", "sizes": "152x152", "type": "image/png" }, { - "src": "/static/v30/icons/icon-192x192.png", + "src": "/static/v31/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png" }, { - "src": "/static/v30/icons/icon-256x256.png", + "src": "/static/v31/icons/icon-256x256.png", "sizes": "256x256", "type": "image/png" }, { - "src": "/static/v30/icons/icon-512x512.png", + "src": "/static/v31/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" }], diff --git a/public/static/v29 b/public/static/v31 index 945c9b4..945c9b4 120000 --- a/public/static/v29 +++ b/public/static/v31 |