Compare commits
11 Commits
ios_proble
...
v_1.11.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c22604896 | ||
|
|
4a65b48520 | ||
|
|
4eb2970671 | ||
|
|
0298cefc8b | ||
|
|
e17f99d005 | ||
|
|
15d7060354 | ||
|
|
1cb6de2402 | ||
|
|
2ddeac4ba4 | ||
|
|
a845137873 | ||
|
|
8bc0d9b15e | ||
|
|
3ff17a63e0 |
@@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const DB_VERSION = 6;
|
const DB_VERSION = 7;
|
||||||
|
|
||||||
const USER_ID = localStorage.getItem('auth_user');
|
const USER_ID = localStorage.getItem('auth_user');
|
||||||
const USER_NAME = localStorage.getItem('auth_username');
|
const USER_NAME = localStorage.getItem('auth_username');
|
||||||
@@ -351,7 +351,7 @@ function dbGetRanking(minDate, maxDate, jugend, jugstrict) {
|
|||||||
if (sailors[i].german == '0') {
|
if (sailors[i].german == '0') {
|
||||||
sailors.splice(i, 1);
|
sailors.splice(i, 1);
|
||||||
} else if (jugend) {
|
} else if (jugend) {
|
||||||
if (((sailors[i].year != null) && (sailors[i].year < (formatDate('Y', maxDate) - YOUTH_AGE))) ||
|
if (((sailors[i].year != null) && (sailors[i].year < (formatDate('Y', maxDate) - (await dbGetClassProp('youth-age'))))) ||
|
||||||
((sailors[i].year == null) && (jugstrict))) {
|
((sailors[i].year == null) && (jugstrict))) {
|
||||||
sailors.splice(i, 1);
|
sailors.splice(i, 1);
|
||||||
}
|
}
|
||||||
@@ -417,6 +417,27 @@ function dbSettingsSet(key, value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dbGetClassProp(key) {
|
||||||
|
return new Promise(function(resolve) {
|
||||||
|
if (canUseLocalDB) {
|
||||||
|
var request = db.transaction('class').objectStore('class').get(key);
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
resolve(typeof request.result != 'undefined' ? request.result.value : null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
getJSON(QUERY_URL + 'get_class_prop?key=' + key, function (code, data) {
|
||||||
|
if (code == 200) {
|
||||||
|
resolve(data.value);
|
||||||
|
} else {
|
||||||
|
log("[db] Something went wrong (HTTP " + code + ")");
|
||||||
|
fail(strings.error_network, 5000);
|
||||||
|
resolve(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function updateSyncStatus() {
|
async function updateSyncStatus() {
|
||||||
var lastSync = await dbGetData('update_times', 'last_sync');
|
var lastSync = await dbGetData('update_times', 'last_sync');
|
||||||
lastSync = new Date(lastSync.time * 1000);
|
lastSync = new Date(lastSync.time * 1000);
|
||||||
@@ -459,8 +480,16 @@ async function runPageScript() {
|
|||||||
|
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
var plannings = await dbGetDataIndex('plannings', 'user', USER_ID);
|
var plannings = await dbGetDataIndex('plannings', 'user', USER_ID);
|
||||||
plannings = plannings.map(function (e) { return e.regatta; });
|
plannings_all = plannings.map(function (e) { return e.regatta; });
|
||||||
dbSettingsSet('myregattas_' + BOATCLASS, plannings);
|
dbSettingsSet('myregattas_' + BOATCLASS, plannings_all);
|
||||||
|
for (var i = plannings.length - 1; i >= 0; i --) {
|
||||||
|
if (plannings[i].gemeldet == '1') plannings.splice(i, 1);
|
||||||
|
}
|
||||||
|
plannings_meldung_off = plannings.map(function (e) { return e.regatta; });
|
||||||
|
dbSettingsSet('myregattas_' + BOATCLASS + '_meldung_off', plannings_meldung_off);
|
||||||
|
} else {
|
||||||
|
dbSettingsSet('myregattas_' + BOATCLASS, null);
|
||||||
|
dbSettingsSet('myregattas_' + BOATCLASS + '_meldung_off', null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof updateSyncStatusTimer == 'undefined') {
|
if (typeof updateSyncStatusTimer == 'undefined') {
|
||||||
@@ -495,7 +524,7 @@ function sync() {
|
|||||||
localTimes[entry['table']] = entry['time'];
|
localTimes[entry['table']] = entry['time'];
|
||||||
});
|
});
|
||||||
|
|
||||||
syncInProgress = 11;
|
syncInProgress = 12;
|
||||||
var syncOkay = true;
|
var syncOkay = true;
|
||||||
log("[db] Sync Start");
|
log("[db] Sync Start");
|
||||||
$('#i-sync').addClass('fa-spin');
|
$('#i-sync').addClass('fa-spin');
|
||||||
@@ -525,6 +554,24 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_update_time', function (code, serverTimes) {
|
getJSON(QUERY_URL + 'get_update_time', function (code, serverTimes) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
|
|
||||||
|
// CLASS
|
||||||
|
getJSON(QUERY_URL + 'get_class', function (code, data) {
|
||||||
|
if (code == 200) {
|
||||||
|
var os = db.transaction('class', 'readwrite').objectStore('class');
|
||||||
|
log(data);
|
||||||
|
for (key in data) {
|
||||||
|
os.put({ key: key, value: data[key] });
|
||||||
|
}
|
||||||
|
syncInProgress --;
|
||||||
|
log('[db] class synced, remaining:', syncInProgress);
|
||||||
|
} else {
|
||||||
|
log("[db] class: Something went wrong (HTTP " + code + ")");
|
||||||
|
syncOkay = false;
|
||||||
|
syncInProgress --;
|
||||||
|
log('[db] class failed, remaining:', syncInProgress);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// CLUBS
|
// CLUBS
|
||||||
if (localTimes['clubs'] < serverTimes['clubs']) {
|
if (localTimes['clubs'] < serverTimes['clubs']) {
|
||||||
getJSON(QUERY_URL + 'get_clubs?changed-after=' + localTimes['clubs'], function (code, data) {
|
getJSON(QUERY_URL + 'get_clubs?changed-after=' + localTimes['clubs'], function (code, data) {
|
||||||
@@ -954,7 +1001,7 @@ function initDatabase() {
|
|||||||
db.onversionchange = function (event) {
|
db.onversionchange = function (event) {
|
||||||
if (syncTimer != null) window.clearInterval(syncTimer);
|
if (syncTimer != null) window.clearInterval(syncTimer);
|
||||||
if (updateSyncStatusTimer != null) window.clearInterval(updateSyncStatusTimer);
|
if (updateSyncStatusTimer != null) window.clearInterval(updateSyncStatusTimer);
|
||||||
// TODO document.getElementById('syncstatus').innerHTML = '';
|
$('#syncstatus').html('');
|
||||||
canUseLocalDB = false;
|
canUseLocalDB = false;
|
||||||
db.close();
|
db.close();
|
||||||
location.reload;
|
location.reload;
|
||||||
@@ -1057,6 +1104,11 @@ function initDatabase() {
|
|||||||
osUpdateTimes.add({ table: 'news', time: 0 });
|
osUpdateTimes.add({ table: 'news', time: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((oldVersion < 7) && (newVersion >= 7)) {
|
||||||
|
log('[db] to version 7');
|
||||||
|
var osClass = db.createObjectStore('class', { keyPath: 'key' });
|
||||||
|
}
|
||||||
|
|
||||||
// Force resync after db update
|
// Force resync after db update
|
||||||
if (oldVersion >= 1) {
|
if (oldVersion >= 1) {
|
||||||
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
||||||
|
|||||||
@@ -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,7 +1166,17 @@ 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);
|
||||||
|
|||||||
@@ -3,16 +3,40 @@
|
|||||||
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');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
const QUERY_URL = '<?php echo QUERY_URL; ?>';
|
const QUERY_URL = '<?php echo QUERY_URL; ?>';
|
||||||
const BOATCLASS = '<?php echo BOATCLASS; ?>';
|
const BOATCLASS = '<?php echo BOATCLASS; ?>';
|
||||||
const LINK_PRE = '<?php echo SERVER_ADDR; ?>/';
|
const LINK_PRE = '<?php echo SERVER_ADDR; ?>/';
|
||||||
const YOUTH_AGE = '<?php echo $_CLASS['youth-age']; ?>';
|
|
||||||
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();
|
||||||
@@ -547,19 +571,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);
|
||||||
}, 5000);
|
$(button).hide();
|
||||||
}
|
}
|
||||||
addConsoleOpenerToPreloader();
|
addConsoleOpenerToPreloader();
|
||||||
|
|||||||
@@ -80,7 +80,8 @@
|
|||||||
$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-special" 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']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
$items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas', 'css-class' => 'show-loggedin']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas', 'css-class' => 'show-loggedin']);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
$items = '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
$items = '<p id="menu-item-special" 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', ['Status bearbeiten', '#', 'html-id' => 'menu-item-status', 'icon' => 'fa-edit']);
|
$items .= $tpl->load('menu/item-icon', ['Status bearbeiten', '#', 'html-id' => 'menu-item-status', 'icon' => 'fa-edit']);
|
||||||
$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']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
$items = '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
$items = '<p id="menu-item-special" 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']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
$items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
||||||
|
|||||||
@@ -21,8 +21,11 @@
|
|||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', ['<p></p>', 'html-id' => 'card-special']);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
$items = '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
$items = '<p id="menu-item-special" 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']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
$items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
$items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
||||||
|
|||||||
@@ -188,6 +188,9 @@ var siteScript = async function() {
|
|||||||
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = '* ' + regatta.special.substr(1);
|
||||||
|
}
|
||||||
list += '<div>' + regatta['special'] + '</div>';
|
list += '<div>' + regatta['special'] + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
@@ -287,6 +290,9 @@ var siteScript = async function() {
|
|||||||
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = '* ' + regatta.special.substr(1);
|
||||||
|
}
|
||||||
list += '<div>' + regatta['special'] + '</div>';
|
list += '<div>' + regatta['special'] + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
@@ -393,6 +399,9 @@ var siteScript = async function() {
|
|||||||
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = '* ' + regatta.special.substr(1);
|
||||||
|
}
|
||||||
list += '<div>' + regatta['special'] + '</div>';
|
list += '<div>' + regatta['special'] + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
|
|||||||
@@ -6,6 +6,20 @@ async function onRegattaClicked(id) {
|
|||||||
var dateTo = parseDate(regatta['date']);
|
var dateTo = parseDate(regatta['date']);
|
||||||
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
||||||
|
|
||||||
|
var specialFields = await dbGetClassProp('special-fields');
|
||||||
|
if (specialFields === null) specialFields = {};
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = regatta.special.substr(1);
|
||||||
|
if (typeof specialFields[regatta.special] !== 'undefined') {
|
||||||
|
$('#menu-item-special').text(specialFields[regatta.special]);
|
||||||
|
} else {
|
||||||
|
$('#menu-item-special').text('ERROR');
|
||||||
|
}
|
||||||
|
$('#menu-item-special').show();
|
||||||
|
} else {
|
||||||
|
$('#menu-item-special').hide();
|
||||||
|
}
|
||||||
|
|
||||||
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
||||||
var planning = null;
|
var planning = null;
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
|
|||||||
@@ -214,6 +214,9 @@ var siteScript = async function() {
|
|||||||
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = '* ' + entry.special.substr(1);
|
||||||
|
}
|
||||||
row.content += '<div>' + entry['special'] + '</div>';
|
row.content += '<div>' + entry['special'] + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
|
|||||||
@@ -408,6 +408,9 @@ var siteScript = async function() {
|
|||||||
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = '* ' + entry.special.substr(1);
|
||||||
|
}
|
||||||
row.content += '<div>' + entry['special'] + '</div>';
|
row.content += '<div>' + entry['special'] + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ var siteScript = async function() {
|
|||||||
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = '* ' + entry.special.substr(1);
|
||||||
|
}
|
||||||
row.content += '<div>' + entry['special'] + '</div>';
|
row.content += '<div>' + entry['special'] + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ async function selectChange(callSiteScript = true) {
|
|||||||
jugend = jugstrict = true;
|
jugend = jugstrict = true;
|
||||||
break;
|
break;
|
||||||
case 'idjm':
|
case 'idjm':
|
||||||
|
var youthGermanName = await dbGetClassProp('youth-german-name');
|
||||||
var beginn = null;
|
var beginn = null;
|
||||||
var regattas = await dbGetData('regattas');
|
var regattas = await dbGetData('regattas');
|
||||||
regattas.sort(function(a,b){ return b.date.localeCompare(a.date); });
|
regattas.sort(function(a,b){ return b.date.localeCompare(a.date); });
|
||||||
@@ -146,7 +147,7 @@ async function selectChange(callSiteScript = true) {
|
|||||||
if ((date < parseDate('01.01.' + year)) || (date > parseDate('31.12.' + year))) {
|
if ((date < parseDate('01.01.' + year)) || (date > parseDate('31.12.' + year))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (regatta.name.indexOf(YOUTH_GERMAN_NAME) >= 0) {
|
if (regatta.name.indexOf(youthGermanName) >= 0) {
|
||||||
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -162,7 +163,7 @@ async function selectChange(callSiteScript = true) {
|
|||||||
jugend = true;
|
jugend = true;
|
||||||
jugstrict = false;
|
jugstrict = false;
|
||||||
} else {
|
} else {
|
||||||
$('#div-rank').html('Keine ' + YOUTH_GERMAN_NAME + ' gefunden!');
|
$('#div-rank').html('Keine ' + youthGermanName + ' gefunden!');
|
||||||
$('#input-search').parent().hide();
|
$('#input-search').parent().hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,9 @@ var siteScript = async function() {
|
|||||||
var heute = false;
|
var heute = false;
|
||||||
|
|
||||||
rows = [];
|
rows = [];
|
||||||
|
var specialFields = await dbGetClassProp('special-fields');
|
||||||
|
if (specialFields === null) specialFields = {};
|
||||||
|
var specialShown = {};
|
||||||
|
|
||||||
for (id in regattas) {
|
for (id in regattas) {
|
||||||
var entry = regattas[id];
|
var entry = regattas[id];
|
||||||
@@ -146,7 +149,16 @@ var siteScript = async function() {
|
|||||||
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
row.content += '<div>' + entry['special'] + '</div>';
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = entry.special.substr(1);
|
||||||
|
if (typeof specialFields[entry.special] !== 'undefined') {
|
||||||
|
specialShown[entry.special] = specialFields[entry.special];
|
||||||
|
entry.special = '* ' + entry.special;
|
||||||
|
} else {
|
||||||
|
entry.special = 'ERROR';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row.content += '<div>' + entry.special + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
var icons = [];
|
var icons = [];
|
||||||
@@ -223,12 +235,24 @@ var siteScript = async function() {
|
|||||||
rows.push(null);
|
rows.push(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Object.keys(specialShown).length > 0) {
|
||||||
|
var specialText = '';
|
||||||
|
for (key in specialShown) {
|
||||||
|
specialText += '* ' + key + ': ' + specialShown[key] + '<br>';
|
||||||
|
}
|
||||||
|
$('#card-special').find('p').html(specialText);
|
||||||
|
$('#card-special').show();
|
||||||
|
} else {
|
||||||
|
$('#card-special').hide();
|
||||||
|
}
|
||||||
|
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#p-count').html('Keine Regatten gefunden!');
|
$('#p-count').html('Keine Regatten gefunden!');
|
||||||
$('#div-regattas').hide();
|
$('#div-regattas').hide();
|
||||||
$('#input-search').parent().hide();
|
$('#input-search').parent().hide();
|
||||||
|
$('#card-special').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.11h3');
|
define('PWA_VERSION', '1.11.2');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -182,9 +182,9 @@ function getEntry(data, index, defaultValue) {
|
|||||||
return ((typeof data[index] !== "undefined") ? data[index] : defaultValue);
|
return ((typeof data[index] !== "undefined") ? data[index] : defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMyRegatta(id) {
|
function isMyRegatta(id, suffix = '') {
|
||||||
return new Promise(async function (resolve) {
|
return new Promise(async function (resolve) {
|
||||||
var regattas = await dbSettingsGet('myregattas_<?php echo BOATCLASS; ?>');
|
var regattas = await dbSettingsGet('myregattas_<?php echo BOATCLASS; ?>' + suffix);
|
||||||
if (regattas == null) resolve(false);
|
if (regattas == null) resolve(false);
|
||||||
else resolve(regattas.includes(id.toString()));
|
else resolve(regattas.includes(id.toString()));
|
||||||
});
|
});
|
||||||
@@ -228,8 +228,7 @@ self.addEventListener('push', async function(event) {
|
|||||||
break;
|
break;
|
||||||
case 'meldeschluss':
|
case 'meldeschluss':
|
||||||
if (await dbSettingsGet('notify_channel_<?php echo BOATCLASS; ?>_meldeschluss')) {
|
if (await dbSettingsGet('notify_channel_<?php echo BOATCLASS; ?>_meldeschluss')) {
|
||||||
if (await isMyRegatta(getEntry(data, 'id', ''))) okay = true;
|
if (await isMyRegatta(getEntry(data, 'id', ''), '_meldung_off')) okay = true;
|
||||||
// TODO: only if not already registered
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user