diff options
author | lryong <15816537946@163.com> | 2020-09-11 00:27:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 00:27:28 +0800 |
commit | da4320e8a56343ad37a4604e61915675fa18a270 (patch) | |
tree | 44aeea6a85baa7b513d4e06d7131c96322d27ea7 /layouts/shortcodes | |
parent | 513c19a0fe9bbc92686ca10c1d1c793a61098219 (diff) |
feat(shortcodes): support bilibili video (#294)
Closes #278
Co-authored-by: Herbert Lu <ry.lu@aftership.com>
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r-- | layouts/shortcodes/bilibili.html | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/layouts/shortcodes/bilibili.html b/layouts/shortcodes/bilibili.html new file mode 100644 index 0000000..005eccb --- /dev/null +++ b/layouts/shortcodes/bilibili.html @@ -0,0 +1,23 @@ + +{{ $videoID := index .Params 0 }} +{{ $pageNum := index .Params 1 | default 1 }} + +{{ if (findRE "^[bB][vV][0-9a-zA-Z]+$" $videoID) }} +<div><iframe id="biliplayer" src="//player.bilibili.com/player.html?bvid={{ $videoID }}&page={{ $pageNum }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" loading="lazy" > </iframe></div> +{{ else }} +<div><iframe id="biliplayer" src="//player.bilibili.com/player.html?aid={{ $videoID }}&page={{ $pageNum }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" loading="lazy" > </iframe></div> +{{ end }} + +<style> +// Embed BiliBili Video +#bilibili { + width: 100%; + height: 550px; +} +@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { + #bilibili { + width: 100%; + height: 250px; + } +} +</style> |