Merge branch 'master' into master

This commit is contained in:
Jimmy Cai 2024-03-02 23:44:49 +01:00 committed by GitHub
commit 2141f9d6b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 61 additions and 3 deletions

View File

@ -51,6 +51,12 @@ params:
issueTerm: pathname issueTerm: pathname
label: label:
beaudar:
repo:
issueTerm: pathname
label:
theme:
remark42: remark42:
host: host:
site: site:
@ -64,7 +70,7 @@ params:
clientSecret: clientSecret:
autoCreateIssue: false autoCreateIssue: false
# Waline client configuration see: https://waline.js.org/en/reference/client.html # Waline client configuration see: https://waline.js.org/en/reference/client/props.html
waline: waline:
serverURL: serverURL:
lang: lang:
@ -75,9 +81,9 @@ params:
requiredMeta: requiredMeta:
- nick - nick
- mail - mail
placeholder:
locale: locale:
admin: Admin admin: Admin
placeholder:
twikoo: twikoo:
envId: envId:

View File

@ -93,6 +93,12 @@ params:
issueTerm: pathname issueTerm: pathname
label: label:
beaudar:
repo:
issueTerm: pathname
label:
theme:
remark42: remark42:
host: host:
site: site:

View File

@ -0,0 +1,46 @@
<script
src="https://beaudar.lipk.org/client.js"
repo="{{ .Site.Params.comments.beaudar.repo }}"
issue-term="{{ .Site.Params.comments.beaudar.issueTerm }}"
{{ with .Site.Params.comments.beaudar.label }}
label="{{ . }}"
{{ end }}
theme="{{ .Site.Params.comments.beaudar.theme }}"
crossorigin="anonymous"
async
></script>
<style>
.beaudar {
max-width: unset;
}
</style>
<script>
let beaudarLoaded = false;
function setBeaudarTheme(theme) {
let beaudar = document.querySelector(".beaudar iframe");
if (beaudar) {
beaudar.contentWindow.postMessage(
{
type: "set-theme",
theme: `github-${theme}`,
},
"https://beaudar.lipk.org"
);
}
}
addEventListener("message", (event) => {
if (event.origin !== "https://beaudar.lipk.org") return;
/// Called when Beaudar is ready
beaudarLoaded = true;
setBeaudarTheme(document.documentElement.dataset.scheme);
});
window.addEventListener("onColorSchemeChange", (e) => {
if (!beaudarLoaded) return;
setBeaudarTheme(e.detail);
});
</script>

View File

@ -78,7 +78,7 @@
<div class="menu-bottom-section"> <div class="menu-bottom-section">
<ol class="menu"> <ol class="menu">
{{- $currentLanguageCode := .Language.Lang -}} {{- $currentLanguageCode := .Language.Lang -}}
{{ if ( compare.Gt .Site.Home.AllTranslations 1 ) }} {{ if ( compare.Gt .Site.Home.AllTranslations.Len 1 ) }}
{{ with .Site.Home.AllTranslations }} {{ with .Site.Home.AllTranslations }}
<li id="i18n-switch"> <li id="i18n-switch">
{{ partial "helper/icon" "language" }} {{ partial "helper/icon" "language" }}