Event Calendar styling and bugfixes
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
79e88ec9c2
commit
88699813fd
5 changed files with 107 additions and 35 deletions
|
@ -40,42 +40,49 @@
|
|||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||
|
||||
<!-- Event Calendar -->
|
||||
<link href='https://cdn.jsdelivr.net/npm/fullcalendar@5/main.min.css' rel='stylesheet'/>
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@5/main.min.js'></script>
|
||||
<script src='https://cdn.jsdelivr.net/npm/ical.js@1.4.0/build/ical.min.js'></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
const calendarEl = document.getElementById('calendar');
|
||||
const calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
initialView: 'dayGridMonth'
|
||||
});
|
||||
calendar.render();
|
||||
|
||||
try {
|
||||
const response = await fetch('https://nc.ifsr.de/remote.php/dav/public-calendars/W5Sk7zLD28n6ze44/?export');
|
||||
const icsData = await response.text();
|
||||
|
||||
const jcalData = ICAL.parse(icsData);
|
||||
const comp = new ICAL.Component(jcalData);
|
||||
const events = comp.getAllSubcomponents('vevent');
|
||||
|
||||
const fcEvents = events.map(event => {
|
||||
const icalEvent = new ICAL.Event(event);
|
||||
return {
|
||||
title: icalEvent.summary,
|
||||
start: icalEvent.startDate.toJSDate(),
|
||||
end: icalEvent.endDate.toJSDate(),
|
||||
description: icalEvent.description
|
||||
};
|
||||
{{ if eq .RelPermalink "/events/" }}
|
||||
<link href='https://cdn.jsdelivr.net/npm/fullcalendar@5/main.min.css' rel='stylesheet'/>
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@5/main.min.js'></script>
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@5/locales/de.js'></script>
|
||||
<script src='https://cdn.jsdelivr.net/npm/ical.js@1.4.0/build/ical.min.js'></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
const calendarEl = document.getElementById('calendar');
|
||||
const calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
initialView: 'dayGridMonth',
|
||||
dayMaxEventRows: true,
|
||||
height: 'auto',
|
||||
locale: 'de',
|
||||
firstDay: 1
|
||||
});
|
||||
calendar.render();
|
||||
|
||||
calendar.addEventSource(fcEvents);
|
||||
try {
|
||||
const response = await fetch('https://nc.ifsr.de/remote.php/dav/public-calendars/W5Sk7zLD28n6ze44/?export');
|
||||
const icsData = await response.text();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Laden oder Parsen der ICS-Datei:', error);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
const jcalData = ICAL.parse(icsData);
|
||||
const comp = new ICAL.Component(jcalData, null);
|
||||
const events = comp.getAllSubcomponents('vevent');
|
||||
|
||||
const fcEvents = events.map(event => {
|
||||
const icalEvent = new ICAL.Event(event);
|
||||
return {
|
||||
title: icalEvent.summary,
|
||||
start: icalEvent.startDate.toJSDate(),
|
||||
end: icalEvent.endDate.toJSDate(),
|
||||
description: icalEvent.description
|
||||
};
|
||||
});
|
||||
|
||||
calendar.addEventSource(fcEvents);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Laden oder Parsen der ICS-Datei:', error);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
{{ partialCached "head/css.html" . }}
|
||||
{{ partialCached "head/js.html" . }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{ define "main" }}
|
||||
<div class="container">
|
||||
<div id="markdown">
|
||||
<div id="markdown" class="title-center">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div id='calendar'></div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{ define "main" }}
|
||||
<div class="container">
|
||||
<div id="markdown">
|
||||
<div id="markdown" class="title-center">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div id="feed" class="page"></div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue