updated header, footer and feed js
All checks were successful
publish / publish (push) Successful in 23s
All checks were successful
publish / publish (push) Successful in 23s
This commit is contained in:
parent
e76e021d97
commit
9b3a38fa16
4 changed files with 82 additions and 49 deletions
|
@ -1,5 +1,3 @@
|
||||||
// noinspection JSUnresolvedReference
|
|
||||||
|
|
||||||
/* ========================
|
/* ========================
|
||||||
Darkmode
|
Darkmode
|
||||||
======================== */
|
======================== */
|
||||||
|
@ -62,6 +60,8 @@ window.toggleDetails = function (element) {
|
||||||
/* ========================
|
/* ========================
|
||||||
News Feed
|
News Feed
|
||||||
======================== */
|
======================== */
|
||||||
|
let lastColumnCount = null;
|
||||||
|
|
||||||
function renderFeedEntries(data) {
|
function renderFeedEntries(data) {
|
||||||
const container = document.getElementById('feed');
|
const container = document.getElementById('feed');
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
@ -71,6 +71,7 @@ function renderFeedEntries(data) {
|
||||||
if (isInFeedSection) {
|
if (isInFeedSection) {
|
||||||
const computedStyle = window.getComputedStyle(container);
|
const computedStyle = window.getComputedStyle(container);
|
||||||
const columnCount = computedStyle.getPropertyValue('grid-template-columns').split(' ').length;
|
const columnCount = computedStyle.getPropertyValue('grid-template-columns').split(' ').length;
|
||||||
|
lastColumnCount = columnCount;
|
||||||
maxItems = columnCount === 3 ? 3 : 4;
|
maxItems = columnCount === 3 ? 3 : 4;
|
||||||
} else {
|
} else {
|
||||||
maxItems = data.items.length;
|
maxItems = data.items.length;
|
||||||
|
@ -119,6 +120,14 @@ fetch('https://api.rss2json.com/v1/api.json?rss_url=https://toot.kif.rocks/@ifsr
|
||||||
.then(data => {
|
.then(data => {
|
||||||
renderFeedEntries(data);
|
renderFeedEntries(data);
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
renderFeedEntries(data);
|
const container = document.getElementById('feed');
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
const computedStyle = window.getComputedStyle(container);
|
||||||
|
const columnCount = computedStyle.getPropertyValue('grid-template-columns').split(' ').length;
|
||||||
|
|
||||||
|
if (columnCount !== lastColumnCount) {
|
||||||
|
renderFeedEntries(data);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,36 +1,55 @@
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container text-center">
|
<div class="container text-center">
|
||||||
{{ if eq .Site.Language.Lang "de" }}
|
<p>
|
||||||
<p>© 2025 iFSR. Alle Rechte vorbehalten.</p>
|
{{ if eq .Site.Language.Lang "de" }}
|
||||||
<nav class="footer-nav">
|
© 2025 iFSR. Alle Rechte vorbehalten.
|
||||||
<ul>
|
{{ else }}
|
||||||
<li><a href="/barrierefreiheit">Barrierefreiheit</a></li>
|
© 2025 iFSR. All rights reserved.
|
||||||
<li><a href="/datenschutz">Datenschutz</a></li>
|
{{ end }}
|
||||||
<li><a href="/impressum">Impressum</a></li>
|
</p>
|
||||||
</ul>
|
<nav class="footer-nav">
|
||||||
<hr>
|
<ul>
|
||||||
<ul>
|
<li>
|
||||||
<li><a href="/de" onclick="localStorage.setItem('language', 'de');">Deutsch</a></li>
|
<a href="{{ if eq .Site.Language.Lang "de" }}/barrierefreiheit{{ else }}/en/barrierefreiheit{{ end }}">
|
||||||
<li>|</li>
|
{{ if eq .Site.Language.Lang "de" }}Barrierefreiheit{{ else }}Accessibility{{ end }}
|
||||||
<li><a href="/en" onclick="localStorage.setItem('language', 'en');">English</a></li>
|
</a>
|
||||||
</ul>
|
</li>
|
||||||
</nav>
|
<li>
|
||||||
{{ else }}
|
<a href="{{ if eq .Site.Language.Lang "de" }}/datenschutz{{ else }}/en/datenschutz{{ end }}">
|
||||||
<p>© 2025 iFSR. All rights reserved.</p>
|
{{ if eq .Site.Language.Lang "de" }}Datenschutz{{ else }}Privacy{{ end }}
|
||||||
<nav class="footer-nav">
|
</a>
|
||||||
<ul>
|
</li>
|
||||||
<li><a href="/en/barrierefreiheit">Accessibility</a></li>
|
<li>
|
||||||
<li><a href="/en/datenschutz">Privacy</a></li>
|
<a href="{{ if eq .Site.Language.Lang "de" }}/impressum{{ else }}/en/impressum{{ end }}">
|
||||||
<li><a href="/en/impressum">Legal Notice</a></li>
|
{{ if eq .Site.Language.Lang "de" }}Impressum{{ else }}Legal Notice{{ end }}
|
||||||
</ul>
|
</a>
|
||||||
<hr>
|
</li>
|
||||||
<ul>
|
</ul>
|
||||||
<li><a href="/de" onclick="localStorage.setItem('language', 'de');">German</a></li>
|
<hr>
|
||||||
<li>|</li>
|
<ul>
|
||||||
<li><a href="/en" onclick="localStorage.setItem('language', 'en');">English</a></li>
|
<li>
|
||||||
</ul>
|
<a href="#" id="lang-de-link">
|
||||||
</nav>
|
{{ if eq .Site.Language.Lang "de" }}Deutsch{{ else }}German{{ end }}
|
||||||
{{ end }}
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>|</li>
|
||||||
|
<li>
|
||||||
|
<a href="#" id="lang-en-link">English</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
document.getElementById('lang-en-link').addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
localStorage.setItem('language', 'en');
|
||||||
|
window.location.pathname = '/en' + window.location.pathname.replace(/^\/(de|en)/, '');
|
||||||
|
});
|
||||||
|
document.getElementById('lang-de-link').addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
localStorage.setItem('language', 'de');
|
||||||
|
window.location.pathname = '/' + window.location.pathname.replace(/^\/(de|en)/, '');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</footer>
|
</footer>
|
|
@ -3,10 +3,12 @@
|
||||||
<meta name="description"
|
<meta name="description"
|
||||||
content="Offizielle Website des iFSR – Informationen, Veranstaltungen und Ressourcen für Studierende der Informatik an der TU Dresden.">
|
content="Offizielle Website des iFSR – Informationen, Veranstaltungen und Ressourcen für Studierende der Informatik an der TU Dresden.">
|
||||||
<link rel="icon" href="{{ "favicon.ico" | relURL }}" type="image/x-icon">
|
<link rel="icon" href="{{ "favicon.ico" | relURL }}" type="image/x-icon">
|
||||||
|
|
||||||
<!-- SVG Preload -->
|
<!-- SVG Preload -->
|
||||||
<link rel="preload" href="/images/logo.svg" as="image" type="image/svg+xml">
|
<link rel="preload" href="/images/logo.svg" as="image" type="image/svg+xml">
|
||||||
<link rel="preload" href="/icons/dark.svg" as="image" type="image/svg+xml">
|
<link rel="preload" href="/icons/dark.svg" as="image" type="image/svg+xml">
|
||||||
<link rel="preload" href="/icons/light.svg" as="image" type="image/svg+xml">
|
<link rel="preload" href="/icons/light.svg" as="image" type="image/svg+xml">
|
||||||
|
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
<link
|
<link
|
||||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||||
|
@ -14,16 +16,34 @@
|
||||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Bootstrap JS -->
|
<!-- Bootstrap JS -->
|
||||||
<script
|
<script
|
||||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
||||||
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
|
|
||||||
<!-- Exo 2 Font -->
|
<!-- Exo 2 Font -->
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600&display=swap" rel="stylesheet"/>
|
<link href="https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600&display=swap" rel="stylesheet"/>
|
||||||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||||
|
|
||||||
|
<!-- Darkmode JS -->
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
try {
|
||||||
|
const stored = localStorage.getItem("theme");
|
||||||
|
const systemPrefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||||
|
const isDark = stored ? stored === "dark" : systemPrefersDark;
|
||||||
|
if (isDark) {
|
||||||
|
document.documentElement.classList.add("dark");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore errors
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- JS Partials -->
|
<!-- JS Partials -->
|
||||||
{{ partial "scripts.html" . }}
|
{{ partial "scripts.html" . }}
|
||||||
{{ partial "event-calendar.html" . }}
|
{{ partial "event-calendar.html" . }}
|
||||||
|
|
|
@ -1,18 +1,3 @@
|
||||||
<!-- Darkmode JS -->
|
|
||||||
<script>
|
|
||||||
(function () {
|
|
||||||
try {
|
|
||||||
const stored = localStorage.getItem("theme");
|
|
||||||
const systemPrefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
||||||
const isDark = stored ? stored === "dark" : systemPrefersDark;
|
|
||||||
if (isDark) {
|
|
||||||
document.documentElement.classList.add("dark");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// ignore errors
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<!-- Localization Auto Redirect -->
|
<!-- Localization Auto Redirect -->
|
||||||
{{ if .IsHome }}
|
{{ if .IsHome }}
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue