Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a45af73c25 | ||
|
|
f30eac8aa5 | ||
|
|
99b624ff92 | ||
|
|
e74ffa9a70 | ||
|
|
cbb398988d | ||
|
|
856f6c1d66 | ||
|
|
2ea26408be | ||
|
|
fb1ca6d28e | ||
|
|
6a5d06325d | ||
|
|
72ac8df460 | ||
|
|
246231fd0e | ||
|
|
3e533f65fc | ||
|
|
2533c3d66a | ||
|
|
cacee5a54a | ||
|
|
274aa85cf7 | ||
|
|
4317e4fe87 | ||
|
|
b7dec825ca | ||
|
|
6ca6a79dc3 | ||
|
|
d1e5d753b4 | ||
|
|
7afacc3fff | ||
|
|
77ea57d643 | ||
|
|
a72c462483 | ||
|
|
b739e6cc4e | ||
|
|
eb47cdf016 | ||
|
|
12c1a614bb | ||
|
|
0fb1bb0462 |
20
.github/ISSUE_TEMPLATE/-de--feature-anfrage.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/-de--feature-anfrage.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "[DE] Feature-Anfrage"
|
||||||
|
about: Schlage eine Idee für dieses Projekt vor
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Bezieht sich Deine Feature-Anfrage auf ein Problem? Bitte beschreiben.**
|
||||||
|
Eine klare und präzise Beschreibung des Problems. Z.B. Ich bin immer frustriert, wenn [...]
|
||||||
|
|
||||||
|
**Beschreibe die gewünschte Lösung**
|
||||||
|
Eine klare und präzise Beschreibung dessen, was passieren soll.
|
||||||
|
|
||||||
|
**Beschreibe Alternativen, die Du in Betracht gezogen hast**
|
||||||
|
Eine klare und präzise Beschreibung aller alternativen Lösungen oder Funktionen, die Du in Betracht gezogen hast.
|
||||||
|
|
||||||
|
**Zusätzlicher Kontext**
|
||||||
|
Füge hier weitere Kontexte oder Screenshots zur Feature-Anfrage hinzu.
|
||||||
38
.github/ISSUE_TEMPLATE/-de--fehlerbericht.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/-de--fehlerbericht.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: "[DE] Fehlerbericht"
|
||||||
|
about: Erstelle einen Bericht, um uns zu helfen, die App zu verbessern
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Beschreibe den Fehler**
|
||||||
|
Eine klare und präzise Beschreibung des Fehlers.
|
||||||
|
|
||||||
|
**Reproduzierung**
|
||||||
|
Schritte zum Reproduzieren des Fehlers:
|
||||||
|
1. Gehe zu '...'
|
||||||
|
2. Klicke auf '....'
|
||||||
|
3. Scrolle nach unten zu '....'
|
||||||
|
4. Sieh den Fehler
|
||||||
|
|
||||||
|
**Erwartetes Verhalten**
|
||||||
|
Eine klare und präzise Beschreibung dessen, was Du erwartet hattest.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
Füge gegebenenfalls Screenshots hinzu, um Dein Problem zu erklären.
|
||||||
|
|
||||||
|
**Desktop (bitte verfolständige die folgenden Informationen):**
|
||||||
|
- Betriebssystem: [z.B. Windows 10]
|
||||||
|
- Browser [z.B. chrome, safari]
|
||||||
|
- Version [z.B. 2.14]
|
||||||
|
|
||||||
|
**Smartphone (bitte verfolständige die folgenden Informationen):**
|
||||||
|
- Gerät: [z.B. iPhone 6]
|
||||||
|
- Betriebssystem: [z.B. iOS 8.1]
|
||||||
|
- Browser [z.B. stock browser, safari]
|
||||||
|
- Version [z.B. 2.14]
|
||||||
|
|
||||||
|
**Zusätzlicher Kontext**
|
||||||
|
Füge hier einen anderen Kontext zum Problem hinzu.
|
||||||
38
.github/ISSUE_TEMPLATE/-en--bug-report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/-en--bug-report.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: "[EN] Bug report"
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. Windows 10]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 2.14]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone 6]
|
||||||
|
- OS: [e.g. iOS 8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 2.14]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
.github/ISSUE_TEMPLATE/-en--feature-request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/-en--feature-request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "[EN] Feature request"
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
11
README.md
Normal file
11
README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Regatten.net App
|
||||||
|
|
||||||
|
Willkommen im GitHub-Repository unserer neuen Regatten.net App.
|
||||||
|
|
||||||
|
Falls sich jemand dafür interessiert, ist hier der gesamte Quellcode unserer neuen App zu finden.
|
||||||
|
Bitte beachtet, dass diese App einschließlich dem gesamten Quellcode exklusivem Urheberrecht unterliegt. Sie darf also nicht kopiert, verteilt oder verändert werden.
|
||||||
|
Sollte Interesse an einer Anbindung an unser System bestehen, kontaktiere uns bitte einfach (https://regatten.net/contact)
|
||||||
|
|
||||||
|
Der Hauptzweck dieses Repository besteht jedoch darin, Feedback von Euch zu unserer neuen App zu bekommen.
|
||||||
|
Selbstverständlich könnt Ihr uns auch weiterhin auf anderen Kanälen erreichen, doch für Problem-Meldungen und Verbesserungsvorschläge ist GitHub am besten geeignet.
|
||||||
|
Wie Du Teil unseres BETA-Programmes wirst, die App installierst und Feedback gibst, erfährst Du in unserem [Wiki](https://github.com/ostertun/RegattenApp/wiki).
|
||||||
@@ -508,6 +508,9 @@ function sync() {
|
|||||||
$('#i-sync').removeClass('fa-spin');
|
$('#i-sync').removeClass('fa-spin');
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
if (typeof onAfterSync === 'function') {
|
||||||
|
onAfterSync();
|
||||||
|
}
|
||||||
runPageScript();
|
runPageScript();
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -1033,8 +1036,7 @@ function initDatabase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetDb(silent = true) {
|
function resetDb() {
|
||||||
$('#menu-developer').hideMenu();
|
|
||||||
if (canUseLocalDB) {
|
if (canUseLocalDB) {
|
||||||
showLoader();
|
showLoader();
|
||||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||||
@@ -1051,11 +1053,6 @@ function resetDb(silent = true) {
|
|||||||
osUpdateTimes.put({ table: 'news', time: 0 });
|
osUpdateTimes.put({ table: 'news', time: 0 });
|
||||||
osUpdateTimes.put({ table: 'users', time: 0 });
|
osUpdateTimes.put({ table: 'users', time: 0 });
|
||||||
console.log('DB update times reset');
|
console.log('DB update times reset');
|
||||||
if (!silent)
|
|
||||||
toastInfo('The database was reset. Please reload or close this tab.<br>At the next visit, a full sync will be performed.');
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
} else {
|
|
||||||
if (!silent)
|
|
||||||
toastWarn('Your device does not support storing data locally. All data is fetched directly from our server.<br>As a result, you can not reset your database.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1485
client/scripts/mobileconsole.js
Normal file
1485
client/scripts/mobileconsole.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -122,8 +122,8 @@ var login = function() {
|
|||||||
showLoader();
|
showLoader();
|
||||||
var username = $('#input-login-username').val();
|
var username = $('#input-login-username').val();
|
||||||
var password = $('#input-login-password').val();
|
var password = $('#input-login-password').val();
|
||||||
$('#input-login-username').val('');
|
$('#input-login-username').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-login-password').val('');
|
$('#input-login-password').val('').trigger('focusin').trigger('focusout');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: QUERY_URL + 'login',
|
url: QUERY_URL + 'login',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -135,7 +135,7 @@ var login = function() {
|
|||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
if (xhr.status == 401) {
|
if (xhr.status == 401) {
|
||||||
toastError('Benutzername oder Passwort falsch');
|
toastError('Benutzername oder Passwort falsch');
|
||||||
$('#input-login-username').val(username);
|
$('#input-login-username').val(username).trigger('focusin').trigger('focusout');
|
||||||
} else if (xhr.status == 0) {
|
} else if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
||||||
$('#menu-login').hideMenu();
|
$('#menu-login').hideMenu();
|
||||||
@@ -203,7 +203,28 @@ var logout = function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCache() {
|
function deleteDb() {
|
||||||
|
$('#menu-developer').hideMenu();
|
||||||
|
if (canUseLocalDB) {
|
||||||
|
showLoader();
|
||||||
|
var request = window.indexedDB.deleteDatabase('regatten_app_db_' + BOATCLASS);
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('Cannot delete DB: ', event.target.errorCode);
|
||||||
|
toastError('Beim Löschen der Datenbank ist ein Fehler aufgetreten.<br>Bitte melde diesen Fehler. (Dev-Menu => Problem melden)', 5000);
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
console.log('DB deleted');
|
||||||
|
toastInfo('Die Datenbank wurde gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit eine neue Datenbank.', 10000);
|
||||||
|
hideLoader();
|
||||||
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toastWarn('Dein Gerät unterstützt kein lokales Speichern der Daten. Alle Daten werden direkt vom Server gezogen.<br>Entsprechend kannst Du die Datenbank auch nicht zurücksetzen.', 10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteCache() {
|
||||||
$('#menu-developer').hideMenu();
|
$('#menu-developer').hideMenu();
|
||||||
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||||
for (let registration of registrations) {
|
for (let registration of registrations) {
|
||||||
@@ -217,7 +238,8 @@ function resetCache() {
|
|||||||
return caches.delete(key);
|
return caches.delete(key);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
toastInfo('The serviceWorker and the cache were deleted. A new serviceWorker will be generated on the next refresh.');
|
toastInfo('Der serviceWorker und alle Caches wurden gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit neue Caches.', 10000);
|
||||||
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pushesPossible = false;
|
var pushesPossible = false;
|
||||||
@@ -320,10 +342,16 @@ async function updatePushSwitches() {
|
|||||||
|
|
||||||
if ($('#switch-pushes').prop('checked')) {
|
if ($('#switch-pushes').prop('checked')) {
|
||||||
$('#p-pushes-info').show();
|
$('#p-pushes-info').show();
|
||||||
$('.a-switch-pushes-channel').show();
|
$('.a-switch-pushes-channel-all').show();
|
||||||
|
$('.a-switch-pushes-channel-my').show();
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
$('.a-switch-pushes-channel-my').find('div').remove();
|
||||||
|
$('.a-switch-pushes-channel-my').find('.badge').text('nicht angemeldet');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#p-pushes-info').hide();
|
$('#p-pushes-info').hide();
|
||||||
$('.a-switch-pushes-channel').hide();
|
$('.a-switch-pushes-channel-all').hide();
|
||||||
|
$('.a-switch-pushes-channel-my').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,6 +408,22 @@ function updatePushBadge() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateNewsBadge() {
|
||||||
|
var newsRead = await dbSettingsGet('news_read_' + BOATCLASS);
|
||||||
|
if (newsRead === null) dbSettingsSet('news_read_' + BOATCLASS, newsRead = new Date());
|
||||||
|
var news = await dbGetData('news');
|
||||||
|
var now = new Date();
|
||||||
|
var sum = 0;
|
||||||
|
for (var n in news) {
|
||||||
|
var newsEntry = news[n];
|
||||||
|
newsEntry.date = new Date(Date.parse(newsEntry.date));
|
||||||
|
if (newsEntry.date > now) continue;
|
||||||
|
if (newsEntry.date < newsRead) continue;
|
||||||
|
sum ++;
|
||||||
|
}
|
||||||
|
updateBadge('more/news', sum);
|
||||||
|
}
|
||||||
|
|
||||||
var initRegatten = function() {
|
var initRegatten = function() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
||||||
@@ -399,7 +443,8 @@ var initRegatten = function() {
|
|||||||
|
|
||||||
// Pushes
|
// Pushes
|
||||||
$('#a-switch-pushes').click(pushesSubscribeClicked);
|
$('#a-switch-pushes').click(pushesSubscribeClicked);
|
||||||
$('.a-switch-pushes-channel').click(pushesChannelClicked);
|
$('.a-switch-pushes-channel-all').click(pushesChannelClicked);
|
||||||
|
$('.a-switch-pushes-channel-my').click(pushesChannelClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
var onServiceWorkerLoaded = function() {
|
var onServiceWorkerLoaded = function() {
|
||||||
@@ -414,4 +459,32 @@ var onServiceWorkerLoaded = function() {
|
|||||||
var onDatabaseLoaded = function() {
|
var onDatabaseLoaded = function() {
|
||||||
onServiceWorkerLoaded();
|
onServiceWorkerLoaded();
|
||||||
initPushSettings();
|
initPushSettings();
|
||||||
|
|
||||||
|
updateNewsBadge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var onAfterSync = function() {
|
||||||
|
updateNewsBadge();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add console opener to preloader
|
||||||
|
var addConsoleOpenerToPreloader = function() {
|
||||||
|
addConsoleOpenerToPreloader = function(){};
|
||||||
|
var preloader = document.getElementById('preloader');
|
||||||
|
var button = document.createElement('a');
|
||||||
|
button.href = '#';
|
||||||
|
button.classList = 'btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight m-3';
|
||||||
|
button.style.position = 'fixed';
|
||||||
|
button.style.bottom = 0;
|
||||||
|
button.style.left = 0;
|
||||||
|
button.style.right = 0;
|
||||||
|
button.innerHTML = 'Show Console';
|
||||||
|
button.onclick = function(){
|
||||||
|
mobileConsole.displayConsole();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
setTimeout(function(){
|
||||||
|
preloader.appendChild(button);
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
addConsoleOpenerToPreloader();
|
||||||
|
|||||||
@@ -154,7 +154,7 @@
|
|||||||
(meine) bezieht sich auf die Regatten, die in Deiner Saison-Planung sind,<br>
|
(meine) bezieht sich auf die Regatten, die in Deiner Saison-Planung sind,<br>
|
||||||
(alle) informiert Dich über alle Regatten
|
(alle) informiert Dich über alle Regatten
|
||||||
</p>
|
</p>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-news" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-news" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-newspaper rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-newspaper rounded-s bg-highlight color-white"></i>
|
||||||
<span>Neuigkeiten</span>
|
<span>Neuigkeiten</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -162,15 +162,16 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-news"></label>
|
<label class="custom-control-label" for="switch-pushes-news"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-my" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-my" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
||||||
<span>Regatta verschoben (meine)</span>
|
<span>Regatta verschoben (meine)</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-regatta-changed-my">
|
<input type="checkbox" class="ios-input" id="switch-pushes-regatta-changed-my">
|
||||||
<label class="custom-control-label" for="switch-pushes-regatta-changed-my"></label>
|
<label class="custom-control-label" for="switch-pushes-regatta-changed-my"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-all" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-all" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
||||||
<span>Regatta verschoben (alle)</span>
|
<span>Regatta verschoben (alle)</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -178,15 +179,16 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-regatta-changed-all"></label>
|
<label class="custom-control-label" for="switch-pushes-regatta-changed-all"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-result-ready-my" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-result-ready-my" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
||||||
<span>Ergebnisse verfügbar (meine)</span>
|
<span>Ergebnisse verfügbar (meine)</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-result-ready-my">
|
<input type="checkbox" class="ios-input" id="switch-pushes-result-ready-my">
|
||||||
<label class="custom-control-label" for="switch-pushes-result-ready-my"></label>
|
<label class="custom-control-label" for="switch-pushes-result-ready-my"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-result-ready-all" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-result-ready-all" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
||||||
<span>Ergebnisse verfügbar (alle)</span>
|
<span>Ergebnisse verfügbar (alle)</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -194,9 +196,10 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-result-ready-all"></label>
|
<label class="custom-control-label" for="switch-pushes-result-ready-all"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-meldeschluss" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-meldeschluss" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-file-signature rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-file-signature rounded-s bg-highlight color-white"></i>
|
||||||
<span>Melde-Erinnerungen</span>
|
<span>Melde-Erinnerungen</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-meldeschluss">
|
<input type="checkbox" class="ios-input" id="switch-pushes-meldeschluss">
|
||||||
<label class="custom-control-label" for="switch-pushes-meldeschluss"></label>
|
<label class="custom-control-label" for="switch-pushes-meldeschluss"></label>
|
||||||
@@ -206,31 +209,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menu-developer" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="310">
|
<div id="menu-developer" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="360">
|
||||||
<div class="menu-title"><h1>Entwickler-Optionen</h1><p class="color-highlight">Version <?php echo PWA_VERSION; ?></p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
<div class="menu-title"><h1>Entwickler-Optionen</h1><p class="color-highlight">Version <?php echo PWA_VERSION; ?></p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
||||||
<div class="divider divider-margins mb-n2"></div>
|
<div class="divider divider-margins mb-n2"></div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="list-group list-custom-small">
|
<div class="list-group list-custom-small">
|
||||||
<a href="https://info.ostertun.net/regatten/beta">
|
<a href="https://github.com/ostertun/RegattenApp/wiki">
|
||||||
<i class="fa font-14 fa-info rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-info rounded-s bg-highlight color-white"></i>
|
||||||
<span>Infos zur BETA</span>
|
<span>App-Wiki</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="javascript:resetDb(false);">
|
<a href="javascript:deleteDb();">
|
||||||
<i class="fa font-14 fa-database rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-database rounded-s bg-highlight color-white"></i>
|
||||||
<span>Reset Database</span>
|
<span>Reset Database</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="javascript:resetCache();">
|
<a href="javascript:deleteCache();">
|
||||||
<i class="fa font-14 fa-trash-alt rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-trash-alt rounded-s bg-highlight color-white"></i>
|
||||||
<span>Reset Cache</span>
|
<span>Reset Cache</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://report.regatten.net/" class="border-0">
|
<a href="https://github.com/ostertun/RegattenApp/issues">
|
||||||
<i class="fa font-14 fa-bug rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-bug rounded-s bg-highlight color-white"></i>
|
||||||
<span>Problem melden</span>
|
<span>Problem melden</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="#" onclick="mobileConsole.displayConsole(); return false;" class="border-0 menu-close">
|
||||||
|
<i class="fa font-14 fa-terminal rounded-s bg-highlight color-white"></i>
|
||||||
|
<span>Console anzeigen</span>
|
||||||
|
<i class="fa fa-angle-right"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<html lang="de">
|
<html lang="de">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/mobileconsole.js"></script>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ function addRace() {
|
|||||||
rlp: (100 * rlf * ((fb + 1 - pl) / fb))
|
rlp: (100 * rlf * ((fb + 1 - pl) / fb))
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#input-rlf').val('');
|
$('#input-rlf').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-m').val('');
|
$('#input-m').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-fb').val('');
|
$('#input-fb').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-pl').val('');
|
$('#input-pl').val('').trigger('focusin').trigger('focusout');
|
||||||
|
|
||||||
races.push(race);
|
races.push(race);
|
||||||
reCalc();
|
reCalc();
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ function sendMessage() {
|
|||||||
},
|
},
|
||||||
success: function (data, status, xhr) {
|
success: function (data, status, xhr) {
|
||||||
toastOk('Nachricht erfolgreich versandt!');
|
toastOk('Nachricht erfolgreich versandt!');
|
||||||
$('#input-subject').val('');
|
$('#input-subject').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-message').val('');
|
$('#input-message').val('').trigger('focusin').trigger('focusout');
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -120,8 +120,10 @@ var siteScript = async function() {
|
|||||||
ms = parseDate(regatta['meldungSchluss']);
|
ms = parseDate(regatta['meldungSchluss']);
|
||||||
}
|
}
|
||||||
var diff = Math.round((ms - today) / 86400000);
|
var diff = Math.round((ms - today) / 86400000);
|
||||||
if ((ms >= today) && (diff < 7)) {
|
if (ms < today) {
|
||||||
color = ' color-red2-dark';
|
color = ' color-red2-dark';
|
||||||
|
} else if (diff < 7) {
|
||||||
|
color = ' color-yellow2-dark';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,8 +229,10 @@ var siteScript = async function() {
|
|||||||
ms = parseDate(regatta['meldungSchluss']);
|
ms = parseDate(regatta['meldungSchluss']);
|
||||||
}
|
}
|
||||||
var diff = Math.round((ms - today) / 86400000);
|
var diff = Math.round((ms - today) / 86400000);
|
||||||
if ((ms >= today) && (diff < 7)) {
|
if (ms < today) {
|
||||||
color = ' color-red2-dark';
|
color = ' color-red2-dark';
|
||||||
|
} else if (diff < 7) {
|
||||||
|
color = ' color-yellow2-dark';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ async function onNewsClicked(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addCard(newsEntry) {
|
function addCard(newsEntry) {
|
||||||
console.log(newsEntry);
|
|
||||||
var content = '<h2>' + newsEntry.title + '</h2>';
|
var content = '<h2>' + newsEntry.title + '</h2>';
|
||||||
content += '<p class="mb-2"><i>' + formatDate('d.m.Y', newsEntry.date) + '</i></p>';
|
content += '<p class="mb-2"><i>' + formatDate('d.m.Y', newsEntry.date) + '</i></p>';
|
||||||
content += '<p class="mb-0">' + newsEntry.description.replace('\n', '<br>') + '</p>';
|
content += '<p class="mb-0">' + newsEntry.description.replace('\n', '<br>') + '</p>';
|
||||||
@@ -29,16 +28,17 @@ var siteScript = async function() {
|
|||||||
news.sort(function (a,b) {
|
news.sort(function (a,b) {
|
||||||
return b.date.localeCompare(a.date);
|
return b.date.localeCompare(a.date);
|
||||||
});
|
});
|
||||||
var today = getToday();
|
var now = new Date();
|
||||||
var lastYear = new Date(today);
|
var lastYear = new Date();
|
||||||
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
||||||
console.log(today, lastYear);
|
|
||||||
for (var n in news) {
|
for (var n in news) {
|
||||||
var newsEntry = news[n];
|
var newsEntry = news[n];
|
||||||
newsEntry.date = parseDate(newsEntry.date.substring(0, 10));
|
newsEntry.date = new Date(Date.parse(newsEntry.date));
|
||||||
if (newsEntry.date > today) continue;
|
if (newsEntry.date > now) continue;
|
||||||
if (newsEntry.date < lastYear) break;
|
if (newsEntry.date < lastYear) break;
|
||||||
addCard(newsEntry);
|
addCard(newsEntry);
|
||||||
}
|
}
|
||||||
|
dbSettingsSet('news_read_' + BOATCLASS, now);
|
||||||
|
updateNewsBadge();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
@@ -111,8 +111,8 @@ async function selectChange(callSiteScript = true) {
|
|||||||
var year = parseInt($('#select-year').val());
|
var year = parseInt($('#select-year').val());
|
||||||
if (type == "user") {
|
if (type == "user") {
|
||||||
$('#select-year').parent().hide();
|
$('#select-year').parent().hide();
|
||||||
$('#input-from').parent().show();
|
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-to').parent().show();
|
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-jugend').parent().parent().show();
|
$('#input-jugend').parent().parent().show();
|
||||||
$('#input-jugstrict').parent().parent().show();
|
$('#input-jugstrict').parent().parent().show();
|
||||||
$('#button-show').show();
|
$('#button-show').show();
|
||||||
@@ -174,7 +174,19 @@ async function selectChange(callSiteScript = true) {
|
|||||||
$('#input-jugend').prop('checked', jugend);
|
$('#input-jugend').prop('checked', jugend);
|
||||||
$('#input-jugstrict').prop('checked', jugstrict);
|
$('#input-jugstrict').prop('checked', jugstrict);
|
||||||
|
|
||||||
if (callSiteScript && (typeof siteScript === 'function'))
|
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||||
|
history.replaceState(null, '', '?type=' + type + '&year=' + year)
|
||||||
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonShowPressed() {
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
var chboxes = '';
|
||||||
|
if ($('#input-jugend').prop('checked')) chboxes += '&jugend=on'
|
||||||
|
if ($('#input-jugstrict').prop('checked')) chboxes += '&jugstrict=on'
|
||||||
|
history.replaceState(null, '', '?type=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val() + chboxes)
|
||||||
siteScript();
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,6 +202,19 @@ function initSelects() {
|
|||||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
$('#select-year').val(year);
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
if (type == "user") {
|
||||||
|
var from = findGetParameter('from');
|
||||||
|
var to = findGetParameter('to');
|
||||||
|
if (from === null) from = formatDate('Y-m-d')
|
||||||
|
if (to === null) to = formatDate('Y-m-d')
|
||||||
|
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
||||||
|
var jugend = findGetParameter('jugend');
|
||||||
|
var jugstrict = findGetParameter('jugstrict');
|
||||||
|
$('#input-jugend').prop('checked', jugend !== null);
|
||||||
|
$('#input-jugstrict').prop('checked', jugstrict !== null);
|
||||||
|
}
|
||||||
|
|
||||||
selectChange(false);
|
selectChange(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +243,7 @@ var siteScript = async function() {
|
|||||||
initSelects();
|
initSelects();
|
||||||
$('#select-type').change(selectChange);
|
$('#select-type').change(selectChange);
|
||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
$('#button-show').click(siteScript);
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
function selectChange(callSiteScript = true) {
|
function selectChange(callSiteScript = true) {
|
||||||
var val = $('#select-year').val();
|
var val = $('#select-year').val();
|
||||||
if (val == "user") {
|
if (val == "user") {
|
||||||
$('#input-from').parent().show();
|
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-to').parent().show();
|
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#button-show').show();
|
$('#button-show').show();
|
||||||
} else {
|
} else {
|
||||||
$('#input-from').parent().hide();
|
$('#input-from').parent().hide();
|
||||||
@@ -12,7 +12,16 @@ function selectChange(callSiteScript = true) {
|
|||||||
$('#input-from').val(val + '-01-01');
|
$('#input-from').val(val + '-01-01');
|
||||||
$('#input-to').val(val + '-12-31');
|
$('#input-to').val(val + '-12-31');
|
||||||
|
|
||||||
if (callSiteScript && (typeof siteScript === 'function'))
|
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||||
|
history.replaceState(null, '', '?year=' + val);
|
||||||
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonShowPressed() {
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
history.replaceState(null, '', '?year=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val())
|
||||||
siteScript();
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,6 +33,15 @@ function initYear() {
|
|||||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
$('#select-year').val(year);
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
if (year == "user") {
|
||||||
|
var from = findGetParameter('from');
|
||||||
|
var to = findGetParameter('to');
|
||||||
|
if (from === null) from = formatDate('Y-m-d')
|
||||||
|
if (to === null) to = formatDate('Y-m-d')
|
||||||
|
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
||||||
|
}
|
||||||
|
|
||||||
selectChange(false);
|
selectChange(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +68,7 @@ var siteScript = async function() {
|
|||||||
firstCall = false;
|
firstCall = false;
|
||||||
initYear();
|
initYear();
|
||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
$('#button-show').click(siteScript);
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,8 +178,10 @@ var siteScript = async function() {
|
|||||||
ms = parseDate(entry['meldungSchluss']);
|
ms = parseDate(entry['meldungSchluss']);
|
||||||
}
|
}
|
||||||
var diff = Math.round((ms - today) / 86400000);
|
var diff = Math.round((ms - today) / 86400000);
|
||||||
if ((ms >= today) && (diff < 7)) {
|
if (ms < today) {
|
||||||
color = ' color-red2-dark';
|
color = ' color-red2-dark';
|
||||||
|
} else if (diff < 7) {
|
||||||
|
color = ' color-yellow2-dark';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.6');
|
define('PWA_VERSION', '1.8');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -56,15 +56,19 @@ workbox.precaching.precacheAndRoute([
|
|||||||
'/manifest.json.php',
|
'/manifest.json.php',
|
||||||
];
|
];
|
||||||
$dirsToCache = [
|
$dirsToCache = [
|
||||||
'/client',
|
'/client/app',
|
||||||
|
'/client/fonts/css',
|
||||||
|
'/client/fonts/webfonts',
|
||||||
|
'/client/images',
|
||||||
|
'/client/scripts',
|
||||||
|
'/client/styles',
|
||||||
];
|
];
|
||||||
|
|
||||||
function addDir($path) {
|
function addDir($path) {
|
||||||
global $filesToCache;
|
global $filesToCache;
|
||||||
if ($dir = opendir(__DIR__ . $path)) {
|
if ($dir = opendir(__DIR__ . $path)) {
|
||||||
while (($file = readdir($dir)) !== false) {
|
while (($file = readdir($dir)) !== false) {
|
||||||
if ($file == '.') continue;
|
if (substr($file, 0, 1) == '.') continue;
|
||||||
if ($file == '..') continue;
|
|
||||||
if (is_dir(__DIR__ . $path . '/' . $file)) {
|
if (is_dir(__DIR__ . $path . '/' . $file)) {
|
||||||
addDir($path . '/' . $file);
|
addDir($path . '/' . $file);
|
||||||
} else {
|
} else {
|
||||||
@@ -109,30 +113,41 @@ workbox.routing.registerRoute(
|
|||||||
|
|
||||||
// DB
|
// DB
|
||||||
|
|
||||||
var db = null;
|
function openDb() {
|
||||||
if (indexedDB) {
|
return new Promise(function(resolve) {
|
||||||
|
if (indexedDB) {
|
||||||
var request = indexedDB.open('regatten_app_db_<?php echo BOATCLASS; ?>');
|
var request = indexedDB.open('regatten_app_db_<?php echo BOATCLASS; ?>');
|
||||||
request.onerror = function (e) {
|
request.onerror = function (e) {
|
||||||
console.log('[sW] Cannot open DB:', e.target.errorCode);
|
console.log('[sW] Cannot open DB:', e.targer.errorCode);
|
||||||
|
resolve(null);
|
||||||
};
|
};
|
||||||
request.onupgradeneeded = function (e) {
|
request.onupgradeneeded = function (e) {
|
||||||
console.log('[sW] DB does not exist');
|
console.log('[sW] DB does not exist');
|
||||||
e.target.transaction.abort();
|
e.target.transaction.abort();
|
||||||
|
resolve(null);
|
||||||
};
|
};
|
||||||
request.onsuccess = function (e) {
|
request.onsuccess = function (e) {
|
||||||
console.log('[sW] DB loaded');
|
console.log('[sW] DB loaded');
|
||||||
db = e.target.result;
|
var db = e.target.result;
|
||||||
db.onerror = function (e) {
|
db.onerror = function (e) {
|
||||||
console.log('[sW] DB Error:', e)
|
console.log('[sW] DB Error:', e);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
resolve(db);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbSettingsGet(key) {
|
function dbSettingsGet(key) {
|
||||||
return new Promise(function(resolve) {
|
return new Promise(async function(resolve) {
|
||||||
if (db != null) {
|
var db = await openDb();
|
||||||
|
if (db !== null) {
|
||||||
var request = db.transaction('settings').objectStore('settings').get(key);
|
var request = db.transaction('settings').objectStore('settings').get(key);
|
||||||
request.onsuccess = function (event) {
|
request.onsuccess = function (event) {
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
resolve(typeof request.result != 'undefined' ? request.result.value : null);
|
resolve(typeof request.result != 'undefined' ? request.result.value : null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -141,10 +156,20 @@ function dbSettingsGet(key) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbSettingsSet(key, value) {
|
async function dbSettingsSet(key, value) {
|
||||||
|
var db = await openDb();
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
var os = db.transaction('settings', 'readwrite').objectStore('settings');
|
var os = db.transaction('settings', 'readwrite').objectStore('settings');
|
||||||
os.put({ key: key, value: value});
|
var request = os.put({ key: key, value: value});
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('[sW] Error while saving data to DB:', e);
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +244,7 @@ self.addEventListener('push', async function(event) {
|
|||||||
data: data,
|
data: data,
|
||||||
body: data.body,
|
body: data.body,
|
||||||
icon: getEntry(data, 'icon', '<?php echo SERVER_ADDR; ?>/client/app/icons/icon-512x512.png'),
|
icon: getEntry(data, 'icon', '<?php echo SERVER_ADDR; ?>/client/app/icons/icon-512x512.png'),
|
||||||
badge: '<?php echo SERVER_ADDR; ?>/client/app/icons/icon-96x96.png',
|
badge: '<?php echo SERVER_ADDR; ?>/client/app/icons/badge-128x128.png',
|
||||||
vibrate: [500,100,500]
|
vibrate: [500,100,500]
|
||||||
};
|
};
|
||||||
if ((image = getEntry(data, 'image', null)) !== null) {
|
if ((image = getEntry(data, 'image', null)) !== null) {
|
||||||
@@ -227,13 +252,50 @@ self.addEventListener('push', async function(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Force refresh on next app open
|
// Force refresh on next app open
|
||||||
|
var db = await openDb();
|
||||||
|
if (db != null) {
|
||||||
var os = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
var os = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||||
os.put({ table: 'last_sync', time: 0 });
|
var request = os.put({ table: 'last_sync', time: 0 });
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('[sW] Error while saving data to DB:', e);
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Showing notification');
|
console.log('Showing notification');
|
||||||
self.registration.showNotification(data.title, options);
|
self.registration.showNotification(data.title, options);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'forcesync':
|
||||||
|
// Force refresh on next app open
|
||||||
|
var db = await openDb();
|
||||||
|
if (db != null) {
|
||||||
|
var os = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||||
|
var request = os.put({ table: 'last_sync', time: 0 });
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('[sW] Error while saving data to DB:', e);
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
}
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
console.log('[sW] Data successfully saved');
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
console.log('[sW] Push type unknown:', data.type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('[sW] No push type given!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user