Feat: add more options support for bilibili shortcode, e.g. autoplay, muted etc. (resolve #375)

This commit is contained in:
Cell
2023-11-06 17:56:44 +08:00
parent 02dda642ea
commit 4e29d5e5ca
2 changed files with 11 additions and 6 deletions
+1 -1
Submodule docs updated: 2f0c65c6b5...0f108cd090
+10 -5
View File
@@ -1,8 +1,13 @@
{{- /* reference https://player.bilibili.com/ */ -}}
{{- $bvid := cond .IsNamedParams (.Get "id") (.Get 0) -}}
{{- $p := cond .IsNamedParams (.Get "p") (.Get 1) | default 1 -}}
{{- $autoplay := .Get "autoplay" | default false -}}
{{- $poster := .Get "poster" | default true -}}
{{- $muted := .Get "muted" | default true -}}
{{- $danmaku := .Get "danmaku" | default true -}}
{{- $t := .Get "t" | default 0 -}}
<div class="bilibili">
{{- if .IsNamedParams -}}
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get `id` }}&page={{ .Get `p` | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
{{- else -}}
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get 0 }}&page={{ .Get 1 | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
{{- end -}}
<iframe src="//player.bilibili.com/player.html?bvid={{ $bvid }}&page={{ $p }}&autoplay={{ $autoplay }}&poster={{ $poster }}&muted={{ $muted }}&danmaku={{ $danmaku }}&t={{ $t }}" border="0" framespacing="0" allowfullscreen="true"></iframe>
</div>
{{- /* EOF */ -}}