Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zhaohuabing/hugo-theme-cleanwhite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhuabing zhao <zhaohuabing@gmail.com>2020-11-12 14:55:34 +0300
committerhuabing zhao <zhaohuabing@gmail.com>2020-11-12 14:55:34 +0300
commit53351fdff54f38b9b25c2f3dfce9fd04bcf1c8d9 (patch)
tree05a74edc7cba3bf09523e6ef7880966597be61f7 /layouts
parente37fc5d1eb4ffb184e243f3cafd7d39ad17bb902 (diff)
bilibili video shortcode
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/bilibili.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/layouts/shortcodes/bilibili.html b/layouts/shortcodes/bilibili.html
new file mode 100644
index 0000000..2f546ee
--- /dev/null
+++ b/layouts/shortcodes/bilibili.html
@@ -0,0 +1,25 @@
+{{ $videoID := index .Params 0 }}
+{{ $pageNum := index .Params 1 | default 1}}
+
+<style>
+ #biliplayer {
+ width: 100%;
+ height: 600px;
+ }
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
+ #biliplayer {
+ width: 100%;
+ height: 250px;
+ }
+ }
+</style>
+
+{{ 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 }}