aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-12-29 00:21:38 -0500
committerAjay Ramachandran <[email protected]>2019-12-29 00:21:38 -0500
commitc14c795474ef83c81c9baaa52c4db87adb1aef63 (patch)
treefbcb162962402721450faaa897f25470224f3b64
parente5937431c36bbe40c300dea1265b06000a16bdd7 (diff)
downloadSponsorBlock-c14c795474ef83c81c9baaa52c4db87adb1aef63.tar.gz
SponsorBlock-c14c795474ef83c81c9baaa52c4db87adb1aef63.zip
Improved channel name query selector.
Resolves https://github.com/ajayyy/SponsorBlock/issues/199
-rw-r--r--content.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/content.js b/content.js
index 2bb21dee..0a829e51 100644
--- a/content.js
+++ b/content.js
@@ -498,19 +498,12 @@ function updatePreviewBar() {
function getChannelID() {
//get channel id
- let channelNameContainer = document.getElementById("channel-name");
-
let channelURLContainer = null;
- if (channelNameContainer !== null) {
- try {
- channelURLContainer = channelNameContainer.querySelector("#container").querySelector("#text-container").querySelector("#text").firstElementChild;
- } catch (e) {
- channelURLContainer = null
- }
- }
-
- if (channelURLContainer == null) {
+ channelURLContainer = document.querySelector("#channel-name > #container > #text-container > #text");
+ if (channelURLContainer !== null) {
+ channelURLContainer = channelURLContainer.firstElementChild;
+ } else {
//old YouTube theme
let channelContainers = document.getElementsByClassName("yt-user-info");
if (channelContainers.length != 0) {