Fixes a severely broken UI flaw in YouTube by removing the annoying and unnecessary "(X)" from page titles. Seriously, I have 15 tabs in a row showing "(1) ...", obscuring the actual page titles. This is just stupid.
当前为
// ==UserScript==
// @name YouTube Title Fixer
// @description Fixes a severely broken UI flaw in YouTube by removing the annoying and unnecessary "(X)" from page titles. Seriously, I have 15 tabs in a row showing "(1) ...", obscuring the actual page titles. This is just stupid.
// @author Braden Best
// @namespace bradenscode.nogit
// @version 1.0.0
// @match *://*youtube.com*
// ==/UserScript==
/*
* = API =
* `youtube_title_fixer` is an object containing the following functions:
*
* kill kill the loop
* init manually start the loop
*
* You can use this interface to terminate and restart the loop for whatever reason.
*/
const youtube_title_fixer = (function(){
let loop;
function fixit(){
let pattern = /\(\d+\)\s+/;
if(document.title.match(pattern) !== null)
document.title = document.title.replace(pattern, "");
}
function kill(){
clearInterval(loop);
}
function init(){
loop = setInterval(fixit, 1000);
}
init();
return {
kill,
init
};
}());