Skip to content

Commit

Permalink
重复弹幕判定条件调整:
Browse files Browse the repository at this point in the history
由cid改为弹幕时间+发送者+内容
  • Loading branch information
Izumiko committed Jun 12, 2024
1 parent 621ac57 commit 2b665d7
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Jellyfin弹幕插件
// @namespace https://github.com/RyoLee
// @author RyoLee
// @version 1.41
// @version 1.42
// @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
Expand Down Expand Up @@ -1244,9 +1244,19 @@
if (filterule === '') { filterule = '!.*'; }
const danmakufilterule = new RegExp(filterule);

return all_cmts
.filter((comment, index, self) => {
return !danmakufilterule.test(comment.p.split(',').pop()) && index === self.findIndex((t) => t.cid === comment.cid);
// 使用Map去重
const unique_cmts = [];
const cmtMap = new Map();
all_cmts.forEach((comment) => {
if (!cmtMap.has(comment.p + comment.m)) {
cmtMap.set(comment.p + comment.m, true);
unique_cmts.push(comment);
}
});

return unique_cmts
.filter((comment) => {
return !danmakufilterule.test(comment.p.split(',').pop());
})
.map((comment) => {
const [time, modeId, colorValue] = comment.p.split(',').map((v, i) => i === 0 ? parseFloat(v) : parseInt(v, 10));
Expand Down

0 comments on commit 2b665d7

Please sign in to comment.