mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2025-02-05 15:40:14 +00:00
lint
This commit is contained in:
parent
cb4082362b
commit
c18ccd6e78
@ -106,7 +106,9 @@ function getBrowser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getChannelContainers() {
|
function getChannelContainers() {
|
||||||
const elements = document.querySelectorAll('.page-header-view-model-wiz__page-header-flexible-actions, #owner');
|
const elements = document.querySelectorAll(
|
||||||
|
'.page-header-view-model-wiz__page-header-flexible-actions, #owner'
|
||||||
|
);
|
||||||
const channelContainerNodes = [];
|
const channelContainerNodes = [];
|
||||||
|
|
||||||
elements.forEach(element => {
|
elements.forEach(element => {
|
||||||
@ -194,15 +196,13 @@ function buildChannelButton(channelContainer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getChannelHandle(channelContainer) {
|
function getChannelHandle(channelContainer) {
|
||||||
|
|
||||||
function findeHandleString(container) {
|
function findeHandleString(container) {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
function recursiveTraversal(element) {
|
function recursiveTraversal(element) {
|
||||||
for (let child of element.children) {
|
for (let child of element.children) {
|
||||||
|
if (child.tagName === 'A' && child.hasAttribute('href')) {
|
||||||
if (child.tagName === "A" && child.hasAttribute("href")) {
|
const href = child.getAttribute('href');
|
||||||
const href = child.getAttribute("href");
|
|
||||||
const match = href.match(/\/@[^/]+/); // Match the path starting with "@"
|
const match = href.match(/\/@[^/]+/); // Match the path starting with "@"
|
||||||
if (match) {
|
if (match) {
|
||||||
// handle is in channel link
|
// handle is in channel link
|
||||||
@ -211,17 +211,17 @@ function getChannelHandle(channelContainer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child.children.length === 0 && child.textContent.trim().startsWith("@")) {
|
if (child.children.length === 0 && child.textContent.trim().startsWith('@')) {
|
||||||
// handle is in channel description text
|
// handle is in channel description text
|
||||||
result = child.textContent.trim();
|
result = child.textContent.trim();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
recursiveTraversal(child);
|
recursiveTraversal(child);
|
||||||
if (result) return;
|
if (result) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recursiveTraversal(container);
|
recursiveTraversal(container);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user