Advertisement
Guest User

Untitled

a guest
Mar 26th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Tabs Title Fix
  3. // @namespace abu_pidor
  4. // @match *://*.youtube.com/*
  5. // @match *://*.spotify.com/*
  6. // @run-at document-start
  7. // ==/UserScript==
  8.  
  9. "use strict";
  10. let regex;
  11.  
  12. switch (location.hostname.match(/[^.]+\.[^.]+$/)[0]) {
  13.     case "youtube.com":
  14.         regex = / - YouTube$/;
  15.         break;
  16.     case "spotify.com":
  17.         regex = /^Spotify – /;
  18.         break;
  19. }
  20.  
  21. setInterval(() => document.title = cleanTitle(document.title, regex), 1000);
  22.  
  23. function cleanTitle(title, regex) {
  24.     return title.replace(regex, "");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement