multiple calendar / display fixes

This commit is contained in:
kleines Filmröllchen 2025-10-12 21:57:06 +02:00
parent 6a9655543a
commit b9c3974070
Signed by: filmroellchen
SSH key fingerprint: SHA256:UMhcHaeI+VGsiUL2Drpw3aj1iRiQUlx8nxZqUPvoaVw
2 changed files with 14 additions and 4 deletions

View file

@ -3,6 +3,9 @@
Modernization by @kleinesfilmroellchen Modernization by @kleinesfilmroellchen
*/ */
const uriRegex =
/(https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/\-_\.\:]*(\?\S+)?)?)?)/gi;
export default function hackcal(e, p = 1) { export default function hackcal(e, p = 1) {
if (!document.getElementById("dbkcalendar")) return; if (!document.getElementById("dbkcalendar")) return;
@ -41,8 +44,10 @@ export default function hackcal(e, p = 1) {
// use description as link on summary if it's a valid URL // use description as link on summary if it's a valid URL
const summaryItem = entryItem.querySelector(".summary"); const summaryItem = entryItem.querySelector(".summary");
const possibleUri = uriRegex.exec(event.description)?.[0];
const cleanedDescription = event.description.replaceAll(uriRegex, "");
try { try {
const descriptionUri = new URL(event.description); const descriptionUri = new URL(possibleUri);
const descriptionLink = document.createElement("a"); const descriptionLink = document.createElement("a");
descriptionLink.href = descriptionUri; descriptionLink.href = descriptionUri;
descriptionLink.target = "_blank"; descriptionLink.target = "_blank";
@ -50,9 +55,9 @@ export default function hackcal(e, p = 1) {
summaryItem.appendChild(descriptionLink); summaryItem.appendChild(descriptionLink);
} catch (e) { } catch (e) {
summaryItem.innerText = event.summary; summaryItem.innerText = event.summary;
entryItem.querySelector(".description").innerText =
event.description;
} }
entryItem.querySelector(".description").innerText =
cleanedDescription;
// self-link location if it's a valid URL // self-link location if it's a valid URL
const locationItem = entryItem.querySelector(".location"); const locationItem = entryItem.querySelector(".location");

View file

@ -83,6 +83,10 @@ h3 {
font-size: 1.2rem; font-size: 1.2rem;
} }
ul > li {
margin-top: 0.3em;
}
/* page header */ /* page header */
#space-image { #space-image {
@ -105,7 +109,7 @@ header {
"logo . nav nav" "logo . nav nav"
"logo . space-text space-image" min-content "logo . space-text space-image" min-content
"logo . . ." min-content / "logo . . ." min-content /
minmax(min-content, 25vw) 1fr auto minmax(0, min-content); minmax(min-content, 25vw) 1fr auto 11vh;
overflow: hidden; overflow: hidden;
* { * {
@ -339,6 +343,7 @@ footer {
em { em {
background-color: var(--main-accent-color); background-color: var(--main-accent-color);
padding: 0 0.25em; padding: 0 0.25em;
margin-right: 0.2em;
font-style: normal; font-style: normal;
font-weight: bold; font-weight: bold;
color: var(--main-bg-color); color: var(--main-bg-color);