From 5c01c590a4fece872fecb5be9f9d191d10206017 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 15 Aug 2024 17:21:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E5=BA=94=E5=A4=9A=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mastodon-timeline.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mastodon-timeline.js b/src/mastodon-timeline.js index 04e6472..d17011c 100644 --- a/src/mastodon-timeline.js +++ b/src/mastodon-timeline.js @@ -1000,10 +1000,14 @@ export class Init { '"; - + if (type === "image") { + const width = m.width || 800; // 默认宽度 + const height = m.height || 600; // 默认高度 + const aspectRatio = width / height; + media = - '
' + + '" style="padding-top: calc(100% / ' + + aspectRatio + + ')">' + (spoiler ? spoilerBtns : "") + - '