2022 主题bug修复
This commit is contained in:
1 parent
a6b1098d60
commit
56ea059fc0
16 files changed
+1357
-334
No files matched your search
@@ -0,0 +1,24 @@
|
||||
{{- $bvid := .Get "bvid" | default (.Get 0) -}}
|
||||
{{- $page := .Get "page" | default "1" -}}
|
||||
{{- $danmaku := .Get "danmaku" | default "1" -}}
|
||||
{{- $autoplay := .Get "autoplay" | default "0" -}}
|
||||
{{- $ratio := .Get "ratio" | default "16:9" -}}
|
||||
|
||||
{{- $ratioParts := split $ratio ":" -}}
|
||||
{{- $ratioW := index $ratioParts 0 -}}
|
||||
{{- $ratioH := index $ratioParts 1 -}}
|
||||
{{- $paddingBottom := (mul (div (float $ratioH) (float $ratioW)) 100) -}}
|
||||
|
||||
<div class="amigo-bilibili-wrapper" style="--padding-bottom: {{ $paddingBottom }}%">
|
||||
<div class="amigo-bilibili-inner">
|
||||
<iframe
|
||||
src="//player.bilibili.com/player.html?bvid={{ $bvid }}&page={{ $page }}&danmaku={{ $danmaku }}&autoplay={{ $autoplay }}&high_quality=1"
|
||||
scrolling="no"
|
||||
border="0"
|
||||
frameborder="no"
|
||||
framespacing="0"
|
||||
allowfullscreen="true"
|
||||
loading="lazy">
|
||||
</iframe>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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>
|
||||
@@ -3,9 +3,23 @@
|
||||
{{ $name := .Get "name" | default "未知歌曲" }}
|
||||
{{ $artist := .Get "artist" | default "未知艺术家" }}
|
||||
{{ $accent := .Get "accent" | default "#d43c33" }}
|
||||
|
||||
{{- if and $src (not (findRE "^(https?://|/)" $src)) -}}
|
||||
{{- with .Page.Resources.GetMatch $src -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $cover (not (findRE "^(https?://|/)" $cover)) -}}
|
||||
{{- with .Page.Resources.GetMatch $cover -}}
|
||||
{{- $cover = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ $isApi := strings.HasPrefix $src "https://open.motues.top/music" }}
|
||||
|
||||
<div class="amigo-music-card-mark amigo-music-card" data-amigo-music-card="1" data-src="{{ $src }}" data-name="{{ $name }}" data-artist="{{ $artist }}" data-is-api="{{ if $isApi }}true{{ else }}false{{ end }}" style="--music-accent:{{ $accent }}">
|
||||
<div class="amigo-music-card-mark">
|
||||
<div class="amigo-music-card" data-amigo-music-card="1" data-src="{{ $src }}" data-name="{{ $name }}" data-artist="{{ $artist }}" data-is-api="{{ if $isApi }}true{{ else }}false{{ end }}" style="--music-accent:{{ $accent }}">
|
||||
<div class="amigo-music-card__hero">
|
||||
<div class="amigo-music-card__art">
|
||||
<img class="amigo-music-card__cover amigo-music-card__cover--image" src="{{ $cover }}" alt="{{ $name }} cover" loading="lazy" data-keep="1">
|
||||
@@ -30,4 +44,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,9 +43,19 @@
|
||||
{{ $muted := .Get "muted" | default "false" }}
|
||||
{{ $isGifMode := or (eq $loop "true") (eq $muted "true") }}
|
||||
{{ $videoSrc := $src }}
|
||||
{{ if not (hasPrefix $src "http") }}
|
||||
{{ $videoSrc = printf "/%s/%s" .Page.Slug $src }}
|
||||
{{ end }}
|
||||
{{ $posterSrc := $poster }}
|
||||
|
||||
{{- if and $src (not (findRE "^(https?://|/)" $src)) -}}
|
||||
{{- with .Page.Resources.GetMatch $src -}}
|
||||
{{- $videoSrc = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $poster (not (findRE "^(https?://|/)" $poster)) -}}
|
||||
{{- with .Page.Resources.GetMatch $poster -}}
|
||||
{{- $posterSrc = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ if $isGifMode }}
|
||||
{{/* GIF 模式:图片标签显示,自动循环 */}}
|
||||
@@ -59,7 +69,7 @@
|
||||
{{/* 视频模式:自定义播放器 */}}
|
||||
<div class="video-wrap">
|
||||
<figure class="video-player" onclick="toggleVideo(this)">
|
||||
<video preload="metadata" playsinline webkit-playsinline {{ with $poster }}poster="{{ . }}"{{ end }}>
|
||||
<video preload="metadata" playsinline webkit-playsinline {{ with $posterSrc }}poster="{{ . }}"{{ end }}>
|
||||
<source src="{{ $videoSrc }}">
|
||||
</video>
|
||||
<div class="video-play-icon">
|
||||
|
||||
@@ -6,12 +6,22 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $author := .Site.Params.author.name | default "小赵" -}}
|
||||
{{- $avatar := .Site.Params.author.avatar | default "/image/avatar/tx7.jpg" -}}
|
||||
{{- $isToday := eq (.Page.Date.Format "2006-01-02") (now.Format "2006-01-02") -}}
|
||||
|
||||
<div class="amigo-voice-bubble" data-src="{{ $src }}">
|
||||
<div class="amigo-voice-icon">
|
||||
<span></span><span></span><span></span>
|
||||
<div class="amigo-voice-wrapper">
|
||||
<div class="amigo-voice-user">
|
||||
<img class="amigo-voice-avatar" src="{{ $avatar }}" alt="{{ $author }}" loading="lazy">
|
||||
<span class="amigo-voice-name">{{ $author }}</span>
|
||||
</div>
|
||||
<div class="amigo-voice-bubble" data-src="{{ $src }}">
|
||||
<div class="amigo-voice-content">
|
||||
<div class="amigo-voice-icon">
|
||||
<span></span><span></span><span></span>
|
||||
</div>
|
||||
<span class="amigo-voice-duration">″</span>
|
||||
</div>
|
||||
{{ if $isToday }}<i class="amigo-voice-unread"></i>{{ end }}
|
||||
</div>
|
||||
<span class="amigo-voice-duration">″</span>
|
||||
{{ if $isToday }}<i class="amigo-voice-unread"></i>{{ end }}
|
||||
</div>
|
||||
Reference in new issue
Block a user