diff --git a/server/content/regattas.php b/server/content/regattas.php index 465b908..1950863 100644 --- a/server/content/regattas.php +++ b/server/content/regattas.php @@ -14,6 +14,11 @@ $sp['output'] .= $tpl->load('card', [$content]); + // To today + $content = $tpl->load('button', [' Heute ', '#', 'html-id' => 'button-totoday']); + + $sp['output'] .= $tpl->load('card', [$content]); + // Regattas $content = '
'; $content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']); diff --git a/server/scripts/regattas.js b/server/scripts/regattas.js index 076b786..17adcf0 100644 --- a/server/scripts/regattas.js +++ b/server/scripts/regattas.js @@ -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) { var val = $('#select-year').val(); if (val == "user") { @@ -60,7 +67,7 @@ async function drawList () { var list = ''; rows.forEach(function (entry) { if (entry == null) { - list += '