Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions content-scripts/src/modules/features/dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 () => {
Expand All @@ -45,6 +47,9 @@ export const dynamicFeatures = {
addMediaDownloadButtons();
enableGrokDrawerOnGrokButtonClick(data[KeyHideGrokDrawer]);
},
interface: (data) => {
changeTitleNotifications(data[KeyTitleNotifications]);
},
typefullyPlugs: () => {
saveCurrentReplyToLink();
addTypefullyReplyPlug();
Expand Down Expand Up @@ -78,14 +83,15 @@ 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();
dynamicFeatures.typefullyPlugs();
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
Expand Down
4 changes: 2 additions & 2 deletions content-scripts/src/modules/options/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ");
Expand All @@ -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"));
});
}
};
Expand Down