mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2024-11-22 11:40:13 +00:00
make download button on thumbnail easier to find
This commit is contained in:
parent
9fadbd5c15
commit
b19b09bb84
@ -215,6 +215,8 @@ function buildVideoButton(thumbContainer) {
|
|||||||
let thumbLink = thumbContainer?.href;
|
let thumbLink = thumbContainer?.href;
|
||||||
if (!thumbLink) return;
|
if (!thumbLink) return;
|
||||||
if (thumbLink.includes('list=') || thumbLink.includes('/shorts/')) return;
|
if (thumbLink.includes('list=') || thumbLink.includes('/shorts/')) return;
|
||||||
|
let ggp = thumbContainer?.parentElement?.parentElement;
|
||||||
|
if (ggp?.id !== 'dismissible') return;
|
||||||
|
|
||||||
let dlButton = document.createElement('a');
|
let dlButton = document.createElement('a');
|
||||||
dlButton.setAttribute('id', 'ta-video-button');
|
dlButton.setAttribute('id', 'ta-video-button');
|
||||||
@ -226,14 +228,14 @@ function buildVideoButton(thumbContainer) {
|
|||||||
console.log('download: ' + videoLink);
|
console.log('download: ' + videoLink);
|
||||||
sendUrl(videoLink, 'download', dlButton);
|
sendUrl(videoLink, 'download', dlButton);
|
||||||
});
|
});
|
||||||
dlButton.addEventListener('mouseover', e => {
|
ggp.addEventListener('mouseover', e => {
|
||||||
Object.assign(dlButton.style, {
|
Object.assign(dlButton.style, {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
});
|
});
|
||||||
let videoTitle = thumbContainer.href;
|
let videoTitle = thumbContainer.href;
|
||||||
e.target.title = 'TA download: ' + videoTitle;
|
e.target.title = 'TA download: ' + videoTitle;
|
||||||
});
|
});
|
||||||
dlButton.addEventListener('mouseout', () => {
|
ggp.addEventListener('mouseout', () => {
|
||||||
Object.assign(dlButton.style, {
|
Object.assign(dlButton.style, {
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
});
|
});
|
||||||
@ -252,7 +254,6 @@ function buildVideoButton(thumbContainer) {
|
|||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
transition: 'all 0.3s ease 0.3s',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let dlIcon = document.createElement('span');
|
let dlIcon = document.createElement('span');
|
||||||
|
Loading…
Reference in New Issue
Block a user