Skip to content

Commit

Permalink
implement observer
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Sep 11, 2024
1 parent db19915 commit 88a3379
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/features/tweaks/hide_following_notification_badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ export const styleElement = buildStyle(`
}
`);

const onTitleChanged = ([titleElement]) => {
const onTitleChanged = () => {
const titleElement = document.querySelector('head title:not([data-xkit])');

const rawTitle = titleElement.textContent;
const newTitle = rawTitle.replace(/^\(\d{1,2}\) /, '');
customTitleElement.textContent = newTitle;

new MutationObserver(onTitleChanged).observe(titleElement, { characterData: true, subtree: true });
};

export const main = async () => {
Expand Down

0 comments on commit 88a3379

Please sign in to comment.