mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
Update bilibili.html
This commit is contained in:
parent
479a600f55
commit
b152ae1b4b
@ -1,18 +1,24 @@
|
|||||||
{{ $vid := (.Get 0) }}
|
{{ $vid := (.Get 0) }}
|
||||||
{{ $videopage := (.Get 1) }}
|
{{ $videopage := default 1 (.Get 1) }}
|
||||||
{{ if (strings.HasPrefix $vid "av") }}
|
{{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }}
|
||||||
<div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;">
|
{{ $videoQuery := "" }}
|
||||||
<iframe src="//player.bilibili.com/player.html?aid={{ strings.TrimPrefix "av" $vid }}&page={{ $videopage }}&high_quality=1&as_wide=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts"></iframe>
|
|
||||||
</div>
|
{{ if strings.HasPrefix (lower $vid) "av" }}
|
||||||
{{ else if (strings.HasPrefix $vid "AV") }}
|
{{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }}
|
||||||
<div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;">
|
{{ else if strings.HasPrefix (lower $vid) "bv" }}
|
||||||
<iframe src="//player.bilibili.com/player.html?aid={{ strings.TrimPrefix "AV" $vid }}&page={{ $videopage }}&high_quality=1&as_wide=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts"></iframe>
|
{{ $videoQuery = querify "bvid" $vid }}
|
||||||
</div>
|
|
||||||
{{ else if (strings.HasPrefix $vid "BV" )}}
|
|
||||||
<div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;">
|
|
||||||
<iframe src="//player.bilibili.com/player.html?bvid={{ $vid }}&page={{ $videopage }}&high_quality=1&as_wide=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts"></iframe>
|
|
||||||
</div>
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确</p>
|
<p>Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确</p>
|
||||||
<p>当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}</p>
|
<p>当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
|
||||||
|
<iframe src="//player.bilibili.com/player.html?{{ $basicQuery | safeURL }}&{{ $videoQuery | safeURL }}"
|
||||||
|
scrolling="no"
|
||||||
|
frameborder="no"
|
||||||
|
framespacing="0"
|
||||||
|
allowfullscreen="true"
|
||||||
|
style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"
|
||||||
|
>
|
||||||
|
</iframe>
|
||||||
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user