2022 主题bug修复
This commit is contained in:
1 parent
a6b1098d60
commit
56ea059fc0
16 files changed
+1357
-334
No files matched your search
@@ -13,7 +13,7 @@
|
||||
{{- $faviconUrl := printf "https://api.usj.cc/api/favicon?url=%s" $domain.Host -}}
|
||||
{{- if $isBareUrl -}}
|
||||
<a class="link-card" href="/tiaozhuan.html?target={{ $url | base64Encode }}" target="_blank" rel="noopener">
|
||||
<img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.style.display='none'">
|
||||
<img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.src='/image/avatar/tx7.jpg';this.onerror=null;">
|
||||
<span class="link-card-body">
|
||||
<span class="link-card-title">{{ $domain.Host }}</span>
|
||||
<span class="link-card-url">{{ $url }}</span>
|
||||
@@ -22,7 +22,7 @@
|
||||
</a>
|
||||
{{- else -}}
|
||||
<a class="link-card" href="/tiaozhuan.html?target={{ $url | base64Encode }}" target="_blank" rel="noopener">
|
||||
<img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.style.display='none'">
|
||||
<img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.src='/image/avatar/tx7.jpg';this.onerror=null;">
|
||||
<span class="link-card-body">
|
||||
<span class="link-card-title">{{ $displayText }}</span>
|
||||
<span class="link-card-url">{{ $domain.Host }}</span>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<span class="meta-item">作者: {{ .Params.author | default .Site.Params.author.name }}</span>
|
||||
<span class="meta-item">浏览: <span id="busuanzi_value_page_uv"></span></span>
|
||||
<span class="meta-item">字数: {{ .WordCount }}</span>
|
||||
<span class="meta-item">阅读: 约 {{ .ReadingTime }} 分钟</span>
|
||||
<span class="meta-item meta-item-reading-time">阅读: 约 {{ .ReadingTime }} 分钟</span>
|
||||
{{ with .GetTerms "categories" }}
|
||||
<span class="meta-item">分类:
|
||||
{{ range . }}
|
||||
|
||||
@@ -63,9 +63,10 @@
|
||||
{{ $mypjax := resources.Get "js/modules/mypjax.js" }}
|
||||
{{ $pangu := resources.Get "js/modules/pangu.js" }}
|
||||
{{ $linkify := resources.Get "js/modules/linkify.js" }}
|
||||
{{ $shortcodesJs := resources.Get "js/shortcodes.js" }}
|
||||
{{ $main := resources.Get "js/main.js" }}
|
||||
|
||||
{{ $coreScripts := slice $iconfont $uikit $viewimage $utils $loader $cache $search $floatingTools $nprogress $pjaxLib $mypjax $pangu $linkify $main | resources.Concat "js/core.js" | resources.Minify | resources.Fingerprint }}
|
||||
{{ $coreScripts := slice $iconfont $uikit $viewimage $utils $loader $cache $search $floatingTools $nprogress $pjaxLib $mypjax $pangu $linkify $shortcodesJs $main | resources.Concat "js/core.js" | resources.Minify | resources.Fingerprint }}
|
||||
|
||||
<script defer src="{{ $coreScripts.RelPermalink }}"></script>
|
||||
|
||||
@@ -170,9 +171,8 @@
|
||||
{{/* ====== 5. 延迟加载的非关键JS ====== */}}
|
||||
{{ $toast := resources.Get "js/modules/toast.js" }}
|
||||
{{ $easylazyload := resources.Get "js/modules/lazyload.js" }}
|
||||
{{ $shortcodesJs := resources.Get "js/shortcodes.js" }}
|
||||
|
||||
{{ $deferredScripts := slice $toast $easylazyload $shortcodesJs | resources.Concat "js/deferred.js" | resources.Minify | resources.Fingerprint }}
|
||||
{{ $deferredScripts := slice $toast $easylazyload | resources.Concat "js/deferred.js" | resources.Minify | resources.Fingerprint }}
|
||||
|
||||
<script>
|
||||
// 使用requestIdleCallback在浏览器空闲时加载
|
||||
|
||||
@@ -146,11 +146,22 @@
|
||||
background-attachment: {{ .Site.Params.style.backgroundAttachment | default "fixed" }} !important;
|
||||
}
|
||||
[data-theme="dark"] body {
|
||||
background-image: none !important;
|
||||
background-size: initial !important;
|
||||
background-repeat: initial !important;
|
||||
background-position: initial !important;
|
||||
background-attachment: initial !important;
|
||||
background-image: url(/image/background/deno.webp) !important;
|
||||
background-size: contain !important;
|
||||
background-repeat: round !important;
|
||||
background-position: center !important;
|
||||
background-attachment: fixed !important;
|
||||
}
|
||||
[data-theme="dark"] body::before {
|
||||
content: '' !important;
|
||||
position: fixed !important;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
background-color: rgba(0, 0, 0, 0.4) !important;
|
||||
pointer-events: none !important;
|
||||
z-index: -1 !important;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
body {
|
||||
|
||||
@@ -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