From 43842dac85816a056591050b0e530d2d8f5d5bcf Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 28 May 2019 22:20:22 +0200 Subject: [PATCH] Do not toggle visibility if status has no CW. --- fediverse/mastodon_cw_toggle.user.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fediverse/mastodon_cw_toggle.user.js b/fediverse/mastodon_cw_toggle.user.js index 6ff1b4c..17e74f8 100644 --- a/fediverse/mastodon_cw_toggle.user.js +++ b/fediverse/mastodon_cw_toggle.user.js @@ -2,7 +2,7 @@ // @name Mastodon CW toggle // @description Toggles the visibility of all statuses with content warnings. // @namespace tastytea.de -// @version 2019-05-27_2 +// @version 2019-05-28_1 // @grant none // @run-at document-end // @downloadURL https://schlomp.space/tastytea/userscripts/raw/branch/main/fediverse/mastodon_cw_toggle.user.js @@ -18,6 +18,11 @@ function toggle() { for (let status of document.getElementsByClassName("e-content")) { + if (status.parentElement.firstChild.firstChild.className !== + "p-summary") // Skip if status has no CW. + { + continue; + } var style = status.getAttribute("style"); if (style.search("none") > -1) {