From 6193b51f594940666cfa26596594a94fac102a42 Mon Sep 17 00:00:00 2001 From: Joel2B Date: Sat, 2 Jul 2022 13:30:47 -0600 Subject: [PATCH] fix: change generated subtitles --- src/extension/modules/subtitles.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/extension/modules/subtitles.js b/src/extension/modules/subtitles.js index 7b2969f..5652d19 100644 --- a/src/extension/modules/subtitles.js +++ b/src/extension/modules/subtitles.js @@ -367,7 +367,10 @@ export async function translateSubtitles() { } // everything will work if the automatic translation button is at the end - subtituleItems[subtituleItems.length - 1].click(); + const lastIndexItem = subtituleItems.length - 1; + const offset = subtituleItems[lastIndexItem].textContent.includes('>>') ? 1 : 0; + + subtituleItems[lastIndexItem - offset].click(); } await delay(0);