From 4a238a79274b45eee17cf1a378ac791d96dd0200 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Sun, 5 Jun 2022 17:43:24 +0800 Subject: [PATCH] FEATURE: bilibili embedded video --- assets/style-refractored.scss | 16 ++++++++++++++++ layouts/partials/link-block.html | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/assets/style-refractored.scss b/assets/style-refractored.scss index d9918a0..226bc44 100644 --- a/assets/style-refractored.scss +++ b/assets/style-refractored.scss @@ -250,6 +250,22 @@ p{ } } +.bilibili-video { + position: relative; + max-width: 85%; + height: 0; + padding-bottom: 45%; + margin-bottom: 10px; + + iframe { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + } +} + // for the note info .moment-note{ display: flex; diff --git a/layouts/partials/link-block.html b/layouts/partials/link-block.html index 48c6797..f16c601 100644 --- a/layouts/partials/link-block.html +++ b/layouts/partials/link-block.html @@ -37,6 +37,17 @@ {{ $netease_music_song_id = replaceRE `(https?://)?music\.163\.com/song\?id=([0-9]*)([-a-zA-Z0-9()@:%\+.~#?&/=_]*)` "$2" .a }} {{ end }} +{{/* 2.2 bilibili video */}} +{{ $bilibili_video_url := "0" }} +{{ if eq 1 (len (findRE `(https?://)?player\.bilibili\.com/player\.html.*` .a)) }} + {{ $resource_type = "bilibili_video" }} + {{ $bilibili_video_url = .a }} +{{ end }} + +{{ if eq 1 (len (findRE `` .a)) }} + {{ $resource_type = "bilibili_video" }} + {{ $bilibili_video_url = replaceRE `` "$1" .a }} +{{ end }} {{/* BEGIN generate output */}} {{/* PART 1 default link */}} @@ -67,3 +78,9 @@ src="//music.163.com/outchain/player?type=2&id={{ $netease_music_song_id }}&auto=1&height=66"> {{ end }} + +{{ if eq "bilibili_video" $resource_type}} +
+ +
+{{ end }} \ No newline at end of file