Skip to content

Commit

Permalink
deploy: 4512187
Browse files Browse the repository at this point in the history
  • Loading branch information
Izumiko committed Feb 23, 2024
1 parent cf5f6de commit 70839bd
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions ede.user.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.28
// @version 1.29
// @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 @@ -886,20 +886,17 @@
const disableDandan = (danmakufilter & 4) === 4;
const disableOther = (danmakufilter & 8) === 8;

let filterule = '';
if (disableDandan) { filterule += '^(?!\\[)|\^.{0,3}\\]'; }
if (disableBilibili) { filterule += (filterule ? '|' : '') + '\^\\[BiliBili\\]'; }
if (disableGamer) { filterule += (filterule ? '|' : '') + '\^\\[Gamer\\]'; }
if (disableOther) { filterule += (filterule ? '|' : '') + '\^\\[\(\?\!\(BiliBili\|Gamer\)\).{3,}\\]'; }
if (filterule === '') { filterule = '!.*'; }
const danmakufilterule = new RegExp(filterule);

return $obj
.filter(($comment) => {
const senderInfo = $comment.p.split(',').pop();
if (disableDandan && (!/^\[/.test(senderInfo) || /^\[.{0,2}\]/.test(senderInfo))) {
return false;
}
if (disableOther && (/^\[(?!BiliBili|Gamer\]).{3,}\]/.test(senderInfo))) {
return false;
}
if ((disableBilibili && senderInfo.startsWith('[BiliBili]')) ||
(disableGamer && senderInfo.startsWith('[Gamer]'))) {
return false;
}
return true;
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 70839bd

Please sign in to comment.