From 062a7336aca260cd564dcb676f3e9d4159d13a9b Mon Sep 17 00:00:00 2001 From: Timon Ostertun Date: Wed, 23 Sep 2020 22:53:33 +0200 Subject: [PATCH] Fix: wrong revision on content files / Blinking Icon in regattas list --- client/scripts/custom.js.php | 1 - client/scripts/pwa.js.php | 4 ++-- client/styles/regatten.css | 17 ++++++++++++++++ manifest.json.php | 2 +- server/scripts/regattas.js | 38 ++++++++++++++++++++++++------------ service-worker.js.php | 23 +++++++++++++++++++--- 6 files changed, 66 insertions(+), 19 deletions(-) diff --git a/client/scripts/custom.js.php b/client/scripts/custom.js.php index d88da26..7d5724f 100644 --- a/client/scripts/custom.js.php +++ b/client/scripts/custom.js.php @@ -1331,7 +1331,6 @@ $(document).ready(function(){ colorsArray.forEach(function (gradientBodyValue) {$('.generated-styles').append('.body-'+gradientBodyValue[0]+'{background-image: linear-gradient(to bottom, '+gradientBodyValue[1]+' 0, '+gradientBodyValue[3]+' 100%)}')}); } - // TODO: Hier den site-specific code ausführen initRegatten(); hideLoader(); diff --git a/client/scripts/pwa.js.php b/client/scripts/pwa.js.php index 2085c28..cf26e76 100644 --- a/client/scripts/pwa.js.php +++ b/client/scripts/pwa.js.php @@ -74,9 +74,9 @@ $(document).ready(function(){ deferredPrompt.userChoice .then((choiceResult) => { if (choiceResult.outcome === 'accepted') { - //console.log('User accepted the A2HS prompt'); + console.log('User accepted the A2HS prompt'); } else { - //console.log('User dismissed the A2HS prompt'); + console.log('User dismissed the A2HS prompt'); } deferredPrompt = null; }); diff --git a/client/styles/regatten.css b/client/styles/regatten.css index b98181a..44cee2f 100644 --- a/client/styles/regatten.css +++ b/client/styles/regatten.css @@ -1,3 +1,4 @@ +/*** REGATTAS LIST ***/ .regattas-list > div { padding-top: 1rem; padding-bottom: 1rem; @@ -40,4 +41,20 @@ .regattas-list > div > div:nth-child(3) > div:nth-child(2) { width: 25%; text-align: right; +} + +/*** BLINKING ICONS ***/ +@keyframes fa-blink { + 0% { opacity: 1; } + 25% { opacity: 0.25; } + 50% { opacity: 0.5; } + 75% { opacity: 0.75; } + 100% { opacity: 0; } +} +.fa-blink { + -webkit-animation: fa-blink .75s linear infinite; + -moz-animation: fa-blink .75s linear infinite; + -ms-animation: fa-blink .75s linear infinite; + -o-animation: fa-blink .75s linear infinite; + animation: fa-blink .75s linear infinite; } \ No newline at end of file diff --git a/manifest.json.php b/manifest.json.php index aaad555..ad6e50a 100644 --- a/manifest.json.php +++ b/manifest.json.php @@ -6,7 +6,7 @@ ?> { - "version": "1.0", + "version": "", "lang" : "de", "name" : "Regatten.net ", "scope" : "/", diff --git a/server/scripts/regattas.js b/server/scripts/regattas.js index 48b4e58..4f09ff7 100644 --- a/server/scripts/regattas.js +++ b/server/scripts/regattas.js @@ -32,29 +32,21 @@ var rows = []; var today; async function drawTable () { - //setLoading(true, 'loading'); - window.setTimeout(function () { var list = ''; rows.forEach(function (entry) { if (entry == null) { list += '
Heute ist der ' + formatDate('d.m.Y', today) + '
'; - //tbody += ''; - //tbody += 'Heute ist der ' + formatDate('d.m.Y', today); - //tbody += ''; } else if (search($('#input-search').val(), entry.keywords)) { list += entry.content; } }); $('#div-regattas').html(list); - - //setLoading(false, 'loading'); }, 0); } async function regattaClicked(id) { var regatta = await dbGetData('regattas', id); - console.log(regatta); $('#menu-regatta').find('.menu-title').find('p').text(regatta.name); @@ -277,10 +269,32 @@ var siteScript = async function() { if ((entry['meldung'] != '') && (dateTo >= today) && (entry['meldungOffen'] == '1')) { var color = ''; if (entry['meldungSchluss'] != null) { - var ms = parseDate(entry['meldungSchluss']); - var diff = Math.round((ms - today) / 86400000); - if ((ms >= today) && (diff < 7)) - color = ' color-red2-dark'; + var planning = null; + if (isLoggedIn()) { + var plannings = await dbGetDataIndex('plannings', 'regatta', entry['id']); + for (id in plannings) { + if (plannings[id]['user'] == USER_ID) { + planning = plannings[id]; + break; + } + } + } + if ((planning == null) || (planning['gemeldet'] == '0')) { + var ms = 0; + if (entry['meldungEarly'] != null) { + ms = parseDate(entry['meldungEarly']); + } + if (ms < today) { + ms = parseDate(entry['meldungSchluss']); + } + var diff = Math.round((ms - today) / 86400000); + if ((ms >= today) && (diff < 7)) { + color = ' color-red2-dark'; + if (planning != null) { + color += ' fa-blink'; + } + } + } } icons.push(''); } diff --git a/service-worker.js.php b/service-worker.js.php index 3ee05b3..56ed0a3 100644 --- a/service-worker.js.php +++ b/service-worker.js.php @@ -24,13 +24,30 @@ workbox.core.setCacheNameDetails({ workbox.precaching.precacheAndRoute([