Adblock Scroll Unblocker and Ad Elements Remover for OneJailbreak.com

Enable scrolling on pages that block it due to adblock detection and remove specific ad elements

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Adblock Scroll Unblocker and Ad Elements Remover for OneJailbreak.com
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Enable scrolling on pages that block it due to adblock detection and remove specific ad elements
// @icon         https://www.google.com/s2/favicons?domain=onejailbreak.com
// @author       sharmanhall
// @match        https://onejailbreak.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to enable scrolling by changing body's style
    const enableScrolling = () => {
        document.body.style.overflow = 'auto';
    };

    // Function to remove specified elements from the page
    const removeAdElements = () => {
        // Remove the 'contentInfo' div element
        const contentInfoElement = document.getElementById('statementBox');
        if (contentInfoElement) {
            contentInfoElement.remove();
        }

        // Remove 'anchores' div elements containing ads
        const adElements = document.querySelectorAll('.anchores');
        adElements.forEach(el => el.remove());
    };

    // Wait for the document to be fully loaded
    document.addEventListener('DOMContentLoaded', () => {
        // Call the functions to enable scrolling and remove ad elements
        enableScrolling();
        removeAdElements();
    });

    // Observe for any changes that might re-disable scrolling or re-add ad elements
    const observer = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            // If body's style is modified, re-enable scrolling
            if (mutation.attributeName === 'style') {
                enableScrolling();
            }
            // Check and remove ad elements if they are added again
            removeAdElements();
        });
    });

    // Configuration for the observer
    const config = { attributes: true, childList: true, subtree: true };

    // Start observing the body element for changes in attributes and child elements
    observer.observe(document.body, config);
})();