update the theme

This commit is contained in:
Christoph Cullmann 2025-05-16 21:22:13 +02:00
parent 008abb31c3
commit 3988dc59f8
No known key found for this signature in database
50 changed files with 6947 additions and 6547 deletions

View file

@ -76,14 +76,24 @@ var updateMeta = () => {
{{ $secondaryLogo := resources.Get .Site.Params.SecondaryLogo }}
{{ if and ($primaryLogo) ($secondaryLogo) }}
var updateLogo = (targetAppearance) => {
var elems;
elems = document.querySelectorAll("img.logo")
var imgElems = document.querySelectorAll("img.logo");
var logoContainers = document.querySelectorAll("span.logo");
targetLogoPath =
targetAppearance == "{{ .Site.Params.DefaultAppearance }}" ?
"{{ $primaryLogo.RelPermalink }}" : "{{ $secondaryLogo.RelPermalink }}"
for (const elem of elems) {
for (const elem of imgElems) {
elem.setAttribute("src", targetLogoPath)
}
{{ if eq $primaryLogo.MediaType.SubType "svg" }}
targetContent =
targetAppearance == "{{ .Site.Params.DefaultAppearance }}" ?
`{{ $primaryLogo.Content | safeHTML }}` : `{{ $secondaryLogo.Content | safeHTML }}`
for (const container of logoContainers) {
container.innerHTML = targetContent;
}
{{ end }}
}
{{ end }}
{{- end }}

View file

@ -2,6 +2,17 @@ function css(name) {
return "rgb(" + getComputedStyle(document.documentElement).getPropertyValue(name) + ")";
}
document.addEventListener("DOMContentLoaded", () => {
const mermaidDivs = document.querySelectorAll("div.mermaid");
for (const div of mermaidDivs) {
const preElement = div.querySelector("pre");
if (preElement) {
div.textContent = preElement.textContent;
}
}
});
mermaid.initialize({
theme: "base",
themeVariables: {
@ -17,4 +28,4 @@ mermaid.initialize({
"ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif",
fontSize: "16px",
},
});
});

View file

@ -20,6 +20,10 @@ function _toogleZenMode(zendModeButton) {
articleContent.classList.toggle('max-w-fit');
articleContent.classList.toggle('max-w-prose');
// Change width of article title
header.classList.toggle('max-w-full');
header.classList.toggle('max-w-prose');
// Read i18n title from data-attributes
const titleI18nDisable = zendModeButton.getAttribute('data-title-i18n-disable');
const titleI18nEnable = zendModeButton.getAttribute('data-title-i18n-enable');