From b19b09bb84671694c41507a49b9bbc10bdb8e0c4 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Fri, 2 Dec 2022 21:07:29 -0800 Subject: [PATCH 1/2] make download button on thumbnail easier to find --- extension/script.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extension/script.js b/extension/script.js index 9f58ce7..46357f0 100644 --- a/extension/script.js +++ b/extension/script.js @@ -215,6 +215,8 @@ function buildVideoButton(thumbContainer) { let thumbLink = thumbContainer?.href; if (!thumbLink) return; if (thumbLink.includes('list=') || thumbLink.includes('/shorts/')) return; + let ggp = thumbContainer?.parentElement?.parentElement; + if (ggp?.id !== 'dismissible') return; let dlButton = document.createElement('a'); dlButton.setAttribute('id', 'ta-video-button'); @@ -226,14 +228,14 @@ function buildVideoButton(thumbContainer) { console.log('download: ' + videoLink); sendUrl(videoLink, 'download', dlButton); }); - dlButton.addEventListener('mouseover', e => { + ggp.addEventListener('mouseover', e => { Object.assign(dlButton.style, { opacity: 1, }); let videoTitle = thumbContainer.href; e.target.title = 'TA download: ' + videoTitle; }); - dlButton.addEventListener('mouseout', () => { + ggp.addEventListener('mouseout', () => { Object.assign(dlButton.style, { opacity: 0, }); @@ -252,7 +254,6 @@ function buildVideoButton(thumbContainer) { borderRadius: '8px', cursor: 'pointer', opacity: 0, - transition: 'all 0.3s ease 0.3s', }); let dlIcon = document.createElement('span'); From a2e167c9cf92777de5d4f404b8238b798ee3d2a9 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Fri, 2 Dec 2022 21:28:28 -0800 Subject: [PATCH 2/2] fix title --- extension/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/script.js b/extension/script.js index 46357f0..dd426ec 100644 --- a/extension/script.js +++ b/extension/script.js @@ -228,12 +228,12 @@ function buildVideoButton(thumbContainer) { console.log('download: ' + videoLink); sendUrl(videoLink, 'download', dlButton); }); - ggp.addEventListener('mouseover', e => { + ggp.addEventListener('mouseover', () => { Object.assign(dlButton.style, { opacity: 1, }); let videoTitle = thumbContainer.href; - e.target.title = 'TA download: ' + videoTitle; + dlButton.title = 'TA download: ' + videoTitle; }); ggp.addEventListener('mouseout', () => { Object.assign(dlButton.style, {