Merge branch 'release/v_1.8'
This commit is contained in:
@@ -508,6 +508,9 @@ function sync() {
|
|||||||
$('#i-sync').removeClass('fa-spin');
|
$('#i-sync').removeClass('fa-spin');
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
if (typeof onAfterSync === 'function') {
|
||||||
|
onAfterSync();
|
||||||
|
}
|
||||||
runPageScript();
|
runPageScript();
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -1033,8 +1036,7 @@ function initDatabase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetDb(silent = true) {
|
function resetDb() {
|
||||||
$('#menu-developer').hideMenu();
|
|
||||||
if (canUseLocalDB) {
|
if (canUseLocalDB) {
|
||||||
showLoader();
|
showLoader();
|
||||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||||
@@ -1051,11 +1053,6 @@ function resetDb(silent = true) {
|
|||||||
osUpdateTimes.put({ table: 'news', time: 0 });
|
osUpdateTimes.put({ table: 'news', time: 0 });
|
||||||
osUpdateTimes.put({ table: 'users', time: 0 });
|
osUpdateTimes.put({ table: 'users', time: 0 });
|
||||||
console.log('DB update times reset');
|
console.log('DB update times reset');
|
||||||
if (!silent)
|
|
||||||
toastInfo('The database was reset. Please reload or close this tab.<br>At the next visit, a full sync will be performed.');
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
} else {
|
|
||||||
if (!silent)
|
|
||||||
toastWarn('Your device does not support storing data locally. All data is fetched directly from our server.<br>As a result, you can not reset your database.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ var mobileConsole = (function () {
|
|||||||
top: 'auto',
|
top: 'auto',
|
||||||
right: 0,
|
right: 0,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
zIndex: 10000,
|
zIndex: 1000000,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
paddingBottom: options.browserinfo.isMobile ? '35px' : '25px',
|
paddingBottom: options.browserinfo.isMobile ? '35px' : '25px',
|
||||||
margin: 0,
|
margin: 0,
|
||||||
@@ -662,7 +662,7 @@ var mobileConsole = (function () {
|
|||||||
height: newHeight
|
height: newHeight
|
||||||
});
|
});
|
||||||
setCSS(document.body, {
|
setCSS(document.body, {
|
||||||
paddingBottom: existingPadding + Math.abs(parseInt(newHeight, 10) + elements.topbar.offsetHeight) + 'px'
|
//paddingBottom: existingPadding + Math.abs(parseInt(newHeight, 10) + elements.topbar.offsetHeight) + 'px'
|
||||||
});
|
});
|
||||||
elements.buttons.toggler.innerHTML = (elements.base.minimized) ? elements.arrowDown : elements.arrowUp;
|
elements.buttons.toggler.innerHTML = (elements.base.minimized) ? elements.arrowDown : elements.arrowUp;
|
||||||
elements.buttons.toggler.setAttribute('title', (elements.base.minimized) ? 'Minimize console' : 'Maximize console');
|
elements.buttons.toggler.setAttribute('title', (elements.base.minimized) ? 'Minimize console' : 'Maximize console');
|
||||||
@@ -747,7 +747,7 @@ var mobileConsole = (function () {
|
|||||||
});
|
});
|
||||||
var existingPadding = isNaN(parseInt(document.body.style.paddingBottom, 10)) ? 0 : parseInt(document.body.style.paddingBottom, 10);
|
var existingPadding = isNaN(parseInt(document.body.style.paddingBottom, 10)) ? 0 : parseInt(document.body.style.paddingBottom, 10);
|
||||||
setCSS(document.body, {
|
setCSS(document.body, {
|
||||||
paddingBottom: existingPadding + Math.abs(console.offsetHeight + elements.topbar.offsetHeight) + 'px'
|
//paddingBottom: existingPadding + Math.abs(console.offsetHeight + elements.topbar.offsetHeight) + 'px'
|
||||||
});
|
});
|
||||||
elements.scrollcontainer.scrollTop = elements.scrollcontainer.scrollHeight;
|
elements.scrollcontainer.scrollTop = elements.scrollcontainer.scrollHeight;
|
||||||
|
|
||||||
@@ -914,6 +914,7 @@ var mobileConsole = (function () {
|
|||||||
while (i--) {
|
while (i--) {
|
||||||
thisLine = lines[i].trim();
|
thisLine = lines[i].trim();
|
||||||
lineAndColumn = thisLine.match(/(?::)(\d+)(?::)(\d+)/);
|
lineAndColumn = thisLine.match(/(?::)(\d+)(?::)(\d+)/);
|
||||||
|
if (lineAndColumn === null) continue;
|
||||||
url = urlFromString(thisLine).replace(lineAndColumn[0], '').split('#')[0] || '';
|
url = urlFromString(thisLine).replace(lineAndColumn[0], '').split('#')[0] || '';
|
||||||
caller = htmlToString(thisLine.replace(urlFromString(thisLine), '').replace(separator, '').replace('at ', '').trim());
|
caller = htmlToString(thisLine.replace(urlFromString(thisLine), '').replace(separator, '').replace('at ', '').trim());
|
||||||
if (caller === '' || caller === lineAndColumn[0]) { continue; }
|
if (caller === '' || caller === lineAndColumn[0]) { continue; }
|
||||||
|
|||||||
@@ -122,8 +122,8 @@ var login = function() {
|
|||||||
showLoader();
|
showLoader();
|
||||||
var username = $('#input-login-username').val();
|
var username = $('#input-login-username').val();
|
||||||
var password = $('#input-login-password').val();
|
var password = $('#input-login-password').val();
|
||||||
$('#input-login-username').val('');
|
$('#input-login-username').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-login-password').val('');
|
$('#input-login-password').val('').trigger('focusin').trigger('focusout');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: QUERY_URL + 'login',
|
url: QUERY_URL + 'login',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -135,7 +135,7 @@ var login = function() {
|
|||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
if (xhr.status == 401) {
|
if (xhr.status == 401) {
|
||||||
toastError('Benutzername oder Passwort falsch');
|
toastError('Benutzername oder Passwort falsch');
|
||||||
$('#input-login-username').val(username);
|
$('#input-login-username').val(username).trigger('focusin').trigger('focusout');
|
||||||
} else if (xhr.status == 0) {
|
} else if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
||||||
$('#menu-login').hideMenu();
|
$('#menu-login').hideMenu();
|
||||||
@@ -203,7 +203,28 @@ var logout = function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCache() {
|
function deleteDb() {
|
||||||
|
$('#menu-developer').hideMenu();
|
||||||
|
if (canUseLocalDB) {
|
||||||
|
showLoader();
|
||||||
|
var request = window.indexedDB.deleteDatabase('regatten_app_db_' + BOATCLASS);
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('Cannot delete DB: ', event.target.errorCode);
|
||||||
|
toastError('Beim Löschen der Datenbank ist ein Fehler aufgetreten.<br>Bitte melde diesen Fehler. (Dev-Menu => Problem melden)', 5000);
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
console.log('DB deleted');
|
||||||
|
toastInfo('Die Datenbank wurde gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit eine neue Datenbank.', 10000);
|
||||||
|
hideLoader();
|
||||||
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toastWarn('Dein Gerät unterstützt kein lokales Speichern der Daten. Alle Daten werden direkt vom Server gezogen.<br>Entsprechend kannst Du die Datenbank auch nicht zurücksetzen.', 10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteCache() {
|
||||||
$('#menu-developer').hideMenu();
|
$('#menu-developer').hideMenu();
|
||||||
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||||
for (let registration of registrations) {
|
for (let registration of registrations) {
|
||||||
@@ -217,7 +238,8 @@ function resetCache() {
|
|||||||
return caches.delete(key);
|
return caches.delete(key);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
toastInfo('The serviceWorker and the cache were deleted. A new serviceWorker will be generated on the next refresh.');
|
toastInfo('Der serviceWorker und alle Caches wurden gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit neue Caches.', 10000);
|
||||||
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pushesPossible = false;
|
var pushesPossible = false;
|
||||||
@@ -320,10 +342,16 @@ async function updatePushSwitches() {
|
|||||||
|
|
||||||
if ($('#switch-pushes').prop('checked')) {
|
if ($('#switch-pushes').prop('checked')) {
|
||||||
$('#p-pushes-info').show();
|
$('#p-pushes-info').show();
|
||||||
$('.a-switch-pushes-channel').show();
|
$('.a-switch-pushes-channel-all').show();
|
||||||
|
$('.a-switch-pushes-channel-my').show();
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
$('.a-switch-pushes-channel-my').find('div').remove();
|
||||||
|
$('.a-switch-pushes-channel-my').find('.badge').text('nicht angemeldet');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#p-pushes-info').hide();
|
$('#p-pushes-info').hide();
|
||||||
$('.a-switch-pushes-channel').hide();
|
$('.a-switch-pushes-channel-all').hide();
|
||||||
|
$('.a-switch-pushes-channel-my').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,6 +408,22 @@ function updatePushBadge() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateNewsBadge() {
|
||||||
|
var newsRead = await dbSettingsGet('news_read_' + BOATCLASS);
|
||||||
|
if (newsRead === null) dbSettingsSet('news_read_' + BOATCLASS, newsRead = new Date());
|
||||||
|
var news = await dbGetData('news');
|
||||||
|
var now = new Date();
|
||||||
|
var sum = 0;
|
||||||
|
for (var n in news) {
|
||||||
|
var newsEntry = news[n];
|
||||||
|
newsEntry.date = new Date(Date.parse(newsEntry.date));
|
||||||
|
if (newsEntry.date > now) continue;
|
||||||
|
if (newsEntry.date < newsRead) continue;
|
||||||
|
sum ++;
|
||||||
|
}
|
||||||
|
updateBadge('more/news', sum);
|
||||||
|
}
|
||||||
|
|
||||||
var initRegatten = function() {
|
var initRegatten = function() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
||||||
@@ -399,7 +443,8 @@ var initRegatten = function() {
|
|||||||
|
|
||||||
// Pushes
|
// Pushes
|
||||||
$('#a-switch-pushes').click(pushesSubscribeClicked);
|
$('#a-switch-pushes').click(pushesSubscribeClicked);
|
||||||
$('.a-switch-pushes-channel').click(pushesChannelClicked);
|
$('.a-switch-pushes-channel-all').click(pushesChannelClicked);
|
||||||
|
$('.a-switch-pushes-channel-my').click(pushesChannelClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
var onServiceWorkerLoaded = function() {
|
var onServiceWorkerLoaded = function() {
|
||||||
@@ -414,4 +459,32 @@ var onServiceWorkerLoaded = function() {
|
|||||||
var onDatabaseLoaded = function() {
|
var onDatabaseLoaded = function() {
|
||||||
onServiceWorkerLoaded();
|
onServiceWorkerLoaded();
|
||||||
initPushSettings();
|
initPushSettings();
|
||||||
|
|
||||||
|
updateNewsBadge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var onAfterSync = function() {
|
||||||
|
updateNewsBadge();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add console opener to preloader
|
||||||
|
var addConsoleOpenerToPreloader = function() {
|
||||||
|
addConsoleOpenerToPreloader = function(){};
|
||||||
|
var preloader = document.getElementById('preloader');
|
||||||
|
var button = document.createElement('a');
|
||||||
|
button.href = '#';
|
||||||
|
button.classList = 'btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight m-3';
|
||||||
|
button.style.position = 'fixed';
|
||||||
|
button.style.bottom = 0;
|
||||||
|
button.style.left = 0;
|
||||||
|
button.style.right = 0;
|
||||||
|
button.innerHTML = 'Show Console';
|
||||||
|
button.onclick = function(){
|
||||||
|
mobileConsole.displayConsole();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
setTimeout(function(){
|
||||||
|
preloader.appendChild(button);
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
addConsoleOpenerToPreloader();
|
||||||
|
|||||||
@@ -154,7 +154,7 @@
|
|||||||
(meine) bezieht sich auf die Regatten, die in Deiner Saison-Planung sind,<br>
|
(meine) bezieht sich auf die Regatten, die in Deiner Saison-Planung sind,<br>
|
||||||
(alle) informiert Dich über alle Regatten
|
(alle) informiert Dich über alle Regatten
|
||||||
</p>
|
</p>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-news" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-news" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-newspaper rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-newspaper rounded-s bg-highlight color-white"></i>
|
||||||
<span>Neuigkeiten</span>
|
<span>Neuigkeiten</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -162,15 +162,16 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-news"></label>
|
<label class="custom-control-label" for="switch-pushes-news"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-my" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-my" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
||||||
<span>Regatta verschoben (meine)</span>
|
<span>Regatta verschoben (meine)</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-regatta-changed-my">
|
<input type="checkbox" class="ios-input" id="switch-pushes-regatta-changed-my">
|
||||||
<label class="custom-control-label" for="switch-pushes-regatta-changed-my"></label>
|
<label class="custom-control-label" for="switch-pushes-regatta-changed-my"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-all" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-all" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
||||||
<span>Regatta verschoben (alle)</span>
|
<span>Regatta verschoben (alle)</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -178,15 +179,16 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-regatta-changed-all"></label>
|
<label class="custom-control-label" for="switch-pushes-regatta-changed-all"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-result-ready-my" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-result-ready-my" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
||||||
<span>Ergebnisse verfügbar (meine)</span>
|
<span>Ergebnisse verfügbar (meine)</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-result-ready-my">
|
<input type="checkbox" class="ios-input" id="switch-pushes-result-ready-my">
|
||||||
<label class="custom-control-label" for="switch-pushes-result-ready-my"></label>
|
<label class="custom-control-label" for="switch-pushes-result-ready-my"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-result-ready-all" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-result-ready-all" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
||||||
<span>Ergebnisse verfügbar (alle)</span>
|
<span>Ergebnisse verfügbar (alle)</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -194,9 +196,10 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-result-ready-all"></label>
|
<label class="custom-control-label" for="switch-pushes-result-ready-all"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-meldeschluss" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-meldeschluss" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-file-signature rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-file-signature rounded-s bg-highlight color-white"></i>
|
||||||
<span>Melde-Erinnerungen</span>
|
<span>Melde-Erinnerungen</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-meldeschluss">
|
<input type="checkbox" class="ios-input" id="switch-pushes-meldeschluss">
|
||||||
<label class="custom-control-label" for="switch-pushes-meldeschluss"></label>
|
<label class="custom-control-label" for="switch-pushes-meldeschluss"></label>
|
||||||
@@ -211,22 +214,22 @@
|
|||||||
<div class="divider divider-margins mb-n2"></div>
|
<div class="divider divider-margins mb-n2"></div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="list-group list-custom-small">
|
<div class="list-group list-custom-small">
|
||||||
<a href="https://info.ostertun.net/regatten/beta">
|
<a href="https://github.com/ostertun/RegattenApp/wiki">
|
||||||
<i class="fa font-14 fa-info rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-info rounded-s bg-highlight color-white"></i>
|
||||||
<span>Infos zur BETA</span>
|
<span>App-Wiki</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="javascript:resetDb(false);">
|
<a href="javascript:deleteDb();">
|
||||||
<i class="fa font-14 fa-database rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-database rounded-s bg-highlight color-white"></i>
|
||||||
<span>Reset Database</span>
|
<span>Reset Database</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="javascript:resetCache();">
|
<a href="javascript:deleteCache();">
|
||||||
<i class="fa font-14 fa-trash-alt rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-trash-alt rounded-s bg-highlight color-white"></i>
|
||||||
<span>Reset Cache</span>
|
<span>Reset Cache</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://report.regatten.net/">
|
<a href="https://github.com/ostertun/RegattenApp/issues">
|
||||||
<i class="fa font-14 fa-bug rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-bug rounded-s bg-highlight color-white"></i>
|
||||||
<span>Problem melden</span>
|
<span>Problem melden</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ function addRace() {
|
|||||||
rlp: (100 * rlf * ((fb + 1 - pl) / fb))
|
rlp: (100 * rlf * ((fb + 1 - pl) / fb))
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#input-rlf').val('');
|
$('#input-rlf').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-m').val('');
|
$('#input-m').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-fb').val('');
|
$('#input-fb').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-pl').val('');
|
$('#input-pl').val('').trigger('focusin').trigger('focusout');
|
||||||
|
|
||||||
races.push(race);
|
races.push(race);
|
||||||
reCalc();
|
reCalc();
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ function sendMessage() {
|
|||||||
},
|
},
|
||||||
success: function (data, status, xhr) {
|
success: function (data, status, xhr) {
|
||||||
toastOk('Nachricht erfolgreich versandt!');
|
toastOk('Nachricht erfolgreich versandt!');
|
||||||
$('#input-subject').val('');
|
$('#input-subject').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-message').val('');
|
$('#input-message').val('').trigger('focusin').trigger('focusout');
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ async function onNewsClicked(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addCard(newsEntry) {
|
function addCard(newsEntry) {
|
||||||
console.log(newsEntry);
|
|
||||||
var content = '<h2>' + newsEntry.title + '</h2>';
|
var content = '<h2>' + newsEntry.title + '</h2>';
|
||||||
content += '<p class="mb-2"><i>' + formatDate('d.m.Y', newsEntry.date) + '</i></p>';
|
content += '<p class="mb-2"><i>' + formatDate('d.m.Y', newsEntry.date) + '</i></p>';
|
||||||
content += '<p class="mb-0">' + newsEntry.description.replace('\n', '<br>') + '</p>';
|
content += '<p class="mb-0">' + newsEntry.description.replace('\n', '<br>') + '</p>';
|
||||||
@@ -29,16 +28,17 @@ var siteScript = async function() {
|
|||||||
news.sort(function (a,b) {
|
news.sort(function (a,b) {
|
||||||
return b.date.localeCompare(a.date);
|
return b.date.localeCompare(a.date);
|
||||||
});
|
});
|
||||||
var today = getToday();
|
var now = new Date();
|
||||||
var lastYear = new Date(today);
|
var lastYear = new Date();
|
||||||
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
||||||
console.log(today, lastYear);
|
|
||||||
for (var n in news) {
|
for (var n in news) {
|
||||||
var newsEntry = news[n];
|
var newsEntry = news[n];
|
||||||
newsEntry.date = parseDate(newsEntry.date.substring(0, 10));
|
newsEntry.date = new Date(Date.parse(newsEntry.date));
|
||||||
if (newsEntry.date > today) continue;
|
if (newsEntry.date > now) continue;
|
||||||
if (newsEntry.date < lastYear) break;
|
if (newsEntry.date < lastYear) break;
|
||||||
addCard(newsEntry);
|
addCard(newsEntry);
|
||||||
}
|
}
|
||||||
|
dbSettingsSet('news_read_' + BOATCLASS, now);
|
||||||
|
updateNewsBadge();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
@@ -111,8 +111,8 @@ async function selectChange(callSiteScript = true) {
|
|||||||
var year = parseInt($('#select-year').val());
|
var year = parseInt($('#select-year').val());
|
||||||
if (type == "user") {
|
if (type == "user") {
|
||||||
$('#select-year').parent().hide();
|
$('#select-year').parent().hide();
|
||||||
$('#input-from').parent().show();
|
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-to').parent().show();
|
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-jugend').parent().parent().show();
|
$('#input-jugend').parent().parent().show();
|
||||||
$('#input-jugstrict').parent().parent().show();
|
$('#input-jugstrict').parent().parent().show();
|
||||||
$('#button-show').show();
|
$('#button-show').show();
|
||||||
@@ -174,8 +174,20 @@ async function selectChange(callSiteScript = true) {
|
|||||||
$('#input-jugend').prop('checked', jugend);
|
$('#input-jugend').prop('checked', jugend);
|
||||||
$('#input-jugstrict').prop('checked', jugstrict);
|
$('#input-jugstrict').prop('checked', jugstrict);
|
||||||
|
|
||||||
if (callSiteScript && (typeof siteScript === 'function'))
|
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||||
|
history.replaceState(null, '', '?type=' + type + '&year=' + year)
|
||||||
siteScript();
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonShowPressed() {
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
var chboxes = '';
|
||||||
|
if ($('#input-jugend').prop('checked')) chboxes += '&jugend=on'
|
||||||
|
if ($('#input-jugstrict').prop('checked')) chboxes += '&jugstrict=on'
|
||||||
|
history.replaceState(null, '', '?type=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val() + chboxes)
|
||||||
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +202,19 @@ function initSelects() {
|
|||||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
$('#select-year').val(year);
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
if (type == "user") {
|
||||||
|
var from = findGetParameter('from');
|
||||||
|
var to = findGetParameter('to');
|
||||||
|
if (from === null) from = formatDate('Y-m-d')
|
||||||
|
if (to === null) to = formatDate('Y-m-d')
|
||||||
|
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
||||||
|
var jugend = findGetParameter('jugend');
|
||||||
|
var jugstrict = findGetParameter('jugstrict');
|
||||||
|
$('#input-jugend').prop('checked', jugend !== null);
|
||||||
|
$('#input-jugstrict').prop('checked', jugstrict !== null);
|
||||||
|
}
|
||||||
|
|
||||||
selectChange(false);
|
selectChange(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +243,7 @@ var siteScript = async function() {
|
|||||||
initSelects();
|
initSelects();
|
||||||
$('#select-type').change(selectChange);
|
$('#select-type').change(selectChange);
|
||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
$('#button-show').click(siteScript);
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
function selectChange(callSiteScript = true) {
|
function selectChange(callSiteScript = true) {
|
||||||
var val = $('#select-year').val();
|
var val = $('#select-year').val();
|
||||||
if (val == "user") {
|
if (val == "user") {
|
||||||
$('#input-from').parent().show();
|
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-to').parent().show();
|
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#button-show').show();
|
$('#button-show').show();
|
||||||
} else {
|
} else {
|
||||||
$('#input-from').parent().hide();
|
$('#input-from').parent().hide();
|
||||||
@@ -12,8 +12,17 @@ function selectChange(callSiteScript = true) {
|
|||||||
$('#input-from').val(val + '-01-01');
|
$('#input-from').val(val + '-01-01');
|
||||||
$('#input-to').val(val + '-12-31');
|
$('#input-to').val(val + '-12-31');
|
||||||
|
|
||||||
if (callSiteScript && (typeof siteScript === 'function'))
|
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||||
|
history.replaceState(null, '', '?year=' + val);
|
||||||
siteScript();
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonShowPressed() {
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
history.replaceState(null, '', '?year=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val())
|
||||||
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,6 +33,15 @@ function initYear() {
|
|||||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
$('#select-year').val(year);
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
if (year == "user") {
|
||||||
|
var from = findGetParameter('from');
|
||||||
|
var to = findGetParameter('to');
|
||||||
|
if (from === null) from = formatDate('Y-m-d')
|
||||||
|
if (to === null) to = formatDate('Y-m-d')
|
||||||
|
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
||||||
|
}
|
||||||
|
|
||||||
selectChange(false);
|
selectChange(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +68,7 @@ var siteScript = async function() {
|
|||||||
firstCall = false;
|
firstCall = false;
|
||||||
initYear();
|
initYear();
|
||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
$('#button-show').click(siteScript);
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.7');
|
define('PWA_VERSION', '1.8');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user