mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2024-11-22 11:40:13 +00:00
flip getChannelHandle logic, remove unvisible title containers
This commit is contained in:
parent
75848ad4eb
commit
4f54e1f863
@ -192,13 +192,20 @@ function buildChannelButton(channelContainer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getChannelHandle(channelContainer) {
|
function getChannelHandle(channelContainer) {
|
||||||
|
let channelHandle;
|
||||||
|
const videoOwnerRenderer = channelContainer.querySelector('.ytd-video-owner-renderer');
|
||||||
|
|
||||||
|
if (!videoOwnerRenderer) {
|
||||||
const channelHandleContainer = document.querySelector('#channel-handle');
|
const channelHandleContainer = document.querySelector('#channel-handle');
|
||||||
let channelHandle = channelHandleContainer ? channelHandleContainer.innerText : null;
|
channelHandle = channelHandleContainer ? channelHandleContainer.innerText : null;
|
||||||
if (!channelHandle) {
|
} else {
|
||||||
let href = channelContainer.querySelector('.ytd-video-owner-renderer').href;
|
const href = videoOwnerRenderer.href;
|
||||||
|
if (href) {
|
||||||
const urlObj = new URL(href);
|
const urlObj = new URL(href);
|
||||||
channelHandle = urlObj.pathname.split('/')[1];
|
channelHandle = urlObj.pathname.split('/')[1];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return channelHandle;
|
return channelHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,8 +316,14 @@ function buildChannelDownloadButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTitleContainers() {
|
function getTitleContainers() {
|
||||||
let nodes = document.querySelectorAll('#video-title');
|
let elements = document.querySelectorAll('#video-title');
|
||||||
return nodes;
|
let videoNodes = [];
|
||||||
|
elements.forEach(element => {
|
||||||
|
if (isElementVisible(element)) {
|
||||||
|
videoNodes.push(element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildVideoButton(titleContainer) {
|
function buildVideoButton(titleContainer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user