[fix] video tag (#487)

This commit is contained in:
纸鹿/Zhilu 2024-06-12 21:59:31 +08:00 committed by GitHub
parent acd0ab9998
commit c38e8abfc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -8,14 +8,13 @@
'use strict'; 'use strict';
module.exports = ctx => function(args) { module.exports = ctx => function (args) {
args = ctx.args.map(args, ['type', 'bilibili', 'ratio', 'width', 'autoplay'], ['src']) args = ctx.args.map(args, ['type', 'bilibili', 'ratio', 'width', 'autoplay'], ['src'])
if (args.width == null) { if (args.width == null) {
args.width = '100%' args.width = '100%'
} }
if (args.bilibili) { if (args.bilibili) {
return ` return `<div class="tag-plugin video" style="aspect-ratio:${args.ratio || 16 / 9};max-width:${args.width};">
<div class="tag-plugin video" style="aspect-ratio:${args.ratio || 16/9};max-width:${args.width};">
<iframe src="https://player.bilibili.com/player.html?bvid=${args.bilibili}&autoplay=${args.autoplay || 'false'}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> <iframe src="https://player.bilibili.com/player.html?bvid=${args.bilibili}&autoplay=${args.autoplay || 'false'}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">
</iframe> </iframe>
</div> </div>

View File

@ -1,6 +1,6 @@
.tag-plugin.video .tag-plugin.video
line-height: 0 line-height: 0
text-align: center margin: auto
video, iframe video, iframe
border-radius: $border-card border-radius: $border-card
box-shadow: $boxshadow-card-float box-shadow: $boxshadow-card-float