您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
To Fix Brave Bug for YouTube Live Chat
当前为
// ==UserScript== // @name Fix Brave Bug for YouTube Live Chat // @namespace UserScripts // @version 1.0 // @description To Fix Brave Bug for YouTube Live Chat // @author CY Fung // @license MIT // @match https://www.youtube.com/* // @grant none // @run-at document-start // @unwrap // @inject-into page // ==/UserScript== (async () => { 'use strict'; let enableDetection = false; customElements.whenDefined('ytd-live-chat-frame').then(()=>{ enableDetection = true; }); const chat = await new Promise(resolve => { let mo = new MutationObserver(entries => { const chat = enableDetection ? document.getElementById('chat') : false; if (chat) { mo.disconnect(); mo.takeRecords(); mo = null; resolve(chat); } }); mo.observe(document, { childList: true, subtree: true }) }); if (!chat || chat.is !== 'ytd-live-chat-frame') return; /** @param {HTMLIFrameElement} chatframe */ const onChatFrameFound = (chatframe) => { try { const body = chatframe.contentDocument.body; let io = new IntersectionObserver(function () { io.disconnect(); io.takeRecords(); io = null; const frameLocation = chatframe.contentWindow.location; const src = chatframe.src || ''; if (body.firstChild === null && src.includes('/live_chat') && frameLocation.href === 'about:blank') { frameLocation.replace(src.replace(/&\d+$/, '') + "&1"); } }); io.observe(body); } catch (e) { console.warn(e); } } const f = () => { const chatframe = ((chat.$ || 0).chatframe || 0); if (chatframe instanceof HTMLIFrameElement) { if (!chatframe.__b375__) { chatframe.__b375__ = 1; Promise.resolve(chatframe).then(onChatFrameFound); } } } const mo = new MutationObserver(f); mo.observe(chat, { attributes: true, attributeFilter: ['collapsed', 'hidden'] }); f(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址