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) {
|
||||||
const channelHandleContainer = document.querySelector('#channel-handle');
|
let channelHandle;
|
||||||
let channelHandle = channelHandleContainer ? channelHandleContainer.innerText : null;
|
const videoOwnerRenderer = channelContainer.querySelector('.ytd-video-owner-renderer');
|
||||||
if (!channelHandle) {
|
|
||||||
let href = channelContainer.querySelector('.ytd-video-owner-renderer').href;
|
if (!videoOwnerRenderer) {
|
||||||
const urlObj = new URL(href);
|
const channelHandleContainer = document.querySelector('#channel-handle');
|
||||||
channelHandle = urlObj.pathname.split('/')[1];
|
channelHandle = channelHandleContainer ? channelHandleContainer.innerText : null;
|
||||||
|
} else {
|
||||||
|
const href = videoOwnerRenderer.href;
|
||||||
|
if (href) {
|
||||||
|
const urlObj = new URL(href);
|
||||||
|
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