Let Me Scroll

Block website from disabling to scroll

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Let Me Scroll
// @namespace    http://tampermonkey.net/
// @version      20240619-02
// @description  Block website from disabling to scroll
// @author       polyarkk
// @match        https://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

function createAntiAntiScrollingObserver(element) {
    const observer = new MutationObserver((mutationsList, observer) => {
        for (const mutation of mutationsList) {
            if (mutation.type === "attributes") {
                if (mutation.attributeName === "style") {
                    if (element.style.overflow === "hidden") {
                        console.log("website is attempting to disable scrolling...");
                        element.style.overflow = "auto";
                    }
                }
            }
        }
    });

    observer.observe(element, { attributes: true });
    element.style.overflow = "auto";

    return {
        element,
        observer
    }
}

(() => {
    'use strict';
    createAntiAntiScrollingObserver(document.body);
    createAntiAntiScrollingObserver(document.documentElement);
})();