mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2024-11-22 11:40:13 +00:00
add dl button to shorts results
This commit is contained in:
parent
79a002956b
commit
5406007315
@ -312,8 +312,13 @@ function buildVideoButton(titleContainer) {
|
|||||||
dlButton.classList.add('ta-button');
|
dlButton.classList.add('ta-button');
|
||||||
dlButton.href = '#';
|
dlButton.href = '#';
|
||||||
|
|
||||||
let params = new URLSearchParams(href);
|
let videoId;
|
||||||
let videoId = params.get('/watch?v');
|
if (href.startsWith('/watch?v')) {
|
||||||
|
let params = new URLSearchParams(href);
|
||||||
|
videoId = params.get('/watch?v');
|
||||||
|
} else if (href.startsWith('/shorts/')) {
|
||||||
|
videoId = href.split('/')[2];
|
||||||
|
}
|
||||||
if (!videoId) return;
|
if (!videoId) return;
|
||||||
|
|
||||||
dlButton.setAttribute('data-id', videoId);
|
dlButton.setAttribute('data-id', videoId);
|
||||||
@ -365,7 +370,7 @@ function getNearestLink(element) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function processTitle(titleContainer) {
|
function processTitle(titleContainer) {
|
||||||
if (titleContainer.hasListener) return
|
if (titleContainer.hasListener) return;
|
||||||
Object.assign(titleContainer.style, {
|
Object.assign(titleContainer.style, {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
gap: '15px',
|
gap: '15px',
|
||||||
|
Loading…
Reference in New Issue
Block a user