From 761030ca55157fccb3d831261e56e7a099dac011 Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Thu, 2 May 2024 00:50:34 +0530 Subject: [PATCH] Show checkmark for already downloaded currently playing videos (#35) 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);