Greasy Fork

Greasy Fork is available in English.

Keep TickTock live room clean

Remove Douyin/Ticktock live room useless parts.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Keep TickTock live room clean
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  Remove Douyin/Ticktock live room useless parts.
// @author       You
// @match        https://live.douyin.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=douyin.com
// @grant        GM.addStyle
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    const CSS_HIDE = '{ display: none !important;}'
    const CSS_OPACITY_0 = '{ opacity: 0 !important; height: 0 !important;}'

    let selectorsToHide = [
        // top row
        "main > div:nth-of-type(1)",
        // top second row
        "main >  pace-island",
        // top avatar row
        //"div[data-e2e=living-container] > div:nth-of-type(1) > div:nth-of-type(1)",
        // left first column
        "#root .app-container >  pace-island > div:nth-of-type(1)",

        ".__playerIsFullChatroom",

        ".__isFullPlayer",
        ".__playerIsFull.__roomInfoBarOuter > div:nth-of-type(4)",

        ".metro",
        // right chat column
        // "div[data-e2e=living-container] > div:nth-of-type(2)",
        // bottom gift row
        "div[data-e2e=living-container] > div:nth-of-type(1) > div:nth-of-type(3)",
        // person list in chat column
        "div[data-e2e=living-container] > div:nth-of-type(2) > div:nth-of-type(1)",
        // bottom suggest div
        "div[data-e2e=living-container] + div",
        // msg in chat column
        ".webcast-chatroom__room-message",
        // bottom right feedback btn
        "#douyin-sidebar",
        // danmu
        "xg-danmu"
    ];

    // use opacity 0 instead of display none since some websites may check the ads divs later
    let selectorsToOpacity = [''];

    addStyle(selectorsToHide, CSS_HIDE);

    addStyle(selectorsToOpacity, CSS_OPACITY_0);

    function addStyle(selectors, style = CSS_HIDE) {
        let str = ``
        if(selectors){
            for (let selector of selectors) {
                str += `${selector} ${style} `;
            }
        }

        console.log(`=======================${str}`)
        GM.addStyle(str);
    }

})();