Twitch Title Fix

Recent Twitch UI change where title is above video player. This reverts that.

当前为 2024-12-11 提交的版本,查看 最新版本

// ==UserScript==
// @name         Twitch Title Fix
// @namespace    http://tampermonkey.net/
// @version      0.0.2
// @description  Recent Twitch UI change where title is above video player. This reverts that.
// @author       Nanakusa
// @match        https://www.twitch.tv/*
// @icon         https://static-cdn.jtvnw.net/jtv_user_pictures/6a277ac2-ed5f-4daf-bb27-5a605b69a1f2-profile_image-300x300.png
// @grant        none
// @license MIT
// ==/UserScript==

function fixPosition() {
    const item = document.querySelector('.channel-root__upper-watch');
    const container = document.querySelector('.channel-info-content');
    const beforeDiv = container.querySelector("section");
    if (!item || !container || !beforeDiv) return;
    if (!container.querySelector(".channel-root__upper-watch"))
    container.insertBefore(item, beforeDiv);
    item.style.width = "100%";
};

window.addEventListener('load', () => {
    fixPosition();
});

fixPosition();

new MutationObserver(mutations => {
    mutations.forEach(mutation => {
        if (mutation.type === 'childList' || mutation.type === 'attributes') {
            fixPosition();
        }
    });
}).observe(document.body, { childList: true, subtree: true, attributes: true });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址