TierMaker AdBlock Scroll Fix

Fixes page scrolling issue after using ad blockers | 修复使用广告屏蔽工具后页面无法滚动的问题

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         TierMaker AdBlock Scroll Fix
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Fixes page scrolling issue after using ad blockers | 修复使用广告屏蔽工具后页面无法滚动的问题
// @author       jotenbai
// @match        *://tiermaker.com/*
// @license      MIT
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    // 核心修复函数
    const fixScroll = () => {
        // 强制覆盖HTML和body元素的overflow样式
        document.documentElement.style.overflow = 'auto';
        document.body.style.overflow = 'auto';

        // 创建防篡改样式标签
        const style = document.createElement('style');
        style.innerHTML = `
            html, body {
                overflow: auto !important;
                position: static !important;
            }
            body.prevent-scroll {
                overflow: auto !important;
            }
        `;
        document.head.appendChild(style);
    };

    // 初始执行
    fixScroll();

    // 持续监控防止网站重新锁定
    const observer = new MutationObserver((mutations) => {
        if (document.documentElement.style.overflow === 'hidden' ||
            document.body.style.overflow === 'hidden') {
            fixScroll();
        }
    });

    // 监控HTML和body的属性变化
    observer.observe(document.documentElement, {
        attributes: true,
        attributeFilter: ['style']
    });
    observer.observe(document.body, {
        attributes: true,
        attributeFilter: ['style']
    });

    // 添加定时保险(每2秒检查一次)
    setInterval(fixScroll, 2000);
})();