Skip to content

Instantly share code, notes, and snippets.

@barraIhsan
Last active February 22, 2024 11:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barraIhsan/4ffe1590bcfa161fbab08aa18257fbaa to your computer and use it in GitHub Desktop.
Save barraIhsan/4ffe1590bcfa161fbab08aa18257fbaa to your computer and use it in GitHub Desktop.
YouTube Notification Count Remover

YouTube Notification Count Remover

Description

The YouTube Notification Count Remover is a user script that removes the notification count from the title bar on YouTube, resulting in improved visibility of video titles.

Before:

Before

After:

After

Installation

To install the script, click the following link: Install the script

Please note that you will need a browser extension like Greasemonkey or Tampermonkey to run the user script.

// ==UserScript==
// @name YouTube Notification Count Remover
// @version 1.2
// @description Removes the notification count on YouTube, improving visibility of video titles in the title bar.
// @author barraIhsan
// @match https://www.youtube.com/*
// @icon https://www.google.com/s2/favicons?domain=youtube.com
// @updateURL https://gist.github.com/barraIhsan/4ffe1590bcfa161fbab08aa18257fbaa/raw/ytRemoveNotifCount.user.js
// @downloadURL https://gist.github.com/barraIhsan/4ffe1590bcfa161fbab08aa18257fbaa/raw/ytRemoveNotifCount.user.js
// ==/UserScript==
(function() {
'use strict';
let previousTitle = document.title;
// Function to handle the title change
function handleTitleChange() {
const currentTitle = document.title;
if (currentTitle !== previousTitle) {
// Title has changed, check for parentheses content at the beginning
const updatedTitle = currentTitle.replace(/^\(\d+\)\s*/, '');
// Update the title if parentheses content is found and removed
if (currentTitle !== updatedTitle) {
document.title = updatedTitle;
}
// Update the previous title
previousTitle = currentTitle;
}
}
// Observe title changes with MutationObserver
new MutationObserver(handleTitleChange).observe(document.querySelector('title'), {childList: true});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment