Merge branch 'translations-v1' into translations-v1

This commit is contained in:
Nuno Coração 2024-03-20 16:07:57 +00:00 committed by GitHub
commit 422d8fa8e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 32 additions and 14 deletions

View file

@ -1,7 +1,9 @@
var liked_page = false var liked_page = false
var id = oid ? oid.replaceAll("/", "-") : oid
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
if (typeof auth !== 'undefined') { if (typeof auth !== 'undefined') {
var id = oid ? oid.replaceAll("/", "-") : oid
var viewed = localStorage.getItem(id); var viewed = localStorage.getItem(id);
if (!viewed) { if (!viewed) {
@ -28,7 +30,6 @@ if (typeof auth !== 'undefined') {
}); });
} }
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
var liked = localStorage.getItem(id_likes); var liked = localStorage.getItem(id_likes);
if (liked) { if (liked) {
@ -97,7 +98,6 @@ function remove_like_article(id_likes) {
} }
function process_article() { function process_article() {
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
if (!liked_page) { if (!liked_page) {
like_article(id_likes) like_article(id_likes)
} else { } else {

View file

@ -14,4 +14,5 @@ cascade:
本章节包含了你需要了解的有关 Blowfish 的所有信息。如果你是新用户,请查阅[安装]({{< ref "docs/installation" >}}) 指南,或者访问[示例]({{< ref "samples" >}}) 来了解 Blowfish 能做什么。 本章节包含了你需要了解的有关 Blowfish 的所有信息。如果你是新用户,请查阅[安装]({{< ref "docs/installation" >}}) 指南,或者访问[示例]({{< ref "samples" >}}) 来了解 Blowfish 能做什么。
--- ---

View file

@ -19,12 +19,16 @@
<div class="mt-1 mb-2 text-base text-neutral-500 dark:text-neutral-400 print:hidden"> <div class="mt-1 mb-2 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
{{ partial "article-meta/list.html" (dict "context" . "scope" "single") }} {{ partial "article-meta/list.html" (dict "context" . "scope" "single") }}
</div> </div>
{{ with .File }}
<script> {{ $path := .File.Path }}
var oid = "views_{{ .Path }}" {{range .AllTranslations}}
var oid_likes = "likes_{{ .Path }}" {{ $lang := print "." .Lang ".md" }}
</script> {{ $path = replace $path $lang ".md" }}
{{end}} {{end}}
<script>
var oid = "views_{{ $path }}"
var oid_likes = "likes_{{ $path }}"
</script>
{{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>

View file

@ -86,12 +86,15 @@
{{ partial "related.html" . }} {{ partial "related.html" . }}
</div> </div>
{{ with .File }} {{ $path := .File.Path }}
<script> {{range .AllTranslations}}
var oid = "views_{{ .Path }}" {{ $lang := print "." .Lang ".md" }}
var oid_likes = "likes_{{ .Path }}" {{ $path = replace $path $lang ".md" }}
</script>
{{end}} {{end}}
<script>
var oid = "views_{{ $path }}"
var oid_likes = "likes_{{ $path }}"
</script>
{{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>

View file

@ -4,7 +4,12 @@
{{ else if eq .Kind "term"}} {{ else if eq .Kind "term"}}
<span id="likes_term_{{ .Page.Data.Term }}" <span id="likes_term_{{ .Page.Data.Term }}"
{{ else }} {{ else }}
<span id="likes_{{ .File.Path }}" {{ $path := .File.Path }}
{{range .AllTranslations}}
{{ $lang := print "." .Lang ".md" }}
{{ $path = replace $path $lang ".md" }}
{{end}}
<span id="likes_{{ $path }}"
{{ end }} {{ end }}
class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="likes">loading</span> class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="likes">loading</span>
<span class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }}</span> <span class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }}</span>

View file

@ -4,7 +4,12 @@
{{ else if eq .Kind "term"}} {{ else if eq .Kind "term"}}
<span id="views_term_{{ .Page.Data.Term }}" <span id="views_term_{{ .Page.Data.Term }}"
{{ else }} {{ else }}
<span id="views_{{ .File.Path }}" {{ $path := .File.Path }}
{{range .AllTranslations}}
{{ $lang := print "." .Lang ".md" }}
{{ $path = replace $path $lang ".md" }}
{{end}}
<span id="views_{{ $path }}"
{{ end }} {{ end }}
class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="views">loading</span> class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="views">loading</span>
<span class="inline-block align-text-bottom">{{ partial "icon.html" "eye" }}</span> <span class="inline-block align-text-bottom">{{ partial "icon.html" "eye" }}</span>