Restrict toggling to conversation.

This commit is contained in:
tastytea 2019-06-12 21:30:22 +02:00
parent de1aa38117
commit 1375d24e84
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 5 additions and 4 deletions

View File

@ -83,11 +83,11 @@ function check()
}
}
const main = document.getElementsByClassName("main")[0];
const root = get_root_elements();
// if root element and a status was found, disable interval and add button.
if (root.length !== 0
&& main.getElementsByClassName("status-content").length > 0)
&& root[0].parentElement
.getElementsByClassName("status-content").length > 0)
{
if (!is_timeline)
{
@ -96,9 +96,10 @@ function check()
for (let element of root)
{
const parent = element.parentElement;
// Only add button if one or more statuses have a CW.
if (main.getElementsByClassName("cw-status-hider").length > 0
|| main.getElementsByClassName("status-unhider").length > 0)
if (parent.getElementsByClassName("cw-status-hider").length > 0
|| parent.getElementsByClassName("status-unhider").length > 0)
{
if (element.getElementsByClassName("global-cw-toggle")
.length > 0) // Skip if button is already there.