From d71e6c0c5032840b8819a7abbb51b1a8931466f6 Mon Sep 17 00:00:00 2001 From: Izumiko Date: Tue, 21 Nov 2023 04:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ede.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ede.js b/ede.js index cdbdf49..11caf11 100644 --- a/ede.js +++ b/ede.js @@ -475,6 +475,10 @@ "mode": "cors" }).then(res => res.json()); playingInfo = sessionInfo[0].NowPlayingItem; + if (sessionInfo[0] && !playingInfo) { + showDebugInfo('闲置中'); + return 'Idle'; + } } showDebugInfo('成功 ' + playingInfo.SeriesName); return playingInfo; @@ -531,10 +535,14 @@ if (session != 1) { animeName += ' ' + session; } - } else { + } else if (item.Type == 'Movie') { _id = item.Id; animeName = item.Name; episode = 'movie'; + } else { + _id = item.Id; + animeName = item.Name; + episode = ''; } let _id_key = '_anime_id_rel_' + _id; let _name_key = '_anime_name_rel_' + _id; @@ -555,7 +563,7 @@ } let searchUrl = apiPrefix + 'https://api.dandanplay.net/api/v2/search/episodes?anime=' + animeName + '&withRelated=true'; - if (is_auto) { + if (is_auto && episode.toString().length > 0) { searchUrl += '&episode=' + episode; } let animaInfo = await makeGetRequest(searchUrl) @@ -644,12 +652,13 @@ if (!comments) { return; } + + let wrapper = document.getElementById('danmakuWrapper'); + wrapper && wrapper.parentNode.removeChild(wrapper); if (window.ede.danmaku != null) { window.ede.danmaku.clear(); window.ede.danmaku.destroy(); window.ede.danmaku = null; - let wrapper = document.getElementById('danmakuWrapper'); - wrapper.parentNode.removeChild(wrapper); } let _comments = danmakuFilter(danmakuParser(comments)); showDebugInfo('弹幕加载成功: ' + _comments.length); @@ -679,7 +688,7 @@ // showDebugInfo(_comments[0].text) // showDebugInfo(_container.id + ' ' + _media.className) - const wrapper = document.createElement('div'); + wrapper = document.createElement('div'); wrapper.id = 'danmakuWrapper'; wrapper.style.position = 'relative'; wrapper.style.width = '100%';