Compare commits
19 Commits
v_1.10.5
...
error_repo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0298cefc8b | ||
|
|
15d7060354 | ||
|
|
d38de287dd | ||
|
|
da2beac8d3 | ||
|
|
92a11bcfa5 | ||
|
|
fa4770e12a | ||
|
|
a6f2568753 | ||
|
|
6d0fdea0e8 | ||
|
|
1252c02d7c | ||
|
|
f617fa7923 | ||
|
|
c66dc96598 | ||
|
|
f5d059202e | ||
|
|
5962e1cc90 | ||
|
|
9f3019b4c5 | ||
|
|
326ba4a6bd | ||
|
|
4228ec739d | ||
|
|
a38c48dab4 | ||
|
|
da48e79a36 | ||
|
|
6b1e35cc14 |
@@ -9,10 +9,16 @@
|
|||||||
log('[tpl] Script "custom.js" loaded');
|
log('[tpl] Script "custom.js" loaded');
|
||||||
|
|
||||||
var loaderCount = 2;
|
var loaderCount = 2;
|
||||||
|
var showConsoleButtonTimeout = setTimeout(function(){
|
||||||
|
$('#button-show-console').show();
|
||||||
|
}, 10000);
|
||||||
var showLoader = function() {
|
var showLoader = function() {
|
||||||
if (loaderCount < 1) {
|
if (loaderCount < 1) {
|
||||||
$('#preloader').removeClass('preloader-hide');
|
$('#preloader').removeClass('preloader-hide');
|
||||||
loaderCount = 0;
|
loaderCount = 0;
|
||||||
|
showConsoleButtonTimeout = setTimeout(function(){
|
||||||
|
$('#button-show-console').show();
|
||||||
|
}, 10000);
|
||||||
log('[tpl] Loader shown');
|
log('[tpl] Loader shown');
|
||||||
}
|
}
|
||||||
loaderCount ++;
|
loaderCount ++;
|
||||||
@@ -22,6 +28,8 @@ var hideLoader = function() {
|
|||||||
if (loaderCount < 1) {
|
if (loaderCount < 1) {
|
||||||
$('#preloader').addClass('preloader-hide');
|
$('#preloader').addClass('preloader-hide');
|
||||||
loaderCount = 0;
|
loaderCount = 0;
|
||||||
|
clearTimeout(showConsoleButtonTimeout);
|
||||||
|
$('#button-show-console').hide();
|
||||||
log('[tpl] Loader hidden');
|
log('[tpl] Loader hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -346,6 +354,31 @@ eraseCookie('sticky_dark_mode');
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
log('[tpl] Init inputs');
|
||||||
|
|
||||||
|
$('.input-required input, .input-required select, .input-required textarea').on('focusin keyup',function(){
|
||||||
|
var spanValue = $(this).parent().find('span').text();
|
||||||
|
if($(this).val() != spanValue && $(this).val() != ""){
|
||||||
|
$(this).parent().find('span').addClass('input-style-1-active').removeClass('input-style-1-inactive');
|
||||||
|
}
|
||||||
|
if($(this).val() === ""){
|
||||||
|
$(this).parent().find('span').removeClass('input-style-1-inactive input-style-1-active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.input-required input, .input-required select, .input-required textarea').on('focusout',function(){
|
||||||
|
var spanValue = $(this).parent().find('span').text();
|
||||||
|
if($(this).val() === ""){
|
||||||
|
$(this).parent().find('span').removeClass('input-style-1-inactive input-style-1-active');
|
||||||
|
}
|
||||||
|
$(this).parent().find('span').addClass('input-style-1-inactive')
|
||||||
|
});
|
||||||
|
$('.input-required select').on('focusout',function(){
|
||||||
|
var getValue = $(this)[0].value;
|
||||||
|
if(getValue === "default"){
|
||||||
|
$(this).parent().find('span').removeClass('input-style-1-inactive input-style-1-active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
log('[tpl] init a2h');
|
log('[tpl] init a2h');
|
||||||
|
|
||||||
//Adding added-to-homescreen class to be targeted when used as PWA.
|
//Adding added-to-homescreen class to be targeted when used as PWA.
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -965,10 +970,10 @@ function initDatabase() {
|
|||||||
|
|
||||||
db.transaction('update_times').objectStore('update_times').get('last_sync').onsuccess = function (event) {
|
db.transaction('update_times').objectStore('update_times').get('last_sync').onsuccess = function (event) {
|
||||||
var lastSync = event.target.result.time;
|
var lastSync = event.target.result.time;
|
||||||
if (lastSync > 0) {
|
if (lastSync > 1) {
|
||||||
runPageScript();
|
runPageScript();
|
||||||
} else {
|
} else {
|
||||||
addSyncInfoToPreloader();
|
if (lastSync < 1) addSyncInfoToPreloader();
|
||||||
db.transaction('update_times', 'readwrite').objectStore('update_times').put({ table: 'loggedin', status: isLoggedIn() });
|
db.transaction('update_times', 'readwrite').objectStore('update_times').put({ table: 'loggedin', status: isLoggedIn() });
|
||||||
loaderCount --;
|
loaderCount --;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()));
|
||||||
|
|||||||
@@ -1155,6 +1155,8 @@ var mobileConsole = (function () {
|
|||||||
if (!msgContainer.innerHTML) { return; }
|
if (!msgContainer.innerHTML) { return; }
|
||||||
leftContainer.appendChild(msgContainer);
|
leftContainer.appendChild(msgContainer);
|
||||||
|
|
||||||
|
var errorReportEntry = { message: arguments[1].newMessage };
|
||||||
|
|
||||||
if (detailTable || stackTable) {
|
if (detailTable || stackTable) {
|
||||||
setCSS(msgContainer, {cursor : 'pointer'});
|
setCSS(msgContainer, {cursor : 'pointer'});
|
||||||
leftContainer.appendChild(detailTable || stackTable);
|
leftContainer.appendChild(detailTable || stackTable);
|
||||||
@@ -1164,8 +1166,18 @@ var mobileConsole = (function () {
|
|||||||
//populate right side
|
//populate right side
|
||||||
if (stackTrace && typeof stackTrace[stackTrace.length - 1] !== 'undefined') {
|
if (stackTrace && typeof stackTrace[stackTrace.length - 1] !== 'undefined') {
|
||||||
rightContainer.appendChild(setCSS(getLink(stackTrace[0].url, stackTrace[0].linkText), {color: '#808080'}));
|
rightContainer.appendChild(setCSS(getLink(stackTrace[0].url, stackTrace[0].linkText), {color: '#808080'}));
|
||||||
|
errorReportEntry.stack = { caller: stackTrace[0].caller, file: stackTrace[0].url, line: stackTrace[0].line, col: stackTrace[0].col };
|
||||||
|
if ((typeof LINK_PRE !== 'undefined') && (errorReportEntry.stack.file.startsWith(LINK_PRE))) {
|
||||||
|
errorReportEntry.stack.file = errorReportEntry.stack.file.substr(LINK_PRE.length);
|
||||||
|
}
|
||||||
|
var pos = errorReportEntry.stack.file.indexOf('?');
|
||||||
|
if (pos >= 0) {
|
||||||
|
errorReportEntry.stack.file = errorReportEntry.stack.file.substr(0, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof onConsoleOutput === 'function') onConsoleOutput(errorReportEntry);
|
||||||
|
|
||||||
//add to line
|
//add to line
|
||||||
lineContainer.appendChild(leftContainer);
|
lineContainer.appendChild(leftContainer);
|
||||||
lineContainer.appendChild(rightContainer);
|
lineContainer.appendChild(rightContainer);
|
||||||
|
|||||||
@@ -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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
header('Content-Type: text/javascript');
|
header('Content-Type: text/javascript');
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../server/config.php');
|
require_once(__DIR__ . '/../../server/config.php');
|
||||||
|
require_once(__DIR__ . '/../../server/version.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -13,6 +14,31 @@ const YOUTH_AGE = '<?php echo $_CLASS['youth-age']; ?>';
|
|||||||
const YOUTH_GERMAN_NAME = '<?php echo $_CLASS['youth-german-name']; ?>';
|
const YOUTH_GERMAN_NAME = '<?php echo $_CLASS['youth-german-name']; ?>';
|
||||||
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
||||||
|
|
||||||
|
var consoleOutput = [];
|
||||||
|
|
||||||
|
function onConsoleOutput(entry) {
|
||||||
|
consoleOutput.push(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onerror = function(message, source, lineno, colno, errorError) {
|
||||||
|
if (source.startsWith(LINK_PRE)) {
|
||||||
|
source = source.substr(LINK_PRE.length);
|
||||||
|
}
|
||||||
|
var pos = source.indexOf('?');
|
||||||
|
if (pos >= 0) {
|
||||||
|
source = source.substr(0, pos);
|
||||||
|
}
|
||||||
|
consoleOutput.push({
|
||||||
|
message: message,
|
||||||
|
stack: {
|
||||||
|
caller: '',
|
||||||
|
file: source,
|
||||||
|
line: lineno,
|
||||||
|
col: colno
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var hour = now.getHours().toString();
|
var hour = now.getHours().toString();
|
||||||
@@ -131,6 +157,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 +473,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 +497,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 +534,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 {
|
||||||
@@ -505,19 +573,39 @@ var addConsoleOpenerToPreloader = function() {
|
|||||||
addConsoleOpenerToPreloader = function(){};
|
addConsoleOpenerToPreloader = function(){};
|
||||||
var preloader = document.getElementById('preloader');
|
var preloader = document.getElementById('preloader');
|
||||||
var button = document.createElement('a');
|
var button = document.createElement('a');
|
||||||
|
button.id = 'button-show-console';
|
||||||
button.href = '#';
|
button.href = '#';
|
||||||
button.classList = 'btn rounded-s text-uppercase font-900 shadow-m m-3';
|
button.classList = 'btn rounded-s text-uppercase font-900 shadow-m m-3 bg-red2-dark bg-white';
|
||||||
button.style.position = 'fixed';
|
button.style.position = 'fixed';
|
||||||
button.style.bottom = 0;
|
button.style.bottom = 0;
|
||||||
|
button.style.left = 0;
|
||||||
button.style.right = 0;
|
button.style.right = 0;
|
||||||
button.innerHTML = '</>';
|
button.innerHTML = 'Fehlerbericht senden';
|
||||||
button.onclick = function(){
|
button.onclick = function(){
|
||||||
alert('CONSOLE OPENED\nDir werden jetzt einige Entwickler-Informationen angezeigt. Du kannst die Console über das X oben rechts wieder schließen.');
|
alert('FEHLERBERICHT\nEs wird jetzt ein Fehlerbericht an die Entwickler geschickt.\nBitte stelle sicher, dass Du mit dem Internet verbunden bist und drücke dann auf OK.');
|
||||||
mobileConsole.displayConsole();
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'error_report',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
errors: consoleOutput,
|
||||||
|
device: navigator.userAgent,
|
||||||
|
version: '<?php echo PWA_VERSION; ?>'
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 0) {
|
||||||
|
alert('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Fehlerbericht zu senden');
|
||||||
|
} else {
|
||||||
|
alert('Beim Senden ist ein unbekannter Fehler aufgetreten. Bitte versuche es noch einmal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function (data, status, xhr) {
|
||||||
|
alert('Wir leiten Dich jetzt zum erstellten Fehlerbericht um, sodass Du ggf. weitere Informationen ergänzen kannst.');
|
||||||
|
location.href = 'https://github.com/ostertun/RegattenApp/issues/' + data.issueNumber;
|
||||||
|
}
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setTimeout(function(){
|
preloader.appendChild(button);
|
||||||
preloader.appendChild(button);
|
$(button).hide();
|
||||||
}, 5000);
|
|
||||||
}
|
}
|
||||||
addConsoleOpenerToPreloader();
|
addConsoleOpenerToPreloader();
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
|
|
||||||
// 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ähle bis zu fünf Segler aus.';
|
$content .= 'Um jemandem zu folgen, gehe zur <a href="' . LINK_PRE . 'sailors">Segler-Liste</a> und wähle bis zu fünf Segler aus.';
|
||||||
@@ -38,6 +37,18 @@
|
|||||||
|
|
||||||
$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 über alle Änderungen.<br>';
|
||||||
|
$content .= 'Du bestimmst natürlich, welche Benachrichtigungen Du bekommen mö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äter</a></p>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notifications', 'css-class' => 'bg-blue2-dark']);
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
$content = '<h2>Nächste Regatten</h2>';
|
$content = '<h2>Nä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>';
|
||||||
@@ -79,6 +90,10 @@
|
|||||||
$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');
|
||||||
|
|
||||||
|
|||||||
@@ -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> 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> bearbeiten', LINK_PRE . 'planning_edit']);
|
$content .= $tpl->load('button', ['<i class="fas fa-edit"></i> 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']);
|
||||||
|
|||||||
@@ -31,9 +31,11 @@
|
|||||||
$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']);
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<nav id="$$html-id;">
|
<nav id="$$html-id;" class="$$css-class;">
|
||||||
<ul class="pagination justify-content-center">
|
<ul class="pagination justify-content-center">
|
||||||
<li id="$$html-id;-1" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">1</a></li>
|
<li id="$$html-id;-1" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">1</a></li>
|
||||||
<li id="$$html-id;-2" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">2</a></li>
|
<li id="$$html-id;-2" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">2</a></li>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.10.5');
|
define('PWA_VERSION', '1.11h4');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user