diff --git a/server/scripts/index.js b/server/scripts/index.js
index 9f27bbe..89709fa 100644
--- a/server/scripts/index.js
+++ b/server/scripts/index.js
@@ -2,12 +2,12 @@ var today;
var siteScript = async function() {
today = getToday();
-
+
if (isLoggedIn()) {
$('#card-notloggedin').hide();
-
+
var user = await dbGetData('users', localStorage.getItem('auth_user'));
-
+
// Favorites
var watched = [];
for (var i = 1; i <= 5; i ++) {
@@ -46,7 +46,7 @@ var siteScript = async function() {
$('#p-favorites').show();
}
$('#card-favorites').show();
-
+
// Your next
var planningsDB = await dbGetDataIndex('plannings', 'user', user.id);
var minDate = getToday();
@@ -75,35 +75,35 @@ var siteScript = async function() {
for (i in plannings) {
var planning = plannings[i];
var regatta = planning.regatta;
-
+
if (regatta['length'] < 1) continue;
-
+
var club = null;
if (regatta['club'] != null)
club = await dbGetData('clubs', regatta['club']);
var dateFrom = regatta['dateFrom'];
var dateTo = regatta['dateTo'];
-
+
// output
-
+
list += '
';
-
+
// ZEILE 1
// Name
list += '
' + (regatta['canceled'] == 1 ? '' : '') + regatta['name'] + (regatta['canceled'] == 1 ? ' ' : '') + '
';
-
+
// ZEILE 2
list += '
';
-
+
// Number
list += '
' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '
';
-
+
// Club
list += '
' + ((club != null) ? club['kurz'] : '') + '
';
-
+
// Special
list += '
' + regatta['special'] + '
';
-
+
// Icons
var icons = [];
if (regatta['info'] != '')
@@ -120,8 +120,10 @@ var siteScript = async function() {
ms = parseDate(regatta['meldungSchluss']);
}
var diff = Math.round((ms - today) / 86400000);
- if ((ms >= today) && (diff < 7)) {
+ if (ms < today) {
color = ' color-red2-dark';
+ } else if (diff < 7) {
+ color = ' color-yellow2-dark';
}
}
}
@@ -134,18 +136,18 @@ var siteScript = async function() {
icons.push('
');
}
list += '
' + icons.join(' ') + '
';
-
+
list += '
';
-
+
// ZEILE 3
list += '
';
-
+
// Date
list += '
' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '
';
-
+
// RLF
list += '
' + parseFloat(regatta['rlf']).toFixed(2) + '
';
-
+
list += '
';
}
$('#div-yournext').html(list);
@@ -161,7 +163,7 @@ var siteScript = async function() {
$('#card-yournext').hide();
$('#card-notloggedin').show();
}
-
+
// Next
var minDate = getToday();
minDate.setDate(minDate.getDate() - 1);
@@ -172,35 +174,35 @@ var siteScript = async function() {
list = '';
for (i in regattas) {
var regatta = regattas[i];
-
+
if (regatta['length'] < 1) continue;
-
+
var club = null;
if (regatta['club'] != null)
club = await dbGetData('clubs', regatta['club']);
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
var dateFrom = regatta['dateFrom'];
var dateTo = regatta['dateTo'];
-
+
// output
list += '';
-
+
// ZEILE 1
// Name
list += '
' + (regatta['canceled'] == 1 ? '' : '') + regatta['name'] + (regatta['canceled'] == 1 ? ' ' : '') + '
';
-
+
// ZEILE 2
list += '
';
-
+
// Number
list += '
' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '
';
-
+
// Club
list += '
' + ((club != null) ? club['kurz'] : '') + '
';
-
+
// Special
list += '
' + regatta['special'] + '
';
-
+
// Icons
var icons = [];
if (regatta['info'] != '')
@@ -227,8 +229,10 @@ var siteScript = async function() {
ms = parseDate(regatta['meldungSchluss']);
}
var diff = Math.round((ms - today) / 86400000);
- if ((ms >= today) && (diff < 7)) {
+ if (ms < today) {
color = ' color-red2-dark';
+ } else if (diff < 7) {
+ color = ' color-yellow2-dark';
}
}
}
@@ -241,18 +245,18 @@ var siteScript = async function() {
icons.push('
');
}
list += '
' + icons.join(' ') + '
';
-
+
list += '
';
-
+
// ZEILE 3
list += '
';
-
+
// Date
list += '
' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '
';
-
+
// RLF
list += '
' + parseFloat(regatta['rlf']).toFixed(2) + '
';
-
+
list += '
';
}
$('#div-next').html(list);
@@ -262,7 +266,7 @@ var siteScript = async function() {
$('#div-next').hide();
$('#p-next').show();
}
-
+
// Last
var minDate = getToday();
minDate.setDate(minDate.getDate() - 14);
@@ -279,35 +283,35 @@ var siteScript = async function() {
list = '';
for (i in regattas) {
var regatta = regattas[i];
-
+
if (regatta['length'] < 1) continue;
-
+
var club = null;
if (regatta['club'] != null)
club = await dbGetData('clubs', regatta['club']);
var dateFrom = regatta['dateFrom'];
var dateTo = regatta['dateTo'];
-
+
// output
-
+
list += '';
-
+
// ZEILE 1
// Name
list += '
' + (regatta['canceled'] == 1 ? '' : '') + regatta['name'] + (regatta['canceled'] == 1 ? ' ' : '') + '
';
-
+
// ZEILE 2
list += '
';
-
+
// Number
list += '
' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '
';
-
+
// Club
list += '
' + ((club != null) ? club['kurz'] : '') + '
';
-
+
// Special
list += '
' + regatta['special'] + '
';
-
+
// Icons
var icons = [];
if (regatta['info'] != '')
@@ -320,18 +324,18 @@ var siteScript = async function() {
icons.push('
');
}
list += '
' + icons.join(' ') + '
';
-
+
list += '
';
-
+
// ZEILE 3
list += '
';
-
+
// Date
list += '
' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '
';
-
+
// RLF
list += '
' + parseFloat(regatta['rlf']).toFixed(2) + '
';
-
+
list += '
';
}
$('#div-last').html(list);
@@ -341,6 +345,6 @@ var siteScript = async function() {
$('#div-last').hide();
$('#p-last').show();
}
-
+
hideLoader();
-}
\ No newline at end of file
+}
diff --git a/server/scripts/regattas.js b/server/scripts/regattas.js
index 6b51e09..ffe2c6b 100644
--- a/server/scripts/regattas.js
+++ b/server/scripts/regattas.js
@@ -8,10 +8,10 @@ function selectChange(callSiteScript = true) {
$('#input-from').parent().hide();
$('#input-to').parent().hide();
$('#button-show').hide();
-
+
$('#input-from').val(val + '-01-01');
$('#input-to').val(val + '-12-31');
-
+
if (callSiteScript && (typeof siteScript === 'function'))
siteScript();
}
@@ -20,10 +20,10 @@ function selectChange(callSiteScript = true) {
function initYear() {
var year = findGetParameter('year');
if (year === null) year = new Date().getFullYear();
-
+
$('#select-year').html('' + year + ' ');
$('#select-year').val(year);
-
+
selectChange(false);
}
@@ -53,9 +53,9 @@ var siteScript = async function() {
$('#button-show').click(siteScript);
$('#input-search').on('input', drawList);
}
-
+
today = getToday();
-
+
var minDate = parseDate($('#input-from').val());
var maxDate = parseDate($('#input-to').val());
var regattas = await dbGetRegattasRange(minDate, maxDate);
@@ -65,9 +65,9 @@ var siteScript = async function() {
var results = await dbGetDataIndex('results', 'regatta', entry['id']);
regattaResults[entry['id']] = (results.length > 0);
}
-
+
var selectedYear = $('#select-year').val();
-
+
var years = await dbGetData('years');
years.sort(function (a, b) {
if (a['year'] > b['year']) return -1;
@@ -81,7 +81,7 @@ var siteScript = async function() {
}
$('#select-year').html(options);
$('#select-year').val(selectedYear);
-
+
var count = regattas.length;
if (count > 0) {
if (count == 1) {
@@ -91,49 +91,49 @@ var siteScript = async function() {
}
$('#div-regattas').show();
$('#input-search').parent().show();
-
+
var heute = false;
-
+
rows = [];
-
+
for (id in regattas) {
var entry = regattas[id];
var club = null;
if (entry['club'] != null)
club = await dbGetData('clubs', entry['club']);
var plannings = await dbGetDataIndex('plannings', 'regatta', entry['id']);
-
+
var dateFrom = entry['dateFrom'];
var dateTo = entry['dateTo'];
-
+
var row = { keywords: [], content: '' };
row.keywords.push(entry['name']);
if (entry['number'] != null) row.keywords.push(entry['number']);
if (club != null) row.keywords.push(club['kurz'], club['name']);
-
+
if (!heute && (today <= dateFrom)) {
rows.push(null);
heute = true;
}
-
+
row.content += '';
-
+
// ZEILE 1
// Name
row.content += '
' + (entry['canceled'] == 1 ? '' : '') + entry['name'] + (entry['canceled'] == 1 ? ' ' : '') + '
';
-
+
// ZEILE 2
row.content += '
';
-
+
// Number
row.content += '
' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '
';
-
+
// Club
row.content += '
' + ((club != null) ? club['kurz'] : '') + '
';
-
+
// Special
row.content += '
' + entry['special'] + '
';
-
+
// Icons
var icons = [];
if (entry['info'] != '')
@@ -160,8 +160,10 @@ var siteScript = async function() {
ms = parseDate(entry['meldungSchluss']);
}
var diff = Math.round((ms - today) / 86400000);
- if ((ms >= today) && (diff < 7)) {
+ if (ms < today) {
color = ' color-red2-dark';
+ } else if (diff < 7) {
+ color = ' color-yellow2-dark';
}
}
}
@@ -178,12 +180,12 @@ var siteScript = async function() {
icons.push('
');
}
row.content += '
' + icons.join(' ') + '
';
-
+
row.content += '
';
-
+
// ZEILE 3
row.content += '
';
-
+
// Date
if (entry['length'] < 1) {
if (formatDate('d.m', dateFrom) == '01.01') {
@@ -194,26 +196,26 @@ var siteScript = async function() {
} else {
row.content += '
' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '
';
}
-
+
// RLF
row.content += '
' + parseFloat(entry['rlf']).toFixed(2) + '
';
-
+
row.content += '
';
-
+
rows.push(row);
}
-
+
if (!heute) {
rows.push(null);
}
-
+
drawList();
-
+
} else {
$('#p-count').html('Keine Regatten gefunden!');
$('#div-regattas').hide();
$('#input-search').parent().hide();
}
-
+
hideLoader();
-}
\ No newline at end of file
+}