mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Convert special characters
This commit is contained in:
parent
13def457cc
commit
569d134f9c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
min/danmaku-converter.min.js
vendored
2
min/danmaku-converter.min.js
vendored
File diff suppressed because one or more lines are too long
@ -299,7 +299,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
}
|
||||
const [startTime, endTime] = this.convertTime(xmlDanmaku.time, this.duration(xmlDanmaku));
|
||||
assDanmakus.push(new AssDanmaku({
|
||||
content: xmlDanmaku.content,
|
||||
content: this.convertText(xmlDanmaku.content),
|
||||
time: startTime,
|
||||
endTime: endTime,
|
||||
type: xmlDanmaku.type,
|
||||
@ -317,6 +317,23 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
resolution: this.resolution
|
||||
});
|
||||
}
|
||||
convertText(text)
|
||||
{
|
||||
const map = {
|
||||
"{": "{",
|
||||
"}": "}",
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
""": '"',
|
||||
"'": "'",
|
||||
};
|
||||
for (const [key, value] of Object.entries(map))
|
||||
{
|
||||
text = text.replace(new RegExp(key, "g"), value);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
convertType(danmaku)
|
||||
{
|
||||
return this.danmakuStack.push(danmaku).tags;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user