Compare commits
30 Commits
v_1.11.6
...
extService
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5dc107a7d | ||
|
|
dcc5428615 | ||
|
|
a37cf0ea46 | ||
|
|
b2c57839c4 | ||
|
|
eddf0f151b | ||
|
|
3c07c67a1a | ||
|
|
2caf6c4339 | ||
|
|
6b503eeae0 | ||
|
|
a88c8356c2 | ||
|
|
ba09698ece | ||
|
|
ea3ac5f329 | ||
|
|
abe412d8ed | ||
|
|
e25ca534ec | ||
|
|
4f01262eba | ||
|
|
314792b09e | ||
|
|
a9464c382b | ||
|
|
d204acd365 | ||
|
|
00dc405158 | ||
|
|
b87f557a62 | ||
|
|
689845d02a | ||
|
|
ae8aed446b | ||
|
|
343d898afd | ||
|
|
c88a512ff8 | ||
|
|
1fc7b8fe6d | ||
|
|
2014303fae | ||
|
|
7b6ad832a9 | ||
|
|
eaf0fd5a95 | ||
|
|
6c547d43c5 | ||
|
|
e9e56b66ab | ||
|
|
8ba463c8fe |
@@ -1,4 +1,4 @@
|
|||||||
const DB_VERSION = 7;
|
const DB_VERSION = 8;
|
||||||
|
|
||||||
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');
|
||||||
@@ -258,10 +258,13 @@ function dbGetResultCalculated(regatta) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = false) {
|
function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = false, personMode = 0) {
|
||||||
return new Promise(async function(resolve) {
|
return new Promise(async function(resolve) {
|
||||||
var rankNoResults = [];
|
var rankNoResults = [];
|
||||||
|
|
||||||
|
// TODO: remove / Abwärtskompatibilität
|
||||||
|
//if (maxAge === true) maxAge = await dbGetClassProp('youth-age');
|
||||||
|
|
||||||
var sailors = await dbGetData('sailors');
|
var sailors = await dbGetData('sailors');
|
||||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
|
|
||||||
@@ -285,6 +288,7 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
|||||||
// regatta has to have rlf
|
// regatta has to have rlf
|
||||||
if (regatta.rlf == 0) continue;
|
if (regatta.rlf == 0) continue;
|
||||||
|
|
||||||
|
// get results
|
||||||
var results = await dbGetDataIndex('results', 'regatta', regatta.id);
|
var results = await dbGetDataIndex('results', 'regatta', regatta.id);
|
||||||
if (results.length <= 0) {
|
if (results.length <= 0) {
|
||||||
if (regatta.dateTo <= getToday()) {
|
if (regatta.dateTo <= getToday()) {
|
||||||
@@ -336,8 +340,10 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
|||||||
// check if crew is youth
|
// check if crew is youth
|
||||||
if ((maxAge != false) && ageCrew) {
|
if ((maxAge != false) && ageCrew) {
|
||||||
var crew = result.crew.split(',');
|
var crew = result.crew.split(',');
|
||||||
|
crew.push(result.steuermann);
|
||||||
var okay = true;
|
var okay = true;
|
||||||
for (var c in crew) {
|
for (var ci in crew) {
|
||||||
|
var c = crew[ci];
|
||||||
if ((c == '') || !(c in sailorIds)) continue;
|
if ((c == '') || !(c in sailorIds)) continue;
|
||||||
var sailor = sailors[sailorIds[c]];
|
var sailor = sailors[sailorIds[c]];
|
||||||
if (((sailor.year != null) && (sailor.year < (formatDate('Y', date) - maxAge))) ||
|
if (((sailor.year != null) && (sailor.year < (formatDate('Y', date) - maxAge))) ||
|
||||||
@@ -349,9 +355,11 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
|||||||
if (!okay) continue;
|
if (!okay) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (personMode == 0 || personMode == 2) { // add to helmsman
|
||||||
sailors[sailorIds[result.steuermann]].regattas[regatta.id] = {
|
sailors[sailorIds[result.steuermann]].regattas[regatta.id] = {
|
||||||
regatta: regatta.id,
|
regatta: regatta.id,
|
||||||
boat: result.boat,
|
boat: result.boat,
|
||||||
|
helm: result.steuermann,
|
||||||
crew: result.crew,
|
crew: result.crew,
|
||||||
place: result.place,
|
place: result.place,
|
||||||
fb: fb,
|
fb: fb,
|
||||||
@@ -363,6 +371,28 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
|||||||
sailors[sailorIds[result.steuermann]].tmp_rlp.push([regatta.id, result.rlp]);
|
sailors[sailorIds[result.steuermann]].tmp_rlp.push([regatta.id, result.rlp]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (personMode == 1 || personMode == 2) { // add to crew
|
||||||
|
var crew = result.crew.split(',');
|
||||||
|
for (var ci in crew) {
|
||||||
|
var c = crew[ci];
|
||||||
|
if ((c == '') || !(c in sailorIds)) continue;
|
||||||
|
sailors[sailorIds[c]].regattas[regatta.id] = {
|
||||||
|
regatta: regatta.id,
|
||||||
|
boat: result.boat,
|
||||||
|
helm: result.steuermann,
|
||||||
|
crew: result.crew,
|
||||||
|
place: result.place,
|
||||||
|
fb: fb,
|
||||||
|
rlp: result.rlp,
|
||||||
|
used: 0,
|
||||||
|
m: m
|
||||||
|
};
|
||||||
|
for (var j = 0; j < m; j ++) {
|
||||||
|
sailors[sailorIds[c]].tmp_rlp.push([regatta.id, result.rlp]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove not german or not youth sailors
|
// remove not german or not youth sailors
|
||||||
@@ -408,8 +438,16 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
|||||||
return b.rlp - a.rlp;
|
return b.rlp - a.rlp;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var lastPoints = 0;
|
||||||
|
var lastRank = 1;
|
||||||
for (var i = 0; i < sailors.length; i ++) {
|
for (var i = 0; i < sailors.length; i ++) {
|
||||||
|
if (lastPoints == sailors[i].rlp) {
|
||||||
|
sailors[i].rank = lastRank;
|
||||||
|
} else {
|
||||||
sailors[i].rank = (i + 1);
|
sailors[i].rank = (i + 1);
|
||||||
|
lastRank = (i + 1);
|
||||||
|
lastPoints = sailors[i].rlp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve([sailors, rankNoResults]);
|
resolve([sailors, rankNoResults]);
|
||||||
@@ -570,7 +608,7 @@ function sync() {
|
|||||||
localTimes[entry['table']] = entry['time'];
|
localTimes[entry['table']] = entry['time'];
|
||||||
});
|
});
|
||||||
|
|
||||||
syncInProgress = 12;
|
syncInProgress = 13;
|
||||||
var syncOkay = true;
|
var syncOkay = true;
|
||||||
log("[db] Sync Start");
|
log("[db] Sync Start");
|
||||||
$('#i-sync').addClass('fa-spin');
|
$('#i-sync').addClass('fa-spin');
|
||||||
@@ -618,6 +656,33 @@ function sync() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// RANKINGS
|
||||||
|
getJSON(QUERY_URL + 'get_rankings', function (code, data) {
|
||||||
|
if (code == 200) {
|
||||||
|
var os = db.transaction('rankings', 'readwrite').objectStore('rankings');
|
||||||
|
data.data.forEach(function (entry) {
|
||||||
|
os.put(entry);
|
||||||
|
});
|
||||||
|
os.openCursor().onsuccess = function (event) {
|
||||||
|
var cursor = event.target.result;
|
||||||
|
if (cursor) {
|
||||||
|
if (!data.keys.includes(parseInt(cursor.key))) {
|
||||||
|
os.delete(cursor.key);
|
||||||
|
}
|
||||||
|
cursor.continue();
|
||||||
|
} else {
|
||||||
|
syncInProgress --;
|
||||||
|
log('[db] rankings synced, remaining:', syncInProgress);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
log("[db] rankings: Something went wrong (HTTP " + code + ")");
|
||||||
|
syncOkay = false;
|
||||||
|
syncInProgress --;
|
||||||
|
log('[db] rankings 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) {
|
||||||
@@ -1155,6 +1220,11 @@ function initDatabase() {
|
|||||||
var osClass = db.createObjectStore('class', { keyPath: 'key' });
|
var osClass = db.createObjectStore('class', { keyPath: 'key' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((oldVersion < 8) && (newVersion >= 8)) {
|
||||||
|
log('[db] to version 8');
|
||||||
|
var osRankings = db.createObjectStore('rankings', { keyPath: 'id' });
|
||||||
|
}
|
||||||
|
|
||||||
// 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');
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
require_once(__DIR__ . '/../../server/config.php');
|
require_once(__DIR__ . '/../../server/config.php');
|
||||||
require_once(__DIR__ . '/../../server/version.php');
|
require_once(__DIR__ . '/../../server/version.php');
|
||||||
|
|
||||||
|
// QUERY_URL changed in config.php (this is to update this file on client devices)
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
const QUERY_URL = '<?php echo QUERY_URL; ?>';
|
const QUERY_URL = '<?php echo QUERY_URL; ?>';
|
||||||
@@ -678,12 +680,21 @@ function ro_getLink(type, eventId, classId) {
|
|||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
function wfn_getLink(type, eventId, classId) {
|
||||||
|
switch (type) {
|
||||||
|
case 'entrylist':
|
||||||
|
return 'https://wettfahrten.net/event/' + eventId + '/entrylist?class=' + classId;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
function extServiceGetLink(serviceName, type, eventId = '', classId = '') {
|
function extServiceGetLink(serviceName, type, eventId = '', classId = '') {
|
||||||
switch (serviceName) {
|
switch (serviceName) {
|
||||||
case 'm2s':
|
case 'm2s':
|
||||||
return m2s_getLink(type, eventId, classId);
|
return m2s_getLink(type, eventId, classId);
|
||||||
case 'ro':
|
case 'ro':
|
||||||
return ro_getLink(type, eventId);
|
return ro_getLink(type, eventId);
|
||||||
|
case 'wfn':
|
||||||
|
return wfn_getLink(type, eventId);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,8 +74,8 @@
|
|||||||
$content .= '<font class="show-loggedin">Erstelle einfach eine <a href="' . LINK_PRE . 'planning">Saison-Planung</a> und abonniere Deinen persönlichen Kalender.</font>';
|
$content .= '<font class="show-loggedin">Erstelle einfach eine <a href="' . LINK_PRE . 'planning">Saison-Planung</a> und abonniere Deinen persönlichen Kalender.</font>';
|
||||||
$content .= '<font class="show-notloggedin"><a href="#" data-menu="menu-signup">Registriere Dich einfach kostenlos</a>, erstelle eine Saison-Planung und wir erstellen Dir einen persönlichen Kalender.</font>';
|
$content .= '<font class="show-notloggedin"><a href="#" data-menu="menu-signup">Registriere Dich einfach kostenlos</a>, erstelle eine Saison-Planung und wir erstellen Dir einen persönlichen Kalender.</font>';
|
||||||
$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://ranglisten.net/client/calendar/' . BOATCLASS . '/everything.ics', 'css-class' => 'mb-2']);
|
||||||
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Kalender fü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ür <font class="replace-username"></font>', 'https://ranglisten.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]);
|
||||||
|
|
||||||
@@ -86,11 +86,12 @@
|
|||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
||||||
$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']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
$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' => 400]);
|
||||||
|
|
||||||
// Favorites Menu
|
// Favorites Menu
|
||||||
$items = $tpl->load('menu/item-icon', ['Nicht mehr folgen', '#', 'html-id' => 'menu-item-unfollow', 'icon' => 'fa-heart', 'css-class' => ' border-0']);
|
$items = $tpl->load('menu/item-icon', ['Nicht mehr folgen', '#', 'html-id' => 'menu-item-unfollow', 'icon' => 'fa-heart', 'css-class' => ' border-0']);
|
||||||
|
|||||||
@@ -34,11 +34,12 @@
|
|||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
||||||
$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']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
$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' => 400]);
|
||||||
|
|
||||||
// Menu Edit status
|
// Menu Edit status
|
||||||
$items = $tpl->load('menu/item-switch', ['Gemeldet', 'html-id' => 'switch-status-gemeldet', 'icon' => 'fa-file-signature']);
|
$items = $tpl->load('menu/item-switch', ['Gemeldet', 'html-id' => 'switch-status-gemeldet', 'icon' => 'fa-file-signature']);
|
||||||
|
|||||||
@@ -26,11 +26,12 @@
|
|||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
||||||
$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']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
$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' => 400]);
|
||||||
|
|
||||||
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
||||||
$sp['scripts'] .= $scripts->load('planning_view');
|
$sp['scripts'] .= $scripts->load('planning_view');
|
||||||
|
|||||||
@@ -7,22 +7,22 @@
|
|||||||
// Title, Inputs
|
// Title, Inputs
|
||||||
$content = "<h1>Ranglisten</h1>";
|
$content = "<h1>Ranglisten</h1>";
|
||||||
|
|
||||||
$options = '<option value="year">Jahres-Rangliste</option>';
|
|
||||||
$options .= '<option value="youth">Jugend-Rangliste</option>';
|
|
||||||
$options .= '<option value="idjm">' . $_CLASS['youth-german-name'] . '-Rangliste</option>';
|
|
||||||
$options .= '<option value="user">Benutzerdefiniert</option>';
|
|
||||||
$content .= $tpl->load('select', ['html-id' => 'select-type', 'placeholder' => 'Rangliste', 'options' => $options, 'css-class' => 'mt-3 mb-0']);
|
|
||||||
$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']);
|
||||||
|
$content .= $tpl->load('select', ['html-id' => 'select-type', 'placeholder' => 'Rangliste', 'css-class' => 'mt-3 mb-0']);
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-from', 'placeholder' => 'Von', 'type' => 'date', 'css-class' => 'mt-3']);
|
$content .= $tpl->load('input', ['html-id' => 'input-from', 'placeholder' => 'Von', 'type' => 'date', 'css-class' => 'mt-3']);
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-to', 'placeholder' => 'Bis', 'type' => 'date']);
|
$content .= $tpl->load('input', ['html-id' => 'input-to', 'placeholder' => 'Bis', 'type' => 'date']);
|
||||||
$chbox = $tpl->load('checkbox', ['html-id' => 'input-jugend', 'placeholder' => 'Jugend']);
|
$content .= $tpl->load('input', ['html-id' => 'input-altm', 'placeholder' => 'alt. m', 'type' => 'number']);
|
||||||
$content .= '<div class="mb-3" style="display:inline-block; width:50%;">' . $chbox . '</div>';
|
$content .= $tpl->load('input', ['html-id' => 'input-maxage', 'placeholder' => 'max. Alter (leer = nicht prüfen)', 'type' => 'number']);
|
||||||
$chbox = $tpl->load('checkbox', ['html-id' => 'input-jugstrict', 'placeholder' => 'Streng']);
|
$content .= $tpl->load('checkbox', ['html-id' => 'input-agestrict', 'placeholder' => 'unb. Jahrgänge ausschließen']);
|
||||||
$content .= '<div class="mb-3" style="display:inline-block; width:50%;">' . $chbox . '</div>';
|
$content .= $tpl->load('checkbox', ['html-id' => 'input-agecrew', 'placeholder' => 'Crew auch prüfen']);
|
||||||
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show']);
|
$content .= $tpl->load('select', ['html-id' => 'select-personmode', 'placeholder' => 'nach', 'css-class' => 'mt-3 mb-0']);
|
||||||
|
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show', 'css-class' => 'mt-3']);
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// Sepcial ranks
|
||||||
|
$sp['output'] .= $tpl->load('card', ['', 'html-id' => 'card-special-ranks']);
|
||||||
|
|
||||||
// No Results
|
// No Results
|
||||||
$content = '<h2 class="color-white">ACHTUNG</h2>';
|
$content = '<h2 class="color-white">ACHTUNG</h2>';
|
||||||
$content .= '<p class="color-white">Zu folgenden Regatten wurden noch keine Ergebnisse hinterlegt:</p>';
|
$content .= '<p class="color-white">Zu folgenden Regatten wurden noch keine Ergebnisse hinterlegt:</p>';
|
||||||
|
|||||||
49
server/content/regatta_facts.php
Normal file
49
server/content/regatta_facts.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$sp['title'] = 'Fakten - Regatten.net ' . $_CLASS['name'];
|
||||||
|
$sp['backbutton'] = true;
|
||||||
|
$sp['activenav'] = 2;
|
||||||
|
|
||||||
|
// Title, Inputs
|
||||||
|
$content = '<h1 id="h1-title"></h1>';
|
||||||
|
$content .= '<p id="p-title"></p>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// NO FACTS INFO
|
||||||
|
$content = '<p>Es sind keine Fakten zu dieser Veranstaltung hinterlegt. Bitte lies die Ausschreibung.</p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-nofactsinfo']);
|
||||||
|
|
||||||
|
// Meldegeld
|
||||||
|
$content = '<h2>Meldegeld</h2>';
|
||||||
|
$content .= '<p></p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-entryfee']);
|
||||||
|
|
||||||
|
// Wettfahrten
|
||||||
|
$content = '<h2>Wettfahrten</h2>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-races']);
|
||||||
|
|
||||||
|
// Zeitplan
|
||||||
|
$content = '<h2>Zeitplan</h2>';
|
||||||
|
$content .= $tpl->load('table', ['css-class' => 'mb-0 text-nowrap']);
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-times']);
|
||||||
|
|
||||||
|
// Camping
|
||||||
|
$content = '<h2>Camping</h2>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-camping']);
|
||||||
|
|
||||||
|
// Verpflegung
|
||||||
|
$content = '<h2>Verpflegung</h2>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-food']);
|
||||||
|
|
||||||
|
// Weitere Infos
|
||||||
|
$content = '<h2>Weitere Informationen</h2><p></p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-text']);
|
||||||
|
|
||||||
|
// Disclaimer
|
||||||
|
$content = '<p><i>Alle Angaben ohne Gewähr. Änderungen vorbehalten. Am Ende gilt, was in der Ausschreibung / Segelanweisung steht!</i></p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('regatta_facts');
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -14,6 +14,11 @@
|
|||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// To today
|
||||||
|
$content = $tpl->load('button', ['<i class="fas fa-arrow-down"></i> Heute <i class="fas fa-arrow-down"></i>', '#', 'html-id' => 'button-totoday']);
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
// Regattas
|
// Regattas
|
||||||
$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']);
|
||||||
@@ -30,11 +35,12 @@
|
|||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']);
|
||||||
$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']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
$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' => 400]);
|
||||||
|
|
||||||
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
||||||
$sp['scripts'] .= $scripts->load('regattas');
|
$sp['scripts'] .= $scripts->load('regattas');
|
||||||
|
|||||||
@@ -317,7 +317,7 @@
|
|||||||
Das Nachladen kann außerdem gerade bei großen Datenmengen (wie Ranglisten) sehr lange dauern.
|
Das Nachladen kann außerdem gerade bei großen Datenmengen (wie Ranglisten) sehr lange dauern.
|
||||||
Wir empfehlen Dir daher, auf diesem Gerät unsere normale Website zu benutzen. Diese ist auch für Mobil-Geräte optimiert.
|
Wir empfehlen Dir daher, auf diesem Gerät unsere normale Website zu benutzen. Diese ist auch für Mobil-Geräte optimiert.
|
||||||
</p>
|
</p>
|
||||||
<a class="btn btn-m mt-2 btn-full bg-highlight text-uppercase font-900" href="https://regatten.net/">Zur Website</a>
|
<a class="btn btn-m mt-2 btn-full bg-highlight text-uppercase font-900" href="https://ranglisten.net/">Zur Website</a>
|
||||||
<a id="menu-nodb-warning-okay" class="btn btn-m mt-2 mb-3 btn-full bg-highlight text-uppercase font-900" href="#">Nicht erneut anzeigen</a>
|
<a id="menu-nodb-warning-okay" class="btn btn-m mt-2 mb-3 btn-full bg-highlight text-uppercase font-900" href="#">Nicht erneut anzeigen</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -137,6 +137,14 @@ async function onRegattaClicked(id) {
|
|||||||
$('#menu-item-bericht').hide();
|
$('#menu-item-bericht').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fakten
|
||||||
|
if ('facts' in regatta && regatta['facts'] != null) {
|
||||||
|
$('#menu-item-facts').show();
|
||||||
|
$('#menu-item-facts').attr('href', LINK_PRE + 'regatta_facts?regatta=' + regatta['id']);
|
||||||
|
} else {
|
||||||
|
$('#menu-item-facts').hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
if (regatta['info'] != '') {
|
if (regatta['info'] != '') {
|
||||||
$('#menu-item-info').show();
|
$('#menu-item-info').show();
|
||||||
@@ -151,10 +159,10 @@ async function onRegattaClicked(id) {
|
|||||||
$('#menu-item-meldung').show();
|
$('#menu-item-meldung').show();
|
||||||
$('#menu-item-meldung').attr('href', regatta['meldung']);
|
$('#menu-item-meldung').attr('href', regatta['meldung']);
|
||||||
$('#menu-item-meldung').attr('target', '_blank');
|
$('#menu-item-meldung').attr('target', '_blank');
|
||||||
if ((planning != null) && (planning['gemeldet'] == '1')) {
|
/*if ((planning != null) && (planning['gemeldet'] == '1')) {
|
||||||
$('#badge-regatta-meldung').text('schon gemeldet');
|
$('#badge-regatta-meldung').text('schon gemeldet');
|
||||||
$('#badge-regatta-meldung').addClass('bg-green2-dark').removeClass('bg-highlight bg-red2-dark bg-yellow2-dark');
|
$('#badge-regatta-meldung').addClass('bg-green2-dark').removeClass('bg-highlight bg-red2-dark bg-yellow2-dark');
|
||||||
} else if (regatta['meldungOffen'] == '0') {
|
} else*/ if (regatta['meldungOffen'] == '0') {
|
||||||
$('#badge-regatta-meldung').text('geschlossen');
|
$('#badge-regatta-meldung').text('geschlossen');
|
||||||
$('#badge-regatta-meldung').addClass('bg-highlight').removeClass('bg-green2-dark bg-red2-dark bg-yellow2-dark');
|
$('#badge-regatta-meldung').addClass('bg-highlight').removeClass('bg-green2-dark bg-red2-dark bg-yellow2-dark');
|
||||||
} else if (regatta['meldungSchluss'] != null) {
|
} else if (regatta['meldungSchluss'] != null) {
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ async function onRankingClicked(id) {
|
|||||||
|
|
||||||
// ZEILE 5...
|
// ZEILE 5...
|
||||||
var crew = entry.crew.split(',');
|
var crew = entry.crew.split(',');
|
||||||
|
crew.unshift(entry.helm);
|
||||||
for (var c in crew) {
|
for (var c in crew) {
|
||||||
var cr = await dbGetData('sailors', crew[c]);
|
var cr = await dbGetData('sailors', crew[c]);
|
||||||
if (cr != null) {
|
if (cr != null) {
|
||||||
@@ -106,53 +107,114 @@ async function onRankingClicked(id) {
|
|||||||
$('#menu-rank').scrollTop(0);
|
$('#menu-rank').scrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function selectChange(callSiteScript = true) {
|
var rankings;
|
||||||
var type = $('#select-type').val();
|
|
||||||
var year = parseInt($('#select-year').val());
|
function selectChange(callSiteScript = true) {
|
||||||
if (type == "user") {
|
return new Promise(async function (resolve) {
|
||||||
$('#select-year').parent().hide();
|
var year = $('#select-year').val();
|
||||||
|
if (year == "user") {
|
||||||
|
$('#select-type').parent().hide();
|
||||||
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-jugend').parent().parent().show();
|
$('#input-altm').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-jugstrict').parent().parent().show();
|
$('#input-maxage').trigger('focusin').trigger('focusout').parent().show();
|
||||||
|
$('#input-agestrict').parent().show();
|
||||||
|
$('#input-agecrew').parent().show();
|
||||||
$('#button-show').show();
|
$('#button-show').show();
|
||||||
|
$('#card-special-ranks').hide();
|
||||||
} else {
|
} else {
|
||||||
$('#select-year').parent().show();
|
year = parseInt(year);
|
||||||
|
var type = $('#select-type').val();
|
||||||
|
console.log('[rank] selected', year, type);
|
||||||
|
$('#select-type').parent().show();
|
||||||
$('#input-from').parent().hide();
|
$('#input-from').parent().hide();
|
||||||
$('#input-to').parent().hide();
|
$('#input-to').parent().hide();
|
||||||
$('#input-jugend').parent().parent().hide();
|
$('#input-altm').parent().hide();
|
||||||
$('#input-jugstrict').parent().parent().hide();
|
$('#input-maxage').parent().hide();
|
||||||
|
$('#input-agestrict').parent().hide();
|
||||||
|
$('#input-agecrew').parent().hide();
|
||||||
$('#button-show').hide();
|
$('#button-show').hide();
|
||||||
|
$('#card-special-ranks').hide(); // first hide, show only when there are special ranks
|
||||||
|
|
||||||
var from, to, jugend, jugstrict;
|
var rankingsShow = {};
|
||||||
switch (type) {
|
var options = '';
|
||||||
|
for (var i in rankings) {
|
||||||
|
if (rankings[i].year_from !== null && rankings[i].year_from > year) continue;
|
||||||
|
if (rankings[i].year_to !== null && rankings[i].year_to < year) continue;
|
||||||
|
var alias = rankings[i].alias;
|
||||||
|
options += '<option value="' + alias + '">' + rankings[i].name + '</option>';
|
||||||
|
rankingsShow[alias] = rankings[i];
|
||||||
|
}
|
||||||
|
$('#select-type').html(options);
|
||||||
|
if (!(type in rankingsShow)) {
|
||||||
|
console.log('[rank] selected type', type, 'not found for year', year, '. Using `year`');
|
||||||
|
type = 'year';
|
||||||
|
}
|
||||||
|
$('#select-type').val(type).trigger('focusin').trigger('focusout');
|
||||||
|
|
||||||
|
// special ranks
|
||||||
|
getJSON(QUERY_URL + 'get_special_rankings', function (code, data) {
|
||||||
|
if (code == 200) {
|
||||||
|
var specialRanks = [];
|
||||||
|
for (var i in data.data) {
|
||||||
|
var sr = data.data[i];
|
||||||
|
if (sr.to < (year + '-01-01')) continue;
|
||||||
|
if (sr.to > (year + '-12-31')) continue;
|
||||||
|
specialRanks.push(sr);
|
||||||
|
}
|
||||||
|
if (specialRanks.length > 0) {
|
||||||
|
var btns = '';
|
||||||
|
for (var i in specialRanks) {
|
||||||
|
var sr = specialRanks[i];
|
||||||
|
var link = 'https://ranglisten.net/frame.php?class=' + BOATCLASS + '&site=special_rank&rank_id=' + sr.id;
|
||||||
|
var name = sr.title;
|
||||||
|
var cssclass = i > 0 ? ' mt-3' : '';
|
||||||
|
btns += '<a class="btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight' + cssclass + '" href="' + link + '">' + name + '</a>';
|
||||||
|
}
|
||||||
|
$('#card-special-ranks').find('.content').html(btns);
|
||||||
|
$('#card-special-ranks').show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log("[rank] special_ranks: Something went wrong (HTTP " + code + ")");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var from, to, altm, maxage, agestrict, agecrew;
|
||||||
|
altm = 9; maxage = false; agestrict = false; agecrew = false;
|
||||||
|
var r = rankingsShow[type];
|
||||||
|
console.log('[rank] type', type, '=>', r);
|
||||||
|
if (r.max_age !== null) {
|
||||||
|
maxage = r.max_age;
|
||||||
|
agestrict = r.age_strict == 1;
|
||||||
|
agecrew = r.age_crew == 1;
|
||||||
|
}
|
||||||
|
if (r.alt_m !== null) {
|
||||||
|
altm = r.alt_m;
|
||||||
|
}
|
||||||
|
switch (r.type) {
|
||||||
case 'year':
|
case 'year':
|
||||||
from = (year - 1) + '-12-01';
|
from = (year - 1) + '-12-01';
|
||||||
to = year + '-11-30';
|
to = year + '-11-30';
|
||||||
jugend = jugstrict = false;
|
|
||||||
break;
|
break;
|
||||||
case 'youth':
|
case 'quali':
|
||||||
from = (year - 1) + '-12-01';
|
// TODO: auslagern in function getRegattaBegin
|
||||||
to = year + '-11-30';
|
|
||||||
jugend = jugstrict = true;
|
|
||||||
break;
|
|
||||||
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); });
|
||||||
for (var r in regattas) {
|
for (var ri in regattas) {
|
||||||
var regatta = regattas[r];
|
var regatta = regattas[ri];
|
||||||
var date = parseDate(regatta.date);
|
var date = parseDate(regatta.date);
|
||||||
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(youthGermanName) >= 0) {
|
if (regatta.name.toLowerCase().indexOf(r.quali_search.toLowerCase()) >= 0) {
|
||||||
|
console.log('FOUND', regatta);
|
||||||
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (beginn != null) {
|
// END OF TODO
|
||||||
|
if (beginn !== null) {
|
||||||
from = new Date(beginn);
|
from = new Date(beginn);
|
||||||
from.setFullYear(from.getFullYear() - 1);
|
from.setFullYear(from.getFullYear() - 1);
|
||||||
from.setDate(from.getDate() - 13);
|
from.setDate(from.getDate() - 13);
|
||||||
@@ -160,65 +222,108 @@ async function selectChange(callSiteScript = true) {
|
|||||||
to = new Date(beginn);
|
to = new Date(beginn);
|
||||||
to.setDate(to.getDate() - 14);
|
to.setDate(to.getDate() - 14);
|
||||||
to = formatDate('Y-m-d', to);
|
to = formatDate('Y-m-d', to);
|
||||||
jugend = true;
|
|
||||||
jugstrict = false;
|
|
||||||
} else {
|
} else {
|
||||||
$('#div-rank').html('Keine ' + youthGermanName + ' gefunden!');
|
console.log('[rank] no regatta found');
|
||||||
$('#input-search').parent().hide();
|
from = year + '-12-31'; // reverse => no regattas will be found => no ranking
|
||||||
return;
|
to = year + '-01-01';
|
||||||
|
break; // TODO: bessere Fehlermeldung - keine Regatta gefunden
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default: // TODO: bessere Fehlermeldung - tritt nur bei Fehlkonfiguration in DB auf
|
||||||
|
from = (year - 1) + '-12-01';
|
||||||
|
to = year + '-11-30';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var personMode = $('#select-personmode').val();
|
||||||
|
|
||||||
|
console.log('[rank] setting', from, to, altm, maxage, agestrict, agecrew);
|
||||||
$('#input-from').val(from);
|
$('#input-from').val(from);
|
||||||
$('#input-to').val(to);
|
$('#input-to').val(to);
|
||||||
$('#input-jugend').prop('checked', jugend);
|
$('#input-altm').val(altm);
|
||||||
$('#input-jugstrict').prop('checked', jugstrict);
|
$('#input-maxage').val(maxage == false ? '' : maxage);
|
||||||
|
$('#input-agestrict').prop('checked', agestrict);
|
||||||
|
$('#input-agecrew').prop('checked', agecrew);
|
||||||
|
|
||||||
if (callSiteScript && (typeof siteScript === 'function')) {
|
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||||
history.replaceState(null, '', '?type=' + type + '&year=' + year);
|
history.replaceState(null, '', '?year=' + year + '&type=' + type + '&pm=' + personMode);
|
||||||
showLoader();
|
showLoader();
|
||||||
siteScript();
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonShowPressed() {
|
function buttonShowPressed() {
|
||||||
if (typeof siteScript === 'function') {
|
if (typeof siteScript === 'function') {
|
||||||
var chboxes = '';
|
var additional = '';
|
||||||
if ($('#input-jugend').prop('checked')) chboxes += '&jugend=on'
|
if ($('#input-maxage').val() != '') additional += '&maxage=' + $('#input-maxage').val();
|
||||||
if ($('#input-jugstrict').prop('checked')) chboxes += '&jugstrict=on'
|
if ($('#input-agestrict').prop('checked')) additional += '&agestrict=on';
|
||||||
history.replaceState(null, '', '?type=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val() + chboxes)
|
if ($('#input-agecrew').prop('checked')) additional += '&agecrew=on';
|
||||||
|
history.replaceState(null, '', '?year=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val() + "&altm=" + $('#input-altm').val() + "&pm=" + $('#select-personmode').val() + additional)
|
||||||
showLoader();
|
showLoader();
|
||||||
siteScript();
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSelects() {
|
function initSelects() {
|
||||||
var type = findGetParameter('type');
|
return new Promise(async function(resolve) {
|
||||||
var year = findGetParameter('year');
|
var year = findGetParameter('year');
|
||||||
if (type === null) type = 'year';
|
var type = findGetParameter('type');
|
||||||
|
var personMode = parseInt(findGetParameter('pm'));
|
||||||
if (year === null) year = new Date().getFullYear();
|
if (year === null) year = new Date().getFullYear();
|
||||||
|
if (type === null) type = 'year';
|
||||||
|
if (isNaN(personMode) || personMode < 0 || personMode > 2) personMode = 0;
|
||||||
|
|
||||||
|
var years = await dbGetData('years');
|
||||||
|
years.sort(function (a, b) {
|
||||||
|
if (a['year'] > b['year']) return -1;
|
||||||
|
if (a['year'] < b['year']) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
var yearFound = year == 'user';
|
||||||
|
var options = '<option value="user">Benutzerdefiniert</option>';
|
||||||
|
for (id in years) {
|
||||||
|
var y = years[id]['year'];
|
||||||
|
options += '<option value="' + y + '">' + y + '</option>';
|
||||||
|
if (year == y) yearFound = true;
|
||||||
|
}
|
||||||
|
$('#select-year').html(options);
|
||||||
|
$('#select-year').val(yearFound ? year : years[0]);
|
||||||
|
|
||||||
|
$('#select-type').html('<option value="' + type + '">' + type + '</option>');
|
||||||
$('#select-type').val(type);
|
$('#select-type').val(type);
|
||||||
|
|
||||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
if (year == "user") {
|
||||||
$('#select-year').val(year);
|
|
||||||
|
|
||||||
if (type == "user") {
|
|
||||||
var from = findGetParameter('from');
|
var from = findGetParameter('from');
|
||||||
var to = findGetParameter('to');
|
var to = findGetParameter('to');
|
||||||
if (from === null) from = formatDate('Y-m-d')
|
if (from === null) from = formatDate('Y-m-d');
|
||||||
if (to === null) to = formatDate('Y-m-d')
|
if (to === null) to = formatDate('Y-m-d');
|
||||||
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
||||||
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
||||||
var jugend = findGetParameter('jugend');
|
var altm = findGetParameter('altm');
|
||||||
var jugstrict = findGetParameter('jugstrict');
|
if (altm === null) altm = 9;
|
||||||
$('#input-jugend').prop('checked', jugend !== null);
|
$('#input-altm').val(altm).trigger('focusin').trigger('focusout');
|
||||||
$('#input-jugstrict').prop('checked', jugstrict !== null);
|
var maxage = findGetParameter('maxage');
|
||||||
|
if (maxage === null) maxage = '';
|
||||||
|
$('#input-maxage').val(maxage).trigger('focusin').trigger('focusout');
|
||||||
|
var agestrict = findGetParameter('agestrict');
|
||||||
|
var agecrew = findGetParameter('agecrew');
|
||||||
|
$('#input-agestrict').prop('checked', agestrict !== null);
|
||||||
|
$('#input-agecrew').prop('checked', agecrew !== null);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectChange(false);
|
options = '<option value="0">Steuerleuten</option>';
|
||||||
|
options += '<option value="1">Vorschotern</option>';
|
||||||
|
options += '<option value="2">allen Seglern</option>';
|
||||||
|
$('#select-personmode').html(options);
|
||||||
|
$('#select-personmode').val(personMode);
|
||||||
|
|
||||||
|
await selectChange(false);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstCall = true;
|
var firstCall = true;
|
||||||
@@ -231,7 +336,12 @@ async function drawList () {
|
|||||||
var list = '';
|
var list = '';
|
||||||
rows.forEach(function (entry) {
|
rows.forEach(function (entry) {
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
|
var altm = $('#input-altm').val(); if (altm == '') altm = 9; else altm = parseInt(altm);
|
||||||
|
if (altm == 9) {
|
||||||
list += '<div><div align="center" class="color-highlight" style="white-space:normal;"><b>Ende der Rangliste gemäß DSV-Ranglistenverordnung (min. m = 9 Wertungen)</b></div></div>';
|
list += '<div><div align="center" class="color-highlight" style="white-space:normal;"><b>Ende der Rangliste gemäß DSV-Ranglistenverordnung (min. m = 9 Wertungen)</b></div></div>';
|
||||||
|
} else {
|
||||||
|
list += '<div><div align="center" class="color-highlight" style="white-space:normal;"><b>Ende der Rangliste (min. m = ' + altm + ' Wertungen)</b></div></div>';
|
||||||
|
}
|
||||||
} else if (search($('#input-search').val(), entry.keywords)) {
|
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||||
list += entry.content;
|
list += entry.content;
|
||||||
}
|
}
|
||||||
@@ -243,27 +353,33 @@ async function drawList () {
|
|||||||
var siteScript = async function() {
|
var siteScript = async function() {
|
||||||
if (firstCall) {
|
if (firstCall) {
|
||||||
firstCall = false;
|
firstCall = false;
|
||||||
initSelects();
|
rankings = await dbGetData('rankings');
|
||||||
$('#select-type').change(selectChange);
|
await initSelects();
|
||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
|
$('#select-type').change(selectChange);
|
||||||
|
$('#select-personmode').change(selectChange);
|
||||||
$('#button-show').click(buttonShowPressed);
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
var minDate = parseDate($('#input-from').val());
|
var minDate = parseDate($('#input-from').val());
|
||||||
var maxDate = parseDate($('#input-to').val());
|
var maxDate = parseDate($('#input-to').val());
|
||||||
var jugend = $('#input-jugend').prop('checked');
|
var altm = $('#input-altm').val(); if (altm == '') altm = 9; else altm = parseInt(altm);
|
||||||
var jugstrict = $('#input-jugstrict').prop('checked');
|
var maxage = $('#input-maxage').val(); if (maxage == '') maxage = false; else maxage = parseInt(maxage);
|
||||||
var dbRanking = await dbGetRanking(minDate, maxDate, jugend, jugstrict);
|
var agestrict = $('#input-agestrict').prop('checked');
|
||||||
|
var agecrew = $('#input-agecrew').prop('checked');
|
||||||
|
var personMode = $('#select-personmode').val();
|
||||||
|
console.log('[rank] rank params:', minDate, maxDate, altm, maxage, agestrict, agecrew, personMode);
|
||||||
|
var dbRanking = await dbGetRanking(minDate, maxDate, maxage, agestrict, altm, agecrew, personMode);
|
||||||
ranking = dbRanking[0];
|
ranking = dbRanking[0];
|
||||||
|
|
||||||
lastRanking = null;
|
lastRanking = null; // TODO: also for quali ranks
|
||||||
if (($('#select-type').val() == 'year') || ($('#select-type').val() == 'youth')) {
|
if (($('#select-type').val() == 'year') || ($('#select-type').val() == 'youth')) {
|
||||||
lastRanking = {};
|
lastRanking = {};
|
||||||
var lYear = parseInt($('#select-year').val()) - 1;
|
var lYear = parseInt($('#select-year').val()) - 1;
|
||||||
var lMinDate = parseDate((lYear - 1) + '-12-01');
|
var lMinDate = parseDate((lYear - 1) + '-12-01');
|
||||||
var lMaxDate = parseDate(lYear + '-11-30');
|
var lMaxDate = parseDate(lYear + '-11-30');
|
||||||
var lDbRanking = (await dbGetRanking(lMinDate, lMaxDate, jugend, jugstrict))[0];
|
var lDbRanking = (await dbGetRanking(lMinDate, lMaxDate, maxage, agestrict, altm, agecrew, personMode))[0];
|
||||||
for (var i in lDbRanking) {
|
for (var i in lDbRanking) {
|
||||||
lastRanking[lDbRanking[i].id] = lDbRanking[i].rank;
|
lastRanking[lDbRanking[i].id] = lDbRanking[i].rank;
|
||||||
}
|
}
|
||||||
@@ -271,20 +387,6 @@ var siteScript = async function() {
|
|||||||
|
|
||||||
var selectedYear = $('#select-year').val();
|
var selectedYear = $('#select-year').val();
|
||||||
|
|
||||||
var years = await dbGetData('years');
|
|
||||||
years.sort(function (a, b) {
|
|
||||||
if (a['year'] > b['year']) return -1;
|
|
||||||
if (a['year'] < b['year']) return 1;
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
var options = '';
|
|
||||||
for (id in years) {
|
|
||||||
var year = years[id]['year'];
|
|
||||||
options += '<option value="' + year + '">' + year + '</option>';
|
|
||||||
}
|
|
||||||
$('#select-year').html(options);
|
|
||||||
$('#select-year').val(selectedYear);
|
|
||||||
|
|
||||||
if (dbRanking[1].length > 0) {
|
if (dbRanking[1].length > 0) {
|
||||||
$('#card-noresults').show();
|
$('#card-noresults').show();
|
||||||
list = '';
|
list = '';
|
||||||
@@ -326,7 +428,7 @@ var siteScript = async function() {
|
|||||||
if (entry['year'] != null) row.keywords.push(entry['year']);
|
if (entry['year'] != null) row.keywords.push(entry['year']);
|
||||||
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
if (!dsvEnd && (entry.m < 9)) {
|
if (!dsvEnd && (entry.m < altm)) {
|
||||||
rows.push(null);
|
rows.push(null);
|
||||||
dsvEnd = true;
|
dsvEnd = true;
|
||||||
}
|
}
|
||||||
|
|||||||
258
server/scripts/regatta_facts.js
Normal file
258
server/scripts/regatta_facts.js
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
var siteScript = async function() {
|
||||||
|
$('#card-nofactsinfo').hide();
|
||||||
|
$('#card-entryfee').hide();
|
||||||
|
$('#card-races').hide();
|
||||||
|
$('#card-races').find('p').remove();
|
||||||
|
$('#card-races').find('table').remove();
|
||||||
|
$('#card-times').hide();
|
||||||
|
$('#card-camping').hide();
|
||||||
|
$('#card-food').hide();
|
||||||
|
$('#card-text').hide();
|
||||||
|
|
||||||
|
var regattaId = findGetParameter('regatta');
|
||||||
|
if (regattaId == null) {
|
||||||
|
$('#h1-title').text('Regatta nicht gefunden');
|
||||||
|
hideLoader();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var regatta = await dbGetData('regattas', regattaId);
|
||||||
|
if (regatta == null) {
|
||||||
|
$('#h1-title').text('Regatta nicht gefunden');
|
||||||
|
hideLoader();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var dateFrom = parseDate(regatta['date']);
|
||||||
|
var dateTo = parseDate(regatta['date']);
|
||||||
|
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
||||||
|
|
||||||
|
$('#h1-title').text(regatta.name);
|
||||||
|
if (regatta.length < 1) {
|
||||||
|
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||||
|
$('#p-title').html('<font class="color-red2-dark">Datum noch unklar</font>');
|
||||||
|
} else {
|
||||||
|
$('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font>');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - ' + formatDate('d.m.Y', dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regatta.facts != null) {
|
||||||
|
var facts = JSON.parse(regatta.facts);
|
||||||
|
|
||||||
|
// Meldegeld
|
||||||
|
if ('entry' in facts && 'price' in facts.entry) {
|
||||||
|
$('#card-entryfee').show();
|
||||||
|
var content = 'Meldegeld: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.price)) + '</b>';
|
||||||
|
if ('early' in facts.entry) {
|
||||||
|
content += '<br />vergünstigt: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.early)) + '</b> (bis ' + formatDate('d.m.Y', parseDate(regatta.meldungEarly)) + ')';
|
||||||
|
}
|
||||||
|
if ('late' in facts.entry) {
|
||||||
|
content += '<br />nach Meldeschluss (' + formatDate('d.m.Y', parseDate(regatta.meldungSchluss)) + '): <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.late)) + '</b>';
|
||||||
|
}
|
||||||
|
$('#card-entryfee').find('p').html(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wettfahrten / Anzahl
|
||||||
|
if ('races' in facts && 'cnt' in facts.races) {
|
||||||
|
$('#card-races').show();
|
||||||
|
$('#card-races').find('.content').append('<p>Anzahl Wettfahrten: <b>' + facts.races.cnt + '</b></p>');
|
||||||
|
if ('days' in facts.races) {
|
||||||
|
var table = $('<table class="table table-striped table-bordered text-nowrap">');
|
||||||
|
var tbody = $('<tbody>');
|
||||||
|
for (var day in facts.races.days) {
|
||||||
|
var cnt = facts.races.days[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td><b>' + cnt + '</b></td></tr>')
|
||||||
|
}
|
||||||
|
table.append(tbody);
|
||||||
|
$('#card-races').find('.content').append(table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wettfahrten / Racetimes
|
||||||
|
if ('racetimes' in facts) {
|
||||||
|
$('#card-races').show();
|
||||||
|
var table = $('<table class="table table-striped table-bordered mb-0 text-nowrap">');
|
||||||
|
var tbody = $('<tbody>');
|
||||||
|
if ('sollzeit' in facts.racetimes) {
|
||||||
|
tbody.append('<tr><td>Sollzeit</td><td>' + facts.racetimes.sollzeit + ' min</td></tr>');
|
||||||
|
}
|
||||||
|
if ('zeitlimit' in facts.racetimes) {
|
||||||
|
tbody.append('<tr><td>Zeitlimit</td><td>' + facts.racetimes.zeitlimit + ' min</td></tr>');
|
||||||
|
}
|
||||||
|
if ('zielzeitfenster' in facts.racetimes) {
|
||||||
|
tbody.append('<tr><td>Zielzeitfenster</td><td>' + facts.racetimes.zielzeitfenster + ' min</td></tr>');
|
||||||
|
}
|
||||||
|
table.append(tbody);
|
||||||
|
$('#card-races').find('.content').append(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zeitplan
|
||||||
|
if ('times' in facts) {
|
||||||
|
$('#card-times').show();
|
||||||
|
var tbody = $('#card-times').find('table').find('tbody');
|
||||||
|
tbody.html('');
|
||||||
|
if ('checkin' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Registrierung</td></tr>');
|
||||||
|
for (var day in facts.times.checkin) {
|
||||||
|
var times = facts.times.checkin[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
var content = '';
|
||||||
|
if ('from' in times && 'to' in times) content = times.from + ' bis ' + times.to; // TODO:
|
||||||
|
else if ('from' in times) content = 'ab ' + times.from;
|
||||||
|
else if ('to' in times) content = 'bis ' + times.to;
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + content + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('measurements' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Vermessung</td></tr>');
|
||||||
|
for (var day in facts.times.measurements) {
|
||||||
|
var times = facts.times.measurements[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
var content = '';
|
||||||
|
if ('from' in times && 'to' in times) content = times.from + ' bis ' + times.to; // TODO:
|
||||||
|
else if ('from' in times) content = 'ab ' + times.from;
|
||||||
|
else if ('to' in times) content = 'bis ' + times.to;
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + content + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('helmmeeting' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Steuerleutebesprechung</td></tr>');
|
||||||
|
for (var day in facts.times.helmmeeting) {
|
||||||
|
var time = facts.times.helmmeeting[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('firststart' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Erster Start</td></tr>');
|
||||||
|
for (var day in facts.times.firststart) {
|
||||||
|
var time = facts.times.firststart[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('laststart' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Letzter Start</td></tr>');
|
||||||
|
for (var day in facts.times.laststart) {
|
||||||
|
var time = facts.times.laststart[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Camping
|
||||||
|
if ('camping' in facts) {
|
||||||
|
$('#card-camping').show();
|
||||||
|
$('#card-camping').find('p').remove();
|
||||||
|
if ('tent' in facts.camping) {
|
||||||
|
var content = '';
|
||||||
|
if ('price' in facts.camping.tent && facts.camping.tent.price > 0) {
|
||||||
|
content += 'Zelten möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.price)) + '</b>';
|
||||||
|
}
|
||||||
|
else if ('pricepernight' in facts.camping.tent) {
|
||||||
|
content += 'Zelten möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.pricepernight)) + ' pro Nacht</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Zelten möglich und im Preis enthalten';
|
||||||
|
}
|
||||||
|
if ('electricity' in facts.camping.tent) {
|
||||||
|
content += '<br />';
|
||||||
|
if (facts.camping.tent.electricity > 0) {
|
||||||
|
content += 'Strom: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.electricity)) + '</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Strom inklusive';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
if ('van' in facts.camping) {
|
||||||
|
var content = '';
|
||||||
|
if ('price' in facts.camping.van && facts.camping.van.price > 0) {
|
||||||
|
content += 'Wohnwagen/-mobil möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.price)) + '</b>';
|
||||||
|
}
|
||||||
|
else if ('pricepernight' in facts.camping.van) {
|
||||||
|
content += 'Wohnwagen/-mobil möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.pricepernight)) + ' pro Nacht</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Wohnwagen/-mobil möglich und im Preis enthalten';
|
||||||
|
}
|
||||||
|
if ('electricity' in facts.camping.van) {
|
||||||
|
content += '<br />';
|
||||||
|
if (facts.camping.van.electricity > 0) {
|
||||||
|
content += 'Strom: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.electricity)) + '</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Strom inklusive';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
if ('beds' in facts.camping) {
|
||||||
|
var content = '';
|
||||||
|
if ('price' in facts.camping.beds && facts.camping.beds.price > 0) {
|
||||||
|
content += 'Betten im Clubhaus vorhanden für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.beds.price)) + '</b>';
|
||||||
|
}
|
||||||
|
else if ('pricepernight' in facts.camping.beds) {
|
||||||
|
content += 'Betten im Clubhaus vorhanden für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.beds.pricepernight)) + ' pro Nacht</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Betten im Clubhaus vorhanden und im Preis enthalten';
|
||||||
|
}
|
||||||
|
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
if ('text' in facts.camping) {
|
||||||
|
var p = $('<p>');
|
||||||
|
p.text(facts.camping.text);
|
||||||
|
p.html(p.html().replace(/\n/g, '<br />'));
|
||||||
|
$('#card-camping').find('.content').append(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verpflegung
|
||||||
|
if ('food' in facts) {
|
||||||
|
$('#card-food').show();
|
||||||
|
$('#card-food').find('p').remove();
|
||||||
|
for (var day in facts.food) {
|
||||||
|
var food = facts.food[day];
|
||||||
|
if (day == 'text') {
|
||||||
|
var p = $('<p>');
|
||||||
|
p.text(food);
|
||||||
|
p.html(p.html().replace(/\n/g, '<br />'));
|
||||||
|
$('#card-food').find('.content').append(p);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
var content = '';
|
||||||
|
if ('breakfast' in food) {
|
||||||
|
content += 'Frühstück am ' + day;
|
||||||
|
if (food.breakfast > 0) content += ' für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(food.breakfast)) + '</b><br />';
|
||||||
|
else content += ' inklusive<br />';
|
||||||
|
}
|
||||||
|
if ('dinner' in food) {
|
||||||
|
content += 'Abendessen';
|
||||||
|
if ('dinnerdesc' in food) content += ' (' + food.dinnerdesc + ')';
|
||||||
|
content += ' am ' + day;
|
||||||
|
if (food.dinner > 0) content += ' für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(food.dinner)) + '</b><br />';
|
||||||
|
else content += ' inklusive<br />';
|
||||||
|
}
|
||||||
|
$('#card-food').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weitere Informationen
|
||||||
|
if ('text' in facts) {
|
||||||
|
$('#card-text').show();
|
||||||
|
var p = $('#card-text').find('p');
|
||||||
|
p.text(facts.text);
|
||||||
|
p.html(p.html().replace(/\n/g, '<br />'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#card-nofactsinfo').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
Element.prototype.documentOffsetTop = function() {
|
||||||
|
return this.offsetTop + (this.offsetParent ? this.offsetParent.documentOffsetTop() : 0);
|
||||||
|
};
|
||||||
|
function scrollToToday() {
|
||||||
|
window.scrollTo({ top: document.getElementById('div-today').documentOffsetTop() - (window.innerHeight / 2), behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
|
||||||
function selectChange(callSiteScript = true) {
|
function selectChange(callSiteScript = true) {
|
||||||
var val = $('#select-year').val();
|
var val = $('#select-year').val();
|
||||||
if (val == "user") {
|
if (val == "user") {
|
||||||
@@ -60,7 +67,7 @@ async function drawList () {
|
|||||||
var list = '';
|
var list = '';
|
||||||
rows.forEach(function (entry) {
|
rows.forEach(function (entry) {
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
list += '<div><div align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
list += '<div><div id="div-today" align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
||||||
} else if (search($('#input-search').val(), entry.keywords)) {
|
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||||
list += entry.content;
|
list += entry.content;
|
||||||
}
|
}
|
||||||
@@ -76,6 +83,7 @@ var siteScript = async function() {
|
|||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
$('#button-show').click(buttonShowPressed);
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
|
$('#button-totoday').click(scrollToToday);
|
||||||
}
|
}
|
||||||
|
|
||||||
today = getToday();
|
today = getToday();
|
||||||
@@ -84,6 +92,9 @@ var siteScript = async function() {
|
|||||||
var maxDate = parseDate($('#input-to').val());
|
var maxDate = parseDate($('#input-to').val());
|
||||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
|
|
||||||
|
if (minDate <= today && maxDate >= today) $('#button-totoday').parent().parent().show();
|
||||||
|
else $('#button-totoday').parent().parent().hide();
|
||||||
|
|
||||||
var selectedYear = $('#select-year').val();
|
var selectedYear = $('#select-year').val();
|
||||||
|
|
||||||
var years = await dbGetData('years');
|
var years = await dbGetData('years');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.11.6');
|
define('PWA_VERSION', '1.12.1h3');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user