From 35e9dae3499a4234836a2f858797e7b05f5d12c6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 14 Nov 2019 18:23:21 +0100 Subject: include URL in copied share text if enabled --- public/service-worker.js | 26 +++++++++++++------------- public/static/css/material-icons.css | 8 ++++---- public/static/js/travelynx-actions.js | 11 ++++++----- public/static/js/travelynx-actions.min.js | 2 +- public/static/manifest.json | 12 ++++++------ public/static/v28 | 1 - public/static/v30 | 1 + 7 files changed, 31 insertions(+), 30 deletions(-) delete mode 120000 public/static/v28 create mode 120000 public/static/v30 (limited to 'public') diff --git a/public/service-worker.js b/public/service-worker.js index 8dfaa8b..4832988 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,19 +1,19 @@ -const CACHE_NAME = 'static-cache-v29'; +const CACHE_NAME = 'static-cache-v30'; const FILES_TO_CACHE = [ '/favicon.ico', '/offline.html', - '/static/v29/css/light.min.css', - '/static/v29/css/dark.min.css', - '/static/v29/css/material-icons.css', - '/static/v29/css/local.css', - '/static/v29/fonts/MaterialIcons-Regular.woff2', - '/static/v29/fonts/MaterialIcons-Regular.woff', - '/static/v29/fonts/MaterialIcons-Regular.ttf', - '/static/v29/js/jquery-3.4.1.min.js', - '/static/v29/js/materialize.min.js', - '/static/v29/js/travelynx-actions.min.js', - '/static/v29/js/autocomplete.min.js', - '/static/v29/js/geolocation.min.js', + '/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', ]; self.addEventListener('install', (evt) => { diff --git a/public/static/css/material-icons.css b/public/static/css/material-icons.css index cb51353..04b8309 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/v29/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ + src: url(/static/v30/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ src: local('Material Icons'), local('MaterialIcons-Regular'), - url(/static/v29/fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(/static/v29/fonts/MaterialIcons-Regular.woff) format('woff'), - url(/static/v29/fonts/MaterialIcons-Regular.ttf) format('truetype'); + 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'); } .material-icons { diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index d6ceb87..7f60df6 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -203,16 +203,20 @@ function tvly_reg_handlers() { }); $('.action-share').click(function() { var text = $(this).data('text'); + var url = $(this).data('url'); if (navigator.share) { shareObj = { text: text }; - if ($(this).data('url')) { - shareObj['url'] = $(this).data('url'); + if (url) { + shareObj['url'] = url; } navigator.share(shareObj); } else { var el = document.createElement('textarea'); + if (url) { + text += ' ' + url; + } el.value = text; el.setAttribute('readonly', ''); el.style.position = 'absolute'; @@ -225,9 +229,6 @@ function tvly_reg_handlers() { M.toast({html: 'Text kopiert: „' + text + '“'}); } }); - if ($('.action-share').length && !navigator.share && !$('.action-share').data('url')) { - $('.action-share').css('display', 'none'); - } } $(document).ready(function() { tvly_reg_handlers(); diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js index c955a06..14bdb21 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
');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"+hhmm(o)+odelay(n,o));break}if(0!=i&&0"+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")})}); +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
');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"+hhmm(o)+odelay(n,o));break}if(0!=i&&0"+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")})}); diff --git a/public/static/manifest.json b/public/static/manifest.json index d3bdd2e..f18ba61 100644 --- a/public/static/manifest.json +++ b/public/static/manifest.json @@ -3,27 +3,27 @@ "short_name": "Travelynx", "scope": "/", "icons": [{ - "src": "/static/v29/icons/icon-128x128.png", + "src": "/static/v30/icons/icon-128x128.png", "sizes": "128x128", "type": "image/png" }, { - "src": "/static/v29/icons/icon-144x144.png", + "src": "/static/v30/icons/icon-144x144.png", "sizes": "144x144", "type": "image/png" }, { - "src": "/static/v29/icons/icon-152x152.png", + "src": "/static/v30/icons/icon-152x152.png", "sizes": "152x152", "type": "image/png" }, { - "src": "/static/v29/icons/icon-192x192.png", + "src": "/static/v30/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png" }, { - "src": "/static/v29/icons/icon-256x256.png", + "src": "/static/v30/icons/icon-256x256.png", "sizes": "256x256", "type": "image/png" }, { - "src": "/static/v29/icons/icon-512x512.png", + "src": "/static/v30/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" }], diff --git a/public/static/v28 b/public/static/v28 deleted file mode 120000 index 945c9b4..0000000 --- a/public/static/v28 +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/public/static/v30 b/public/static/v30 new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/public/static/v30 @@ -0,0 +1 @@ +. \ No newline at end of file -- cgit v1.2.3