Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 43e0912

Browse files
committed
limit required mo options
1 parent 2182c65 commit 43e0912

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

code/foreground.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const channel_mo = new MutationObserver((mutations) => {
5959
if (prev_channel_offline && !curr_channel_offline) {
6060
let timeout_id = null;
6161

62-
const btns_section = document.querySelector(".metadata-layout__support").children[1];
62+
const btns_section = document.querySelector('[data-target="channel-header-right"]');
6363
const btns_section_mo = new MutationObserver((mutations) => {
6464
for (const mutation of mutations) {
6565
for (const node of mutation.removedNodes) {
@@ -75,7 +75,7 @@ const channel_mo = new MutationObserver((mutations) => {
7575
}
7676
});
7777
btns_section_mo.observe(document.body, {
78-
attributes: true,
78+
attributes: false,
7979
childList: true,
8080
subtree: true
8181
});
@@ -215,7 +215,8 @@ function add_star_btn() {
215215
}
216216
});
217217

218-
document.querySelector('[data-target="channel-header-right"]').prepend(star_btn);
218+
const btns_section = document.querySelector('[data-target="channel-header-right"]');
219+
btns_section.prepend(star_btn);
219220
}
220221

221222
function remove_star_btn() {
@@ -324,9 +325,9 @@ function update_channels_lists() {
324325
followed_channels_list_mo.disconnect();
325326
followed_channels_list = followed_channels_section.querySelector(".tw-transition-group"); // need to get this per cycle bc ttv occasionally replaces followed_channels_list w a new one
326327
followed_channels_list_mo.observe(followed_channels_list, {
327-
attributes: true,
328+
attributes: false,
328329
childList: true,
329-
subtree: true
330+
subtree: false
330331
});
331332

332333
const show_more_times_clicked = expand_followed_channels_list();
@@ -387,7 +388,7 @@ async function main() {
387388
console.log(favorites);
388389

389390
sidebar_mo.observe(document.body, {
390-
attributes: true,
391+
attributes: false,
391392
childList: true,
392393
subtree: true
393394
});
@@ -402,7 +403,7 @@ async function main() {
402403
console.log("channel");
403404

404405
channel_mo.observe(document.body, {
405-
attributes: true,
406+
attributes: false,
406407
childList: true,
407408
subtree: true
408409
});

0 commit comments

Comments
 (0)