From f10b39250ce84d60fa93065c6eeba6a8474d0f00 Mon Sep 17 00:00:00 2001 From: Izumiko Date: Wed, 5 Jun 2024 08:22:36 +0000 Subject: [PATCH] deploy: ba9180cfdec68e59d8f21a4a1537d60bf9bf2003 --- ede.user.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ede.user.js b/ede.user.js index 83f9a85..2920e7f 100644 --- a/ede.user.js +++ b/ede.user.js @@ -3,7 +3,7 @@ // @description Jellyfin弹幕插件 // @namespace https://github.com/RyoLee // @author RyoLee -// @version 1.40 +// @version 1.41 // @copyright 2022, RyoLee (https://github.com/RyoLee) // @license MIT; https://raw.githubusercontent.com/Izumiko/jellyfin-danmaku/jellyfin/LICENSE // @icon https://github.githubassets.com/pinned-octocat.svg @@ -954,11 +954,11 @@ } } // 获取第三方弹幕 - for (const s of src) { - response = await makeGetRequest(url_ext + encodeURIComponent(s)); - data = isInTampermonkey ? JSON.parse(response) : await response.json(); + await Promise.all(src.map(async (s) => { + const response = await makeGetRequest(url_ext + encodeURIComponent(s)); + const data = isInTampermonkey ? JSON.parse(response) : await response.json(); comments = comments.concat(data.comments); - } + })); } showDebugInfo('弹幕下载成功: ' + comments.length); return comments; @@ -1047,6 +1047,7 @@ await waitForMediaContainer(); let _container = null; + const reactRoot = document.getElementById('reactRoot'); document.querySelectorAll(mediaContainerQueryStr).forEach((element) => { if (!element.classList.contains('hide')) { _container = element; @@ -1066,13 +1067,17 @@ wrapper = document.createElement('div'); wrapper.id = 'danmakuWrapper'; - wrapper.style.position = 'absolute'; + wrapper.style.position = 'fixed'; wrapper.style.width = '100%'; wrapper.style.height = `calc(${window.ede.heightRatio * 100}% - 18px)`; wrapper.style.opacity = window.ede.opacity; wrapper.style.top = '18px'; - wrapper.style.overflow = 'hidden'; - _container.prepend(wrapper); + wrapper.style.pointerEvents = 'none'; + if (reactRoot) { + reactRoot.prepend(wrapper); + } else { + showDebugInfo('未找到video'); + } window.ede.danmaku = new Danmaku({ container: wrapper,