Skip to content

Commit 52a172c

Browse files
committed
Fix notification count and red dot not hidden in title
When notifications in title is turned off
1 parent a1900dc commit 52a172c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

content-scripts/src/modules/features/dynamic.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import {
2020
KeyTypefullyGrowTab,
2121
KeyWriterMode,
2222
KeyXPremiumButton,
23-
KeyNavigationButtonsLabels
23+
KeyNavigationButtonsLabels,
24+
KeyTitleNotifications
2425
} from "../../../../storage-keys";
2526
import changeHideViewCounts from "../options/hideViewCount";
2627
import { addAnalyticsButton, addCommunitiesButton, addListsButton, addTopicsButton, addXPremiumButton, hideGrokDrawer, changeNavigationButtonsLabels } from "../options/navigation";
@@ -32,6 +33,7 @@ import { updateLeftSidebarPositioning } from "../utilities/leftSidebarPosition";
3233
import { addSmallerSearchBarStyle } from "../utilities/other-styles";
3334
import { getStorage } from "../utilities/storage";
3435
import throttle from "../utilities/throttle";
36+
import { changeTitleNotifications } from "../options/interface";
3537

3638
export const dynamicFeatures = {
3739
general: async () => {
@@ -45,6 +47,9 @@ export const dynamicFeatures = {
4547
addMediaDownloadButtons();
4648
enableGrokDrawerOnGrokButtonClick(data[KeyHideGrokDrawer]);
4749
},
50+
interface: (data) => {
51+
changeTitleNotifications(data[KeyTitleNotifications]);
52+
},
4853
typefullyPlugs: () => {
4954
saveCurrentReplyToLink();
5055
addTypefullyReplyPlug();
@@ -78,14 +83,15 @@ export const dynamicFeatures = {
7883
};
7984

8085
export const runDynamicFeatures = throttle(async () => {
81-
const data = await getStorage([KeyWriterMode, KeyFollowingTimeline, KeyTrendsHomeTimeline, KeyRemoveTimelineTabs, KeyHideGrokDrawer, KeyNavigationButtonsLabels]);
86+
const data = await getStorage([KeyWriterMode, KeyFollowingTimeline, KeyTrendsHomeTimeline, KeyRemoveTimelineTabs, KeyHideGrokDrawer, KeyNavigationButtonsLabels, KeyTitleNotifications]);
8287

8388
if (data) {
8489
dynamicFeatures.general();
8590
dynamicFeatures.typefullyPlugs();
8691
await dynamicFeatures.sidebarButtons();
8792
await dynamicFeatures.writerMode(data);
8893
dynamicFeatures.navigation(data);
94+
dynamicFeatures.interface(data);
8995

9096
// The Grok drawer appears dynamically, so we need to handle it here as well
9197
// as in the static features module

content-scripts/src/modules/options/interface.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const changeTitleNotifications = (tf) => {
1616
const favicon = document.querySelector('link[rel="shortcut icon"]');
1717

1818
if (setting === "on") {
19-
favicon.setAttribute("href", favicon.href.replace("twitter.ico", "twitter-pip.2.ico"));
19+
favicon.setAttribute("href", favicon.href.replace("twitter.3.ico", "twitter-pip.3.ico"));
2020
} else {
2121
if (document.title.charAt(0) === "(") {
2222
document.title = document.title.split(" ").slice(1).join(" ");
@@ -28,7 +28,7 @@ export const changeTitleNotifications = (tf) => {
2828

2929
clearTimeout(nt);
3030
nt = setTimeout(() => {
31-
favicon.setAttribute("href", favicon.href.replace("-pip.2", ""));
31+
favicon.setAttribute("href", favicon.href.replace("-pip.3", ".3"));
3232
});
3333
}
3434
};

0 commit comments

Comments
 (0)