From 8abcd698fa582c132a73f716598aba49a9e12fca Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Sun, 7 Apr 2024 12:44:11 +0530 Subject: [PATCH] Show checkmark for already downloaded currently playing videos Looks like this was regressed from v0.2.1 to v0.2.2 in this commit sha: f8d69f58830e178b3eb34e386e6adaee6298ec3f Already downloaded video currently playing in YouTube were still showing the download icon instead of checkmark icon in TA. This commit should fix this. --- extension/script.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/extension/script.js b/extension/script.js index 42d1e61..e2fc3d6 100644 --- a/extension/script.js +++ b/extension/script.js @@ -437,11 +437,13 @@ function checkVideoExists(taButton) { console.error(e); } - if (!taButton.parentElement) return; - let videoId = getVideoId(taButton.parentElement); - taButton.setAttribute('data-id', videoId); - taButton.setAttribute('data-type', 'video'); - taButton.title = `TA download video: ${taButton.parentElement.innerText} [${videoId}]`; + let videoId = taButton.dataset.id; + if (taButton.parentElement) { + videoId = getVideoId(taButton.parentElement); + taButton.setAttribute('data-id', videoId); + taButton.setAttribute('data-type', 'video'); + taButton.title = `TA download video: ${taButton.parentElement.innerText} [${videoId}]`; + } let message = { type: 'videoExists', videoId }; let sending = sendMessage(message);