From a17677c3bf5ad9f8b2ef31b95465e504da03c908 Mon Sep 17 00:00:00 2001 From: AnimeDL Date: Wed, 5 Jul 2023 11:11:35 -0700 Subject: [PATCH] eslint fixes --- modules/module.vtt2ass.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/module.vtt2ass.ts b/modules/module.vtt2ass.ts index ecbbeb4..203f6cd 100644 --- a/modules/module.vtt2ass.ts +++ b/modules/module.vtt2ass.ts @@ -82,6 +82,8 @@ function parseStyle(stylegroup: string, line: string, style: any) { for (const s of line.split(';')) { if (s == '') continue; const st = s.trim().split(':'); + const transformed_str = st[1].split(',').map(r => r.trim()); + let arr = transformed_str[1].split(',').map(r => r.trim()); let cl; switch (st[0]) { case 'font-family': @@ -138,8 +140,7 @@ function parseStyle(stylegroup: string, line: string, style: any) { if (stylegroup.startsWith('Subtitle') || stylegroup.startsWith('Song')) { //don't touch shadow if dialog break; } - let transformed_str = st[1].split(',').map(r => r.trim()); - let arr = transformed_str[1].split(',').map(r => r.trim()); + arr = arr.map(r => { return (r.split(' ').length > 3 ? r.replace(/(\d+)px black$/, '') : r.replace(/black$/, '')).trim(); }); transformed_str[1] = arr.map(r => r.replace(/-/g, '').replace(/px/g, '').replace(/(^| )0( |$)/g, ' ').trim()).join(' '); arr = transformed_str[1].split(' ');