Compare commits

...

14 Commits

Author SHA1 Message Date
ostertun
d38de287dd Merge branch 'hotfix/ios_problems' 2020-10-21 16:27:02 +02:00
ostertun
da2beac8d3 hotfix 2020-10-21 16:26:40 +02:00
ostertun
92a11bcfa5 gitflow-hotfix-stash: ios_problems 2020-10-21 16:26:02 +02:00
ostertun
fa4770e12a Merge branch 'hotfix/remote_logout' 2020-10-16 13:01:24 +02:00
ostertun
a6f2568753 gitflow-hotfix-stash: remote_logout 2020-10-16 13:01:06 +02:00
ostertun
6d0fdea0e8 Merge branch 'hotfix/add_planning_list_button' 2020-10-16 10:19:20 +02:00
ostertun
1252c02d7c gitflow-hotfix-stash: add_planning_list_button 2020-10-16 10:19:05 +02:00
ostertun
f617fa7923 Merge branch 'release/v_1.11' 2020-10-15 19:41:34 +02:00
ostertun
c66dc96598 Release v_1.11 2020-10-15 19:40:57 +02:00
ostertun
f5d059202e RA-#9 Signup 2020-10-15 19:39:47 +02:00
ostertun
5962e1cc90 RA-#29 Follow Sailors 2020-10-15 19:02:25 +02:00
ostertun
9f3019b4c5 Notification info banner 2020-10-15 15:19:04 +02:00
ostertun
4228ec739d Merge branch 'hotfix/fix_inputs_forcesync' into develop 2020-10-15 14:04:06 +02:00
ostertun
6b1e35cc14 Merge branch 'release/v_1.10.5' into develop 2020-10-14 14:18:03 +02:00
12 changed files with 309 additions and 70 deletions

View File

@@ -910,7 +910,12 @@ function sync() {
} }
} else { } else {
log("[db] Something went wrong (HTTP " + code + ")"); if (code == 401) {
log("[db] Auth invalid. Logout initiated");
logoutClearStorage();
} else {
log("[db] Something went wrong (HTTP " + code + ")");
}
syncOkay = false; syncOkay = false;
syncInProgress = 0; syncInProgress = 0;
} }

View File

@@ -38,6 +38,16 @@ function parseDate(string) {
return date; return date;
} }
function parseDbTimestamp(string) {
var year = string.substr(0, 4);
var month = string.substr(5, 2);
var day = string.substr(8, 2);
var hour = string.substr(11, 2);
var minute = string.substr(14, 2);
var second = string.substr(17, 2);
return new Date(year, month - 1, day, hour, minute, second);
}
function getToday() { function getToday() {
var date = new Date(); var date = new Date();
date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));

View File

@@ -95,19 +95,19 @@ $(document).ready(function(){
log('[pwa] iOS Detected'); log('[pwa] iOS Detected');
if($('#menu-install-pwa-ios, .add-to-home').length){ if($('#menu-install-pwa-ios, .add-to-home').length){
if (!readCookie('Sticky_pwa_rejected_install')) { if (!readCookie('Sticky_pwa_rejected_install')) {
function triggerPwaInstallIos() { setTimeout(function(){
log('[pwa] Triggering PWA / Add to Home Screen Menu for iOS'); function triggerPwaInstallIos() {
setTimeout(function(){ log('[pwa] Triggering PWA / Add to Home Screen Menu for iOS');
$('.add-to-home').addClass('add-to-home-visible add-to-home-ios'); $('.add-to-home').addClass('add-to-home-visible add-to-home-ios');
$('#menu-install-pwa-ios, .menu-hider').addClass('menu-active'); $('#menu-install-pwa-ios, .menu-hider').addClass('menu-active');
},3000); }
} var welcomActive = $('#menu-welcome').hasClass('menu-active');
var welcomActive = $('#menu-welcome').hasClass('menu-active'); if (welcomActive) {
if (welcomActive) { $('#menu-welcome-a-okay').click(triggerPwaInstallIos);
$('#menu-welcome-a-okay').click(triggerPwaInstallIos); } else {
} else { triggerPwaInstallIos();
triggerPwaInstallIos(); }
} },3000);
}; };
} }
} }

View File

@@ -131,6 +131,47 @@ function findGetParameter(parameterName) {
return result; return result;
} }
var signup = function() {
var username = $('#input-signup-username').val();
var email = $('#input-signup-email').val();
var password = $('#input-signup-password').val();
if (username == '') { $('#input-signup-username').focus(); return; }
if (email == '') { $('#input-signup-email').focus(); return; }
if (password == '') { $('#input-signup-password').focus(); return; }
showLoader();
$('#input-signup-username').val('').trigger('focusin').trigger('focusout');
$('#input-signup-email').val('').trigger('focusin').trigger('focusout');
$('#input-signup-password').val('').trigger('focusin').trigger('focusout');
$.ajax({
url: QUERY_URL + 'signup',
method: 'POST',
data: {
username: username,
email: email,
password: password
},
error: function (xhr, status, error) {
if (xhr.status == 409) {
toastError('Benutzername bereits vergeben');
$('#input-signup-email').val(email).trigger('focusin').trigger('focusout');
} else if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
$('#menu-signup').hideMenu();
} else {
log('[app] Signup: unbekannter Fehler', status, error);
log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
}
hideLoader();
},
success: function (data, status, xhr) {
$('#input-login-username').val(username);
$('#input-login-password').val(password);
login();
}
});
}
var login = function() { var login = function() {
showLoader(); showLoader();
var username = $('#input-login-username').val(); var username = $('#input-login-username').val();
@@ -406,6 +447,7 @@ function pushesOpenMenu() {
} }
function updatePushBadge() { function updatePushBadge() {
if (typeof onUpdatePushBadge === 'function') onUpdatePushBadge();
if (!pushesPossible) return; if (!pushesPossible) return;
if (Notification.permission == 'denied') { if (Notification.permission == 'denied') {
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('BLOCKED'); $('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('BLOCKED');
@@ -429,7 +471,7 @@ async function updateNewsBadge() {
var sum = 0; var sum = 0;
for (var n in news) { for (var n in news) {
var newsEntry = news[n]; var newsEntry = news[n];
newsEntry.date = new Date(Date.parse(newsEntry.date)); newsEntry.date = parseDbTimestamp(newsEntry.date);
if (newsEntry.date > now) continue; if (newsEntry.date > now) continue;
if (newsEntry.date < newsRead) continue; if (newsEntry.date < newsRead) continue;
sum ++; sum ++;
@@ -466,7 +508,7 @@ var initRegatten = function() {
var onServiceWorkerLoaded = function() { var onServiceWorkerLoaded = function() {
log('[app] sW loaded'); log('[app] sW loaded');
if ((swRegistration !== null) && canUseLocalDB) { if ((swRegistration !== null) && (swRegistration.pushManager) && canUseLocalDB) {
pushesPossible = true; pushesPossible = true;
updatePushBadge(); updatePushBadge();
} else { } else {

View File

@@ -1,61 +1,72 @@
<?php <?php
$sp['title'] = 'Startseite - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Startseite - Regatten.net ' . $_CLASS['name'];
$sp['activenav'] = 1; $sp['activenav'] = 1;
// Title // Title
$content = "<h1>$_CLASS[name]</h1>"; $content = "<h1>$_CLASS[name]</h1>";
$content .= "<p>$_CLASS[desc]</p>"; $content .= "<p>$_CLASS[desc]</p>";
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);
// Favorites // Favorites
$content = '<h2>Deine Favoriten</h2>'; $content = '<h2>Deine Favoriten</h2>';
$thead = '<tr><th>Segler</th><th id="th-ranking">Rangliste</th></tr>'; $content .= '<div id="div-favorites" class="normal-list mb-0"></div>';
$content .= $tpl->load('table', [$thead, 'html-id' => 'table-favorites', 'css-class' => 'mb-0 mt-3']);
$content .= '<p id="p-favorites" class="mt-3">'; $content .= '<p id="p-favorites" class="mt-3">';
$content .= 'Du folgst <b>keinen</b> Seglern.<br>'; $content .= 'Du folgst <b>keinen</b> Seglern.<br>';
$content .= 'Um jemandem zu folgen, gehe zur <a href="' . LINK_PRE . 'sailors">Segler-Liste</a> und w&auml;hle bis zu f&uuml;nf Segler aus.'; $content .= 'Um jemandem zu folgen, gehe zur <a href="' . LINK_PRE . 'sailors">Segler-Liste</a> und w&auml;hle bis zu f&uuml;nf Segler aus.';
$content .= '</p>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-favorites']); $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-favorites']);
// Planning next // Planning next
$content = '<h2>Deine n&auml;chsten Regatten</h2>'; $content = '<h2>Deine n&auml;chsten Regatten</h2>';
$content .= '<div id="div-yournext" class="regattas-list mb-0"></div>'; $content .= '<div id="div-yournext" class="regattas-list mb-0"></div>';
$content .= '<p id="p-yournext" class="mt-3">'; $content .= '<p id="p-yournext" class="mt-3">';
$content .= 'Du f&auml;hrst in den n&auml;chsten vier Wochen auf keine Regatta!'; $content .= 'Du f&auml;hrst in den n&auml;chsten vier Wochen auf keine Regatta!';
$content .= '</p>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-yournext']); $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-yournext']);
// Not logged in // Not logged in
$content = '<h2>Nicht angemeldet</h2>'; $content = '<h2>Nicht angemeldet</h2>';
$content .= '<p class="mt-3">'; $content .= '<p class="mt-3">';
$content .= 'Um alle Funktionen dieser Seite nutzen zu k&ouml;nnen, <a href="#" data-menu="menu-login">logge Dich bitte ein</a>.<br>'; $content .= 'Um alle Funktionen dieser Seite nutzen zu k&ouml;nnen, <a href="#" data-menu="menu-login">logge Dich bitte ein</a>.<br>';
$content .= 'Solltest Du noch kein Benutzerkonto haben, kannst Du Dich kostenlos <a href="#" data-menu="menu-signup">registrieren</a>.'; $content .= 'Solltest Du noch kein Benutzerkonto haben, kannst Du Dich kostenlos <a href="#" data-menu="menu-signup">registrieren</a>.';
$content .= '</p>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notloggedin']); $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notloggedin']);
// Notification Info
$content = '<h2 class="color-white">Push-Benachrichtigungen</h2>';
$content .= '<p class="mt-3 mb-3 color-white">';
$content .= '<b>Bleibe immer auf dem Laufendem!</b><br>';
$content .= 'Aktiviere einfach unsere Push-Benachrichtigungen und wir informieren Dich &uuml;ber alle &Auml;nderungen.<br>';
$content .= 'Du bestimmst nat&uuml;rlich, welche Benachrichtigungen Du bekommen m&ouml;chtest.';
$content .= '</p>';
$content .= $tpl->load('button', ['Jetzt aktivieren', '#', 'html-id' => 'button-notifications-activate', 'css-class' => 'bg-green2-dark']);
$content .= '<p class="text-center mt-3"><a id="a-notifications-later" class="color-grey2-light text-uppercase font-900">Vielleicht sp&auml;ter</a></p>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notifications', 'css-class' => 'bg-blue2-dark']);
// Next // Next
$content = '<h2>N&auml;chste Regatten</h2>'; $content = '<h2>N&auml;chste Regatten</h2>';
$content .= '<div id="div-next" class="regattas-list mb-0"></div>'; $content .= '<div id="div-next" class="regattas-list mb-0"></div>';
$content .= '<p id="p-next" class="mt-3">'; $content .= '<p id="p-next" class="mt-3">';
$content .= 'Keine Regatten in den n&auml;chsten zwei Wochen!'; $content .= 'Keine Regatten in den n&auml;chsten zwei Wochen!';
$content .= '</p>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-next']); $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-next']);
// Last // Last
$content = '<h2>Letzte Regatten</h2>'; $content = '<h2>Letzte Regatten</h2>';
$content .= '<div id="div-last" class="regattas-list mb-0"></div>'; $content .= '<div id="div-last" class="regattas-list mb-0"></div>';
$content .= '<p id="p-last" class="mt-3">'; $content .= '<p id="p-last" class="mt-3">';
$content .= 'Keine Regatten in den letzten zwei Wochen!'; $content .= 'Keine Regatten in den letzten zwei Wochen!';
$content .= '</p>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-last']); $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-last']);
// Calendar // Calendar
$content = '<h2>Regatta-Kalender</h2>'; $content = '<h2>Regatta-Kalender</h2>';
$content .= '<p>Du willst alle Regatta-Termine in deinem Kalender, aber nicht alles abtippen?<br>Kein Problem! Abonniere einfach unseren ics-Kalender.</p>'; $content .= '<p>Du willst alle Regatta-Termine in deinem Kalender, aber nicht alles abtippen?<br>Kein Problem! Abonniere einfach unseren ics-Kalender.</p>';
@@ -65,9 +76,9 @@
$content .= '</p>'; $content .= '</p>';
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Regatta-Kalender', 'https://regatten.net/client/calendar/' . BOATCLASS . '/everything.ics', 'css-class' => 'mb-2']); $content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Regatta-Kalender', 'https://regatten.net/client/calendar/' . BOATCLASS . '/everything.ics', 'css-class' => 'mb-2']);
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Kalender f&uuml;r <font class="replace-username"></font>', 'https://regatten.net/client/calendar/' . BOATCLASS . '/user_%USERID%.ics', 'css-class' => 'show-loggedin replace-userid-href']); $content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Kalender f&uuml;r <font class="replace-username"></font>', 'https://regatten.net/client/calendar/' . BOATCLASS . '/user_%USERID%.ics', 'css-class' => 'show-loggedin replace-userid-href']);
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);
// Regattas Menu // Regattas Menu
$items = '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>'; $items = '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
$items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']); $items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']);
@@ -78,8 +89,12 @@
$items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']);
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']); $items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']);
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]); $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]);
// Favorites Menu
$items = $tpl->load('menu/item-icon', ['Nicht mehr folgen', '#', 'html-id' => 'menu-item-unfollow', 'icon' => 'fa-heart', 'css-class' => ' border-0']);
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-favorite', 'title' => 'Favorit', 'height' => 200]);
$sp['scripts'] .= $scripts->load('onRegattaClicked'); $sp['scripts'] .= $scripts->load('onRegattaClicked');
$sp['scripts'] .= $scripts->load('index'); $sp['scripts'] .= $scripts->load('index');
?> ?>

View File

@@ -6,6 +6,7 @@
// Title // Title
$content = '<h1>Saison-Planung</h1>'; $content = '<h1>Saison-Planung</h1>';
$content .= $tpl->load('button', ['<i class="fas fa-list"></i>&ensp;Saison-Planungen anderer', LINK_PRE . 'planning_list', 'css-class' => 'mt-2 mb-2']);
$content .= '<p class="mb-1"><b>Hinweis:</b> Diese Seite kannst nur Du sehen.<br>Wenn Du Deine Saison-Planung teilen möchtest, <a id="a-share-planning">klicke hier</a></p>'; $content .= '<p class="mb-1"><b>Hinweis:</b> Diese Seite kannst nur Du sehen.<br>Wenn Du Deine Saison-Planung teilen möchtest, <a id="a-share-planning">klicke hier</a></p>';
$content .= $tpl->load('button', ['<i class="fas fa-edit"></i>&ensp;bearbeiten', LINK_PRE . 'planning_edit']); $content .= $tpl->load('button', ['<i class="fas fa-edit"></i>&ensp;bearbeiten', LINK_PRE . 'planning_edit']);
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']); $content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);

View File

@@ -1,14 +1,14 @@
<?php <?php
$sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = 'index'; $sp['backbutton'] = 'index';
$sp['activenav'] = 4; $sp['activenav'] = 4;
// Title // Title
$content = "<h1>Segler</h1>"; $content = "<h1>Segler</h1>";
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);
// Info Years // Info Years
$content = '<h2>Jahrg&auml;nge</h2>'; $content = '<h2>Jahrg&auml;nge</h2>';
$content .= '<p>'; $content .= '<p>';
@@ -17,30 +17,32 @@
$content .= 'Klicke dazu einfach auf den entsprechenden Segler und w&auml;hle Jahrgang bearbeiten aus.<br>'; $content .= 'Klicke dazu einfach auf den entsprechenden Segler und w&auml;hle Jahrgang bearbeiten aus.<br>';
$content .= 'Vielen Dank f&uuml;r Deine Unterst&uuml;tzung!'; $content .= 'Vielen Dank f&uuml;r Deine Unterst&uuml;tzung!';
$content .= '</p>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);
// List // List
$content = '<p id="p-count" class="mb-0"></p>'; $content = '<p id="p-count" class="mb-0"></p>';
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']); $content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
$content .= '<div id="div-list" class="normal-list mb-0"></div>'; $content .= '<div id="div-list" class="normal-list mb-0"></div>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list']); $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list']);
// Pagination // Pagination
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']); $sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']);
// Menu // Menu
$items = $tpl->load('menu/item-icon', ['', '#', 'html-id' => 'menu-item-year', 'icon' => 'fa-edit']); $items = $tpl->load('menu/item-switch', ['Favorit', 'html-id' => 'menu-item-follow', 'icon' => 'fa-heart']);
$items .= $tpl->load('menu/item-icon-badge', ['Favorit', '#', 'html-id' => 'menu-item-follow-disabled', 'icon' => 'fa-heart', 'badge-value' => 'MAX REACHED']);
$items .= $tpl->load('menu/item-icon', ['', '#', 'html-id' => 'menu-item-year', 'icon' => 'fa-edit']);
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe', 'css-class' => 'border-0']); $items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe', 'css-class' => 'border-0']);
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-sailor', 'title' => 'Segler-Details', 'height' => 200]); $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-sailor', 'title' => 'Segler-Details', 'height' => 260]);
$items = '<p class="mb-2 mt-1" style="line-height: 1.5em;">Bitte trage hier den Jahrgang ein:</p>'; $items = '<p class="mb-2 mt-1" style="line-height: 1.5em;">Bitte trage hier den Jahrgang ein:</p>';
$items .= $tpl->load('input', ['html-id' => 'input-edityear', 'placeholder' => 'Jahrgang', 'type' => 'number']); $items .= $tpl->load('input', ['html-id' => 'input-edityear', 'placeholder' => 'Jahrgang', 'type' => 'number']);
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-edityear']); $items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-edityear']);
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-edityear', 'height' => 240]); $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-edityear', 'height' => 240]);
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']); $sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
$sp['scripts'] .= $scripts->load('sailors'); $sp['scripts'] .= $scripts->load('sailors');
?> ?>

View File

@@ -245,7 +245,7 @@
</div> </div>
</div> </div>
<div id="menu-login" class="menu menu-box-top menu-box-detached rounded-m" data-menu-height="270"> <div id="menu-login" class="menu menu-box-top menu-box-detached rounded-m" data-menu-height="320">
<div class="content bottom-0"> <div class="content bottom-0">
<h1 class="text-center mt-5 font-900">Login</h1> <h1 class="text-center mt-5 font-900">Login</h1>
<div class="input-style input-style-2 has-icon input-required"> <div class="input-style input-style-2 has-icon input-required">
@@ -259,18 +259,29 @@
<input id="input-login-password" class="form-control" type="password" placeholder="Passwort" /> <input id="input-login-password" class="form-control" type="password" placeholder="Passwort" />
</div> </div>
<a class="btn btn-m mt-2 mb-2 btn-full bg-green2-dark text-uppercase font-900" href="#" onclick="login();">Login</a> <a class="btn btn-m mt-2 mb-2 btn-full bg-green2-dark text-uppercase font-900" href="#" onclick="login();">Login</a>
<p class="text-center mt-3"><a class="text-uppercase font-900" href="https://regatten.net/reset">Benutzername oder Passwort vergessen</a></p>
</div> </div>
</div> </div>
<div id="menu-signup" class="menu menu-box-modal menu-box-detached rounded-m" data-menu-height="300"> <div id="menu-signup" class="menu menu-box-top menu-box-detached rounded-m" data-menu-height="340">
<div class="content bottom-0"> <div class="content bottom-0">
<h1 class="text-center mt-5 font-900">Registrieren</h1> <h1 class="text-center mt-5 font-900">Registrieren</h1>
<p class="text-center"> <div class="input-style input-style-2 has-icon input-required">
Momentan kannst Du Dich leider nicht in der App registrieren.<br> <i class="input-icon fa fa-user color-theme"></i>
Das ist aber kein Problem, registriere Dich einfach kostenlos auf unserer Website! <span class="color-highlight">Benutzername</span>
</p> <input id="input-signup-username" class="form-control" type="name" placeholder="Benutzername" />
<a href="https://regatten.net/de/signup" class="btn btn-center-xl btn-m shadow-xl rounded-s bg-highlight font-900 text-center">Registrieren</a> </div>
<p class="text-center font-10 bottom-0">Du kannst Dich danach in dieser App anmelden.</p> <div class="input-style input-style-2 has-icon input-required">
<i class="input-icon fa fa-envelope color-theme"></i>
<span class="color-highlight">Email</span>
<input id="input-signup-email" class="form-control" type="email" placeholder="Email" />
</div>
<div class="input-style input-style-2 has-icon input-required">
<i class="input-icon fa fa-lock color-theme"></i>
<span class="color-highlight">Passwort</span>
<input id="input-signup-password" class="form-control" type="password" placeholder="Passwort" />
</div>
<a class="btn btn-m mt-2 mb-2 btn-full bg-green2-dark text-uppercase font-900" href="#" onclick="signup();">Registrieren</a>
</div> </div>
</div> </div>

View File

@@ -1,8 +1,84 @@
var firstCall = true;
var today; var today;
var onUpdatePushBadge;
var onUnfollowClicked = async function() {
var id = $('#menu-item-unfollow').attr('data-sailor-id');
showLoader();
$('#menu-favorite').hideMenu();
var auth = {
id: localStorage.getItem('auth_id'),
hash: localStorage.getItem('auth_hash')
}
$.ajax({
url: QUERY_URL + 'sailor_unfollow',
method: 'POST',
data: {
auth: auth,
sailor: id
},
error: function (xhr, status, error) {
if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Deine Favoriten zu bearbeiten.');
} else {
log('Unfollow: unbekannter Fehler', status, error);
log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
}
hideLoader();
},
success: async function (data, status, xhr) {
await sync();
toastOk('Erfolgreich');
hideLoader();
}
});
}
var onFavoriteClicked = async function(id) {
var sailor = await dbGetData('sailors', id);
$('#menu-favorite').find('.menu-title').find('p').text(sailor.name);
$('#menu-item-unfollow').attr('data-sailor-id', sailor.id);
$('#menu-favorite').showMenu();
}
var siteScript = async function() { var siteScript = async function() {
today = getToday(); today = getToday();
if (firstCall) {
firstCall = false;
$('#button-notifications-activate').click(function(){
$('#menu-pushes').showMenu();
});
$('#a-notifications-later').click(function(){
createCookie('regatten_app_' + BOATCLASS + '_rejected_push', true, 1);
$('#card-notifications').hide();
});
if (readCookie('regatten_app_' + BOATCLASS + '_rejected_push')) {
$('#card-notifications').hide();
} else {
onUpdatePushBadge = function () {
if (!pushesPossible || (Notification.permission == 'denied')) {
$('#card-notifications').hide();
} else {
swRegistration.pushManager.getSubscription().then(function(subscription) {
var isSub = (subscription !== null);
if (isSub) {
$('#card-notifications').hide();
} else {
$('#card-notifications').show();
}
});
}
}
onUpdatePushBadge();
}
$('#menu-item-unfollow').click(onUnfollowClicked);
}
if (isLoggedIn()) { if (isLoggedIn()) {
$('#card-notloggedin').hide(); $('#card-notloggedin').hide();
@@ -18,31 +94,41 @@ var siteScript = async function() {
} }
if (watched.length > 0) { if (watched.length > 0) {
var year = (new Date()).getFullYear(); var year = (new Date()).getFullYear();
$('#th-ranking').html('Rangliste ' + year);
var ranking = (await dbGetRanking(parseDate('01.12.' + (year - 1)), parseDate('30.11.' + year), false, false))[0]; var ranking = (await dbGetRanking(parseDate('01.12.' + (year - 1)), parseDate('30.11.' + year), false, false))[0];
tbody = ''; var list = '';
for (i in watched) { for (i in watched) {
sailor = watched[i]; sailor = watched[i];
tbody += '<tr><td>' + sailor.name + '</td><td>'; var club = null;
if (sailor.club != null)
club = await dbGetData('clubs', sailor.club);
var rank = null; var rank = null;
for (r in ranking) { for (r in ranking) {
if (ranking[r].id == sailor.id) { if (ranking[r].id == sailor.id) {
rank = ranking[r].rank; rank = ranking[r];
break; break;
} }
} }
list += '<div onclick="onFavoriteClicked(' + sailor.id + ');">';
list += '<div>';
// Name
list += '<div><b>' + sailor.name + '</b></div>';
list += '</div><div>';
if (rank == null) { if (rank == null) {
tbody += '<i>nicht in der Rangliste</i>'; list += '<div>Nicht in der Rangliste</div>';
} else { } else {
tbody += '<b>' + rank + '.</b> Platz'; // Rank
list += '<div>Platz <b>' + rank.rank + '</b></div>';
// rlp
list += '<div>' + rank.rlp.toFixed(3) + ' Punkte</div>';
} }
tbody += '</td></tr>'; list += '</div></div>';
} }
$('#table-favorites').find('tbody').html(tbody); $('#div-favorites').html(list);
$('#p-favorites').hide(); $('#p-favorites').hide();
$('#table-favorites').show(); $('#div-favorites').show();
} else { } else {
$('#table-favorites').hide(); $('#div-favorites').hide();
$('#p-favorites').show(); $('#p-favorites').show();
} }
$('#card-favorites').show(); $('#card-favorites').show();

View File

@@ -66,7 +66,7 @@ var siteScript = async function() {
lastYear.setFullYear(lastYear.getFullYear() - 1); lastYear.setFullYear(lastYear.getFullYear() - 1);
for (var n in news) { for (var n in news) {
var newsEntry = news[n]; var newsEntry = news[n];
newsEntry.date = new Date(Date.parse(newsEntry.date)); newsEntry.date = parseDbTimestamp(newsEntry.date);
if (newsEntry.date > now) continue; if (newsEntry.date > now) continue;
if (newsEntry.date < lastYear) break; if (newsEntry.date < lastYear) break;
newsEntry.unread = (newsEntry.date > newsRead); newsEntry.unread = (newsEntry.date > newsRead);

View File

@@ -4,6 +4,40 @@ var displayed = [];
var page = 1; var page = 1;
var pageCount = 0; var pageCount = 0;
const showCount = 25; const showCount = 25;
var followedSailors = [];
async function onFollowChange() {
var id = $('#menu-item-follow').attr('data-sailor-id');
showLoader();
$('#menu-sailor').hideMenu();
var auth = {
id: localStorage.getItem('auth_id'),
hash: localStorage.getItem('auth_hash')
}
$.ajax({
url: QUERY_URL + ($('#menu-item-follow').prop('checked') ? 'sailor_follow' : 'sailor_unfollow'),
method: 'POST',
data: {
auth: auth,
sailor: id
},
error: function (xhr, status, error) {
if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Deine Favoriten zu bearbeiten.');
} else {
log('Un/Follow: unbekannter Fehler', status, error);
log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
}
hideLoader();
},
success: async function (data, status, xhr) {
await sync();
toastOk('Erfolgreich');
hideLoader();
}
});
}
async function onEditYearClick() { async function onEditYearClick() {
var id = $('#button-edityear').attr('data-sailor-id'); var id = $('#button-edityear').attr('data-sailor-id');
@@ -50,6 +84,26 @@ async function onListClicked(id) {
$('#menu-sailor').find('.menu-title').find('p').text(sailor.name); $('#menu-sailor').find('.menu-title').find('p').text(sailor.name);
// Follow
if (isLoggedIn()) {
var found = false;
for (var i in followedSailors) {
if (followedSailors[i].id == sailor.id) found = true;
}
if (found || (followedSailors.length < 5)) {
$('#menu-item-follow').attr('data-sailor-id', sailor.id);
$('#menu-item-follow').prop('checked', found);
$('#menu-item-follow').parent().parent().show();
$('#menu-item-follow-disabled').hide();
} else {
$('#menu-item-follow').parent().parent().hide();
$('#menu-item-follow-disabled').show();
}
} else {
$('#menu-item-follow').parent().parent().hide();
$('#menu-item-follow-disabled').hide();
}
// Edit Year // Edit Year
$('#button-edityear').attr('data-sailor-id', sailor.id); $('#button-edityear').attr('data-sailor-id', sailor.id);
$('#menu-edityear').find('.menu-title').find('p').text(sailor.name); $('#menu-edityear').find('.menu-title').find('p').text(sailor.name);
@@ -134,6 +188,19 @@ var siteScript = async function() {
$('#input-search').on('input', reSearch); $('#input-search').on('input', reSearch);
$('#menu-item-year').click(function(){ $('#menu-sailor').hideMenu(); $('#menu-edityear').showMenu(); }); $('#menu-item-year').click(function(){ $('#menu-sailor').hideMenu(); $('#menu-edityear').showMenu(); });
$('#button-edityear').click(onEditYearClick); $('#button-edityear').click(onEditYearClick);
$('#menu-item-follow').parent().parent().click(onFollowChange);
$('#menu-item-follow-disabled').click(function(){ $('#menu-sailor').hideMenu(); toastInfo('Du kannst maximal 5 Seglern folgen. Entferne erst einen Segler aus Deinen Favoriten, bevor Du andere aufnimmst.', 5000); });
}
if (isLoggedIn()) {
var user = await dbGetData('users', USER_ID);
followedSailors = [];
for (var i = 1; i <= 5; i ++) {
sailor_id = user['sailor' + i];
if (sailor_id != null) {
followedSailors.push(await dbGetData('sailors', sailor_id));
}
}
} }
var results = await dbGetData('sailors'); var results = await dbGetData('sailors');

View File

@@ -1,5 +1,5 @@
<?php <?php
define('PWA_VERSION', '1.10.5h1'); define('PWA_VERSION', '1.11h3');
?> ?>