From 3b10bc39ecc0cb8385ef9ff6b31ee81cce29d2b8 Mon Sep 17 00:00:00 2001 From: dineshs91 Date: Wed, 16 Apr 2025 20:34:04 +0530 Subject: [PATCH] Fix notification count and red dot not hidden in title When notifications in title is turned off --- content-scripts/src/modules/features/dynamic.js | 10 ++++++++-- content-scripts/src/modules/options/interface.js | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/content-scripts/src/modules/features/dynamic.js b/content-scripts/src/modules/features/dynamic.js index 41696d6c..bb63126b 100644 --- a/content-scripts/src/modules/features/dynamic.js +++ b/content-scripts/src/modules/features/dynamic.js @@ -20,7 +20,8 @@ import { KeyTypefullyGrowTab, KeyWriterMode, KeyXPremiumButton, - KeyNavigationButtonsLabels + KeyNavigationButtonsLabels, + KeyTitleNotifications } from "../../../../storage-keys"; import changeHideViewCounts from "../options/hideViewCount"; import { addAnalyticsButton, addCommunitiesButton, addListsButton, addTopicsButton, addXPremiumButton, hideGrokDrawer, changeNavigationButtonsLabels } from "../options/navigation"; @@ -32,6 +33,7 @@ import { updateLeftSidebarPositioning } from "../utilities/leftSidebarPosition"; import { addSmallerSearchBarStyle } from "../utilities/other-styles"; import { getStorage } from "../utilities/storage"; import throttle from "../utilities/throttle"; +import { changeTitleNotifications } from "../options/interface"; export const dynamicFeatures = { general: async () => { @@ -45,6 +47,9 @@ export const dynamicFeatures = { addMediaDownloadButtons(); enableGrokDrawerOnGrokButtonClick(data[KeyHideGrokDrawer]); }, + interface: (data) => { + changeTitleNotifications(data[KeyTitleNotifications]); + }, typefullyPlugs: () => { saveCurrentReplyToLink(); addTypefullyReplyPlug(); @@ -78,7 +83,7 @@ export const dynamicFeatures = { }; export const runDynamicFeatures = throttle(async () => { - const data = await getStorage([KeyWriterMode, KeyFollowingTimeline, KeyTrendsHomeTimeline, KeyRemoveTimelineTabs, KeyHideGrokDrawer, KeyNavigationButtonsLabels]); + const data = await getStorage([KeyWriterMode, KeyFollowingTimeline, KeyTrendsHomeTimeline, KeyRemoveTimelineTabs, KeyHideGrokDrawer, KeyNavigationButtonsLabels, KeyTitleNotifications]); if (data) { dynamicFeatures.general(); @@ -86,6 +91,7 @@ export const runDynamicFeatures = throttle(async () => { await dynamicFeatures.sidebarButtons(); await dynamicFeatures.writerMode(data); dynamicFeatures.navigation(data); + dynamicFeatures.interface(data); // The Grok drawer appears dynamically, so we need to handle it here as well // as in the static features module diff --git a/content-scripts/src/modules/options/interface.js b/content-scripts/src/modules/options/interface.js index 9821aef3..552a0153 100644 --- a/content-scripts/src/modules/options/interface.js +++ b/content-scripts/src/modules/options/interface.js @@ -16,7 +16,7 @@ export const changeTitleNotifications = (tf) => { const favicon = document.querySelector('link[rel="shortcut icon"]'); if (setting === "on") { - favicon.setAttribute("href", favicon.href.replace("twitter.ico", "twitter-pip.2.ico")); + favicon.setAttribute("href", favicon.href.replace("twitter.3.ico", "twitter-pip.3.ico")); } else { if (document.title.charAt(0) === "(") { document.title = document.title.split(" ").slice(1).join(" "); @@ -28,7 +28,7 @@ export const changeTitleNotifications = (tf) => { clearTimeout(nt); nt = setTimeout(() => { - favicon.setAttribute("href", favicon.href.replace("-pip.2", "")); + favicon.setAttribute("href", favicon.href.replace("-pip.3", ".3")); }); } };