No YouTube Chat

Removes live chat from Youtube lives and videos

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name			No YouTube Chat
// @name:fr			No YouTube Chat
// @description		Removes live chat from Youtube lives and videos
// @description:fr	Supprime le chat des videos et lives YouTube
// @author			PsychoPatate
// @license			GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @namespace		https://github.com/PsychoPatate
// @version			1.4
// @source			https://github.com/PsychoPatate/No-YouTube-Chat
// @iconURL			https://raw.githubusercontent.com/PsychoPatate/No-YouTube-Chat/main/icon128.png
// @icon64URL		https://raw.githubusercontent.com/PsychoPatate/No-YouTube-Chat/main/icon64.png
// @supportURL		https://github.com/PsychoPatate/No-YouTube-Chat/issues
// @require			https://code.jquery.com/jquery-3.5.1.min.js
// @run-at 			document-end
// @noframes
// @grant			window.onurlchange
// @match			https://www.youtube.com/watch*
// ==/UserScript==

(function() {
	'use strict';

	function checkChat() {
		var tries = 0;
		var checkExist = setInterval(function() {
			console.log("checking for chat");
			if (tries++ > 3)
				clearInterval(checkExist);
			if ($('#chat').length) {
				$('#chat').remove();
				clearInterval(checkExist);
			}
		}, 500);
	}

	if (window.onurlchange === null){
		window.addEventListener('urlchange', function(){
			checkChat();
		})
	}

	checkChat()
})();