2022 主题bug修复
This commit is contained in:
1 parent
a6b1098d60
commit
56ea059fc0
16 files changed
+1357
-334
No files matched your search
@@ -1,35 +1,38 @@
|
||||
{{- $imageRaw := .Get "image" | default (.Get "src") -}}
|
||||
{{- $alt := .Get "alt" | default "Live Photo" -}}
|
||||
{{- $videoRaw := .Get "video" | default (replaceRE "\\.(avif|webp|jpg|jpeg|png|gif)$" ".mp4" $imageRaw) -}}
|
||||
{{- $image := $imageRaw -}}
|
||||
{{- $video := $videoRaw -}}
|
||||
{{- $src := .Get "src" | default "" -}}
|
||||
{{- $cover := .Get "cover" | default "" -}}
|
||||
{{- $muted := .Get "muted" | default "true" -}}
|
||||
|
||||
{{- if and $imageRaw (not (findRE "^(https?://|/)" $imageRaw)) -}}
|
||||
{{- with .Page.Resources.GetMatch $imageRaw -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- if and $src (not (findRE "^(https?://|/)" $src)) -}}
|
||||
{{- with .Page.Resources.GetMatch $src -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $videoRaw (not (findRE "^(https?://|/)" $videoRaw)) -}}
|
||||
{{- with .Page.Resources.GetMatch $videoRaw -}}
|
||||
{{- $video = .RelPermalink -}}
|
||||
{{- if and $cover (not (findRE "^(https?://|/)" $cover)) -}}
|
||||
{{- with .Page.Resources.GetMatch $cover -}}
|
||||
{{- $cover = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $style := .Get "style" -}}
|
||||
|
||||
<div class="live-photo"{{ with $style }}{{ printf " style=%q" (. | safeCSS) | safeHTMLAttr }}{{ end }}>
|
||||
<img class="live-photo-poster" src="{{ $image }}" alt="{{ $alt }}" loading="lazy" data-keep="1" no-view>
|
||||
<video class="live-photo-video" data-src="{{ $video }}" poster="{{ $image }}" muted playsinline loop preload="metadata" aria-label="{{ $alt }}"></video>
|
||||
<div class="live-photo-controls-group">
|
||||
<button type="button" class="live-photo-control-btn live-photo-toggle-btn" data-state="static" aria-label="Toggle Live Photo">
|
||||
<i class="icon-live" aria-hidden="true"></i>
|
||||
<span class="live-photo-live-label">实况</span>
|
||||
</button>
|
||||
<button type="button" class="live-photo-control-btn live-photo-mute-btn" data-muted="true" aria-label="Toggle Mute">
|
||||
<i class="ri-volume-up-line live-photo-mute-icon icon-unmuted" aria-hidden="true"></i>
|
||||
<i class="ri-volume-mute-line live-photo-mute-icon icon-muted" aria-hidden="true"></i>
|
||||
<span class="live-photo-mute-label">静音</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="warning" style="opacity: 0;"></div>
|
||||
<div class="amigo-livephoto {{ if eq $muted "true" }}is-muted{{ end }}" data-src="{{ $src }}" data-cover="{{ $cover }}">
|
||||
<div class="amigo-livephoto-badge">
|
||||
<span class="amigo-livephoto-live">LIVE</span>
|
||||
<button class="amigo-livephoto-sound" type="button" aria-label="切换声音">
|
||||
<svg class="amigo-livephoto-sound-off" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
|
||||
<path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
|
||||
<line x1="23" y1="9" x2="17" y2="15"></line>
|
||||
<line x1="17" y1="9" x2="23" y2="15"></line>
|
||||
</svg>
|
||||
<svg class="amigo-livephoto-sound-on" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
|
||||
<path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
|
||||
<path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<img class="amigo-livephoto-img" src="{{ $cover }}" alt="Live Photo" loading="lazy">
|
||||
<video class="amigo-livephoto-video" preload="none" loop playsinline muted>
|
||||
<source src="{{ $src }}" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
Reference in new issue
Block a user