Remove annoying Tiktok Overlay

Removes 3 overlays which forces the user to register to Tiktok

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Remove annoying Tiktok Overlay
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Removes 3 overlays which forces the user to register to Tiktok
// @author       tairasu
// @match        *://www.tiktok.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to hide divs with specific classes
    function hideDivs() {
        const classesToHide = [
            'css-v2a75e-DivModalMask e1gjoq3k2',
            'css-1dw2wty-DivCenterWrapper e1gjoq3k7',
            'css-behvuc-DivModalContainer e1gjoq3k0'
        ];

        classesToHide.forEach(className => {
            const elements = document.querySelectorAll(`.${className.split(' ').join('.')}`);
            elements.forEach(element => {
                element.style.display = 'none';
            });
        });
    }

    // Run the hideDivs function when the page loads
    window.addEventListener('load', hideDivs);

    // Run the hideDivs function whenever the DOM is updated (e.g., when new content is loaded dynamically)
    const observer = new MutationObserver(hideDivs);
    observer.observe(document.body, { childList: true, subtree: true });
})();