From 7b1c42e8e2fd62f167f0fe8302a6c6b6d624cc25 Mon Sep 17 00:00:00 2001 From: Huey Date: Sat, 4 Feb 2023 16:10:10 +0800 Subject: [PATCH] fix: avoid adding class; use variable instead --- src/content_script/mastodonInject.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content_script/mastodonInject.js b/src/content_script/mastodonInject.js index 64a3572..bf3ab7c 100644 --- a/src/content_script/mastodonInject.js +++ b/src/content_script/mastodonInject.js @@ -147,14 +147,14 @@ function initInjections() { * @returns {void} */ async function init() { - const MASTODON_INJECTED_CLASS = "mastodon-simplified-federation-injected"; - - if (document.body.classList.contains(MASTODON_INJECTED_CLASS)) { + if (typeof MASTODON_INJECTED_CLASS === "undefined"){ + // eslint-disable-next-line vars-on-top, no-var + var MASTODON_INJECTED_CLASS = true; + } else { // init has already run return; } - document.body.classList.add(MASTODON_INJECTED_CLASS); initInjections(); const observer = new MutationObserver(() => {