Add unescape utility function and

artplayerPluginMultipleSubtitles plugin
This commit is contained in:
Harvey Zack committed 2023-11-23 23:23:51 +08:00
1 parent 3db53c425e
commit 89b8525f2f
47 files changed
+2982 -75

No files matched your search

+12
View File
@@ -32,3 +32,15 @@ export function escape(str) {
})[tag] || tag,
);
}
export function unescape(str) {
const map = {
'&': '&',
'&lt;': '<',
'&gt;': '>',
'&#39;': "'",
'&quot;': '"',
};
const reg = new RegExp(`(${Object.keys(map).join('|')})`, 'g');
return str.replace(reg, (tag) => map[tag] || tag);
}