mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-22 14:35:43 -06:00
Merge pull request #1902 from morethan987/dev
support the day/night mod change for SVG logo
This commit is contained in:
commit
25386511f5
1 changed files with 13 additions and 3 deletions
|
@ -76,14 +76,24 @@ var updateMeta = () => {
|
||||||
{{ $secondaryLogo := resources.Get .Site.Params.SecondaryLogo }}
|
{{ $secondaryLogo := resources.Get .Site.Params.SecondaryLogo }}
|
||||||
{{ if and ($primaryLogo) ($secondaryLogo) }}
|
{{ if and ($primaryLogo) ($secondaryLogo) }}
|
||||||
var updateLogo = (targetAppearance) => {
|
var updateLogo = (targetAppearance) => {
|
||||||
var elems;
|
var imgElems = document.querySelectorAll("img.logo");
|
||||||
elems = document.querySelectorAll("img.logo")
|
var logoContainers = document.querySelectorAll("span.logo");
|
||||||
|
|
||||||
targetLogoPath =
|
targetLogoPath =
|
||||||
targetAppearance == "{{ .Site.Params.DefaultAppearance }}" ?
|
targetAppearance == "{{ .Site.Params.DefaultAppearance }}" ?
|
||||||
"{{ $primaryLogo.RelPermalink }}" : "{{ $secondaryLogo.RelPermalink }}"
|
"{{ $primaryLogo.RelPermalink }}" : "{{ $secondaryLogo.RelPermalink }}"
|
||||||
for (const elem of elems) {
|
for (const elem of imgElems) {
|
||||||
elem.setAttribute("src", targetLogoPath)
|
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 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
Loading…
Reference in a new issue