From f4f8a73f9e1d04db75acc69eaeaca07097f6ae04 Mon Sep 17 00:00:00 2001 From: Izumiko Date: Tue, 21 Nov 2023 17:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=96=84=E5=8F=8D=E5=A4=8D=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E6=92=AD=E6=94=BE=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ede.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ede.js b/ede.js index 1343316..ec6fb5a 100644 --- a/ede.js +++ b/ede.js @@ -3,7 +3,7 @@ // @description Jellyfin弹幕插件 // @namespace https://github.com/RyoLee // @author RyoLee -// @version 1.15 +// @version 1.16 // @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 @@ -737,12 +737,29 @@ window.ede.obMutation.disconnect(); } window.ede.obMutation = new MutationObserver(() => { - if (window.ede.danmaku) { + if (window.ede.danmaku && document.querySelector(mediaQueryStr)) { showDebugInfo('Video Changed'); reloadDanmaku('reload'); } }); window.ede.obMutation.observe(_media, { attributes: true }); + + if (!window.obVideo) { + window.obVideo = new MutationObserver((mutationList, observer) => { + for (let mutationRecord of mutationList) { + if (mutationRecord.removedNodes) { + for (let removedNode of mutationRecord.removedNodes) { + if (removedNode.className && removedNode.classList.contains('videoPlayerContainer')) { + console.log('Video Removed'); + window.ede.loading = false; + return; + } + } + } + } + }); + window.obVideo.observe(document.body, { childList: true }); + } } function reloadDanmaku(type = 'check') {