parent
ead18f1212
commit
3e61b9de48
7 changed files with 39 additions and 28 deletions
|
@ -1,19 +1,19 @@
|
||||||
const CACHE_NAME = 'static-cache-v28';
|
const CACHE_NAME = 'static-cache-v29';
|
||||||
const FILES_TO_CACHE = [
|
const FILES_TO_CACHE = [
|
||||||
'/favicon.ico',
|
'/favicon.ico',
|
||||||
'/offline.html',
|
'/offline.html',
|
||||||
'/static/v28/css/light.min.css',
|
'/static/v29/css/light.min.css',
|
||||||
'/static/v28/css/dark.min.css',
|
'/static/v29/css/dark.min.css',
|
||||||
'/static/v28/css/material-icons.css',
|
'/static/v29/css/material-icons.css',
|
||||||
'/static/v28/css/local.css',
|
'/static/v29/css/local.css',
|
||||||
'/static/v28/fonts/MaterialIcons-Regular.woff2',
|
'/static/v29/fonts/MaterialIcons-Regular.woff2',
|
||||||
'/static/v28/fonts/MaterialIcons-Regular.woff',
|
'/static/v29/fonts/MaterialIcons-Regular.woff',
|
||||||
'/static/v28/fonts/MaterialIcons-Regular.ttf',
|
'/static/v29/fonts/MaterialIcons-Regular.ttf',
|
||||||
'/static/v28/js/jquery-3.4.1.min.js',
|
'/static/v29/js/jquery-3.4.1.min.js',
|
||||||
'/static/v28/js/materialize.min.js',
|
'/static/v29/js/materialize.min.js',
|
||||||
'/static/v28/js/travelynx-actions.min.js',
|
'/static/v29/js/travelynx-actions.min.js',
|
||||||
'/static/v28/js/autocomplete.min.js',
|
'/static/v29/js/autocomplete.min.js',
|
||||||
'/static/v28/js/geolocation.min.js',
|
'/static/v29/js/geolocation.min.js',
|
||||||
];
|
];
|
||||||
|
|
||||||
self.addEventListener('install', (evt) => {
|
self.addEventListener('install', (evt) => {
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(/static/v28/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */
|
src: url(/static/v29/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */
|
||||||
src: local('Material Icons'),
|
src: local('Material Icons'),
|
||||||
local('MaterialIcons-Regular'),
|
local('MaterialIcons-Regular'),
|
||||||
url(/static/v28/fonts/MaterialIcons-Regular.woff2) format('woff2'),
|
url(/static/v29/fonts/MaterialIcons-Regular.woff2) format('woff2'),
|
||||||
url(/static/v28/fonts/MaterialIcons-Regular.woff) format('woff'),
|
url(/static/v29/fonts/MaterialIcons-Regular.woff) format('woff'),
|
||||||
url(/static/v28/fonts/MaterialIcons-Regular.ttf) format('truetype');
|
url(/static/v29/fonts/MaterialIcons-Regular.ttf) format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-icons {
|
.material-icons {
|
||||||
|
|
|
@ -202,16 +202,27 @@ function tvly_reg_handlers() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.action-share').click(function() {
|
$('.action-share').click(function() {
|
||||||
|
var text = $(this).data('text');
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
shareObj = {
|
shareObj = {
|
||||||
text: $(this).data('text')
|
text: text
|
||||||
};
|
};
|
||||||
if ($(this).data('url')) {
|
if ($(this).data('url')) {
|
||||||
shareObj['url'] = $(this).data('url');
|
shareObj['url'] = $(this).data('url');
|
||||||
}
|
}
|
||||||
navigator.share(shareObj);
|
navigator.share(shareObj);
|
||||||
} else if ($(this).data('url')) {
|
} else {
|
||||||
location.href = $(this).data('url');
|
var el = document.createElement('textarea');
|
||||||
|
el.value = text;
|
||||||
|
el.setAttribute('readonly', '');
|
||||||
|
el.style.position = 'absolute';
|
||||||
|
el.style.left = '-9999px';
|
||||||
|
document.body.appendChild(el);
|
||||||
|
el.select();
|
||||||
|
el.setSelectionRange(0, 99999);
|
||||||
|
document.execCommand('copy');
|
||||||
|
document.body.removeChild(el);
|
||||||
|
M.toast({html: 'Text kopiert: „' + text + '“'});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if ($('.action-share').length && !navigator.share && !$('.action-share').data('url')) {
|
if ($('.action-share').length && !navigator.share && !$('.action-share').data('url')) {
|
||||||
|
|
2
public/static/js/travelynx-actions.min.js
vendored
2
public/static/js/travelynx-actions.min.js
vendored
|
@ -1 +1 @@
|
||||||
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 a=$(this).data("dest");a&&(j_dest=a);var e=$(this).data("route");if(e){e=e.split("|"),j_stops=[];for(var n in e){for(var r=e[n].split(";"),o=1;o<5;o++)r[o]=parseInt(r[o]);j_stops.push(r)}}})}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 a=new Date(1e3*t),e=a.getHours(),n=a.getMinutes();return(e<10?"0"+e:e)+":"+(n<10?"0"+n:n)}function odelay(t,a){return t<a?" (+"+(a-t)/60+")":t==a?"":" ("+(a-t)/60+")"}function tvly_run(t,a,e){var n='<i class="material-icons">error</i>',r=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(r),$.post("/action",a,function(a){a.success?$(location).attr("href",a.redirect_to):(M.toast({html:n+" "+a.error}),r.remove(),e&&e(),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,a=0;if(j_duration>0){a=1-(j_arrival-t)/j_duration,a<0&&(a=0),a>1&&(a=1),$(".progress .determinate").css("width",100*a+"%");for(stop in j_stops){var e=j_stops[stop][0],n=j_stops[stop][1],r=j_stops[stop][2],o=j_stops[stop][3],i=j_stops[stop][4];if(e==j_dest){$(".next-stop").html("");break}if(0!=r&&r-t>0){$(".next-stop").html(e+"<br/>"+hhmm(r)+odelay(n,r));break}if(0!=i&&i-t>0){$(".next-stop").html(e+"<br/>"+hhmm(r)+" → "+hhmm(i)+odelay(o,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),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)}),$(".action-share").click(function(){navigator.share?(shareObj={text:$(this).data("text")},$(this).data("url")&&(shareObj.url=$(this).data("url")),navigator.share(shareObj)):$(this).data("url")&&(location.href=$(this).data("url"))}),!$(".action-share").length||navigator.share||$(".action-share").data("url")||$(".action-share").css("display","none")}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")})});
|
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");if(navigator.share)shareObj={text:t},$(this).data("url")&&(shareObj.url=$(this).data("url")),navigator.share(shareObj);else{var e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="absolute",e.style.left="-9999px",document.body.appendChild(e),e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(e),M.toast({html:"Text kopiert: „"+t+"“"})}}),!$(".action-share").length||navigator.share||$(".action-share").data("url")||$(".action-share").css("display","none")}$(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")})});
|
||||||
|
|
|
@ -3,27 +3,27 @@
|
||||||
"short_name": "Travelynx",
|
"short_name": "Travelynx",
|
||||||
"scope": "/",
|
"scope": "/",
|
||||||
"icons": [{
|
"icons": [{
|
||||||
"src": "/static/v28/icons/icon-128x128.png",
|
"src": "/static/v29/icons/icon-128x128.png",
|
||||||
"sizes": "128x128",
|
"sizes": "128x128",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}, {
|
}, {
|
||||||
"src": "/static/v28/icons/icon-144x144.png",
|
"src": "/static/v29/icons/icon-144x144.png",
|
||||||
"sizes": "144x144",
|
"sizes": "144x144",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}, {
|
}, {
|
||||||
"src": "/static/v28/icons/icon-152x152.png",
|
"src": "/static/v29/icons/icon-152x152.png",
|
||||||
"sizes": "152x152",
|
"sizes": "152x152",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}, {
|
}, {
|
||||||
"src": "/static/v28/icons/icon-192x192.png",
|
"src": "/static/v29/icons/icon-192x192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}, {
|
}, {
|
||||||
"src": "/static/v28/icons/icon-256x256.png",
|
"src": "/static/v29/icons/icon-256x256.png",
|
||||||
"sizes": "256x256",
|
"sizes": "256x256",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}, {
|
}, {
|
||||||
"src": "/static/v28/icons/icon-512x512.png",
|
"src": "/static/v29/icons/icon-512x512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}],
|
}],
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
% while (my ($key, $value) = each %{stash('twitter') // {}}) {
|
% while (my ($key, $value) = each %{stash('twitter') // {}}) {
|
||||||
<meta name="twitter:<%= $key %>" content="<%= $value %>">
|
<meta name="twitter:<%= $key %>" content="<%= $value %>">
|
||||||
% }
|
% }
|
||||||
% my $av = 'v28'; # asset version
|
% my $av = 'v29'; # asset version
|
||||||
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-16x16.png" sizes="16x16">
|
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-16x16.png" sizes="16x16">
|
||||||
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-32x32.png" sizes="32x32">
|
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-32x32.png" sizes="32x32">
|
||||||
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-96x96.png" sizes="96x96">
|
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-96x96.png" sizes="96x96">
|
||||||
|
|
Loading…
Reference in a new issue