Remove YouTube Tab Notification Count

Remove your notifications count from the tab title on YouTube.

  1. // ==UserScript==
  2. // @name Remove YouTube Tab Notification Count
  3. // @match *://*.youtube.com/*
  4. // @version 1.0
  5. // @author yodaluca23
  6. // @license GNU GPLv3
  7. // @description Remove your notifications count from the tab title on YouTube.
  8. // @namespace https://greasyfork.org/users/1315976
  9. // ==/UserScript==
  10.  
  11. // Save the original descriptor of document.title
  12. const originalTitleDescriptor = Object.getOwnPropertyDescriptor(Document.prototype, 'title');
  13.  
  14. // Create a custom getter and setter
  15. Object.defineProperty(document, 'title', {
  16. get: function() {
  17. return originalTitleDescriptor.get.call(this);
  18. },
  19. set: function(newValue) {
  20. // Remove the (#) with regex.
  21. const interceptedValue = newValue.replace(/^\(\d+\)\s?/, "");
  22.  
  23. // Call the original setter
  24. originalTitleDescriptor.set.call(this, interceptedValue);
  25. }
  26. });