mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Improved channel name query selector.
Resolves https://github.com/ajayyy/SponsorBlock/issues/199
This commit is contained in:
15
content.js
15
content.js
@@ -498,19 +498,12 @@ function updatePreviewBar() {
|
|||||||
|
|
||||||
function getChannelID() {
|
function getChannelID() {
|
||||||
//get channel id
|
//get channel id
|
||||||
let channelNameContainer = document.getElementById("channel-name");
|
|
||||||
|
|
||||||
let channelURLContainer = null;
|
let channelURLContainer = null;
|
||||||
|
|
||||||
if (channelNameContainer !== null) {
|
channelURLContainer = document.querySelector("#channel-name > #container > #text-container > #text");
|
||||||
try {
|
if (channelURLContainer !== null) {
|
||||||
channelURLContainer = channelNameContainer.querySelector("#container").querySelector("#text-container").querySelector("#text").firstElementChild;
|
channelURLContainer = channelURLContainer.firstElementChild;
|
||||||
} catch (e) {
|
} else {
|
||||||
channelURLContainer = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channelURLContainer == null) {
|
|
||||||
//old YouTube theme
|
//old YouTube theme
|
||||||
let channelContainers = document.getElementsByClassName("yt-user-info");
|
let channelContainers = document.getElementsByClassName("yt-user-info");
|
||||||
if (channelContainers.length != 0) {
|
if (channelContainers.length != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user