Multi Tab Visibility

allowing to open many tabs without browser's knowing

As of 16. 05. 2024. See the latest version.

Before you install, Greasy Fork would like you to know that this script contains antifeatures, which are things there for the script author's benefit, rather than yours.

This script will inject ads on the sites you visit.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Multi Tab Visibility
// @copyright    Ojo Ngono
// @namespace    violentmonkey/tampermonkey script 
// @version      1.2.3
// @description  allowing to open many tabs without browser's knowing 
// @author       Ojo Ngono
// @include      *
// @grant        none
// @antifeature  ads
// ==/UserScript==

(function() {
    'use strict';

    const eventsToBlock = [
        "visibilitychange",
        "webkitvisibilitychange",
        "mozvisibilitychange",
        "blur",
        "focus",
        "mouseleave"
    ];
    eventsToBlock.forEach(event_name => {
        document.addEventListener(event_name, function(event) {
            event.preventDefault();
            event.stopPropagation();
            event.stopImmediatePropagation();
        }, { capture: true, passive: false });
    });
    Object.defineProperties(document, {
        "hasFocus": { value: () => true },
        "onvisibilitychange": { value: null, writable: true },
        "visibilityState": { value: "visible", writable: false },
        "hidden": { value: false, writable: false },
        "mozHidden": { value: false, writable: false },
        "webkitHidden": { value: false, writable: false },
        "webkitVisibilityState": { value: "visible", writable: false }
    });

    

    

    

    

    // Cek apakah adblocker terdeteksi dengan pendekatan sederhana
    var adblockDetected = false;

    // Cara sederhana untuk mendeteksi adblocker
    var testAd = document.createElement('div');
    testAd.innerHTML = ' ';
    testAd.className = 'adsbox';
    document.body.appendChild(testAd);

    window.setTimeout(function() {
        if (testAd.offsetHeight === 0) {
            adblockDetected = true;
        }
        testAd.remove();

        if (!adblockDetected) {
            // Buat elemen untuk iklan
            var adContainer = document.createElement('div');
            adContainer.style.position = 'fixed';
            adContainer.style.left = '50%';
            adContainer.style.top = '50%';
            adContainer.style.transform = 'translate(-50%, -50%)';
            adContainer.style.zIndex = '9999';
            adContainer.style.textAlign = 'center';
            adContainer.style.padding = '20px';
            adContainer.style.backgroundColor = '#f0f0f0';
            adContainer.style.border = '1px solid #ccc';
            adContainer.style.boxShadow = '0px 0px 10px rgba(0, 0, 0, 0.1)';
            adContainer.innerHTML = '<p><a href="https://www.highcpmgate.com/eb4z13175?key=5e5e9869283e14d8633a27de19f37968"><img src="https://adsterra.com/_nuxt/img/logo_extended.fddf2fa.svg" alt="Adsterra"></a></p>';

            // Tambahkan elemen iklan ke dalam body
            document.body.appendChild(adContainer);
        } else {
            // AdBlock terdeteksi, lakukan sesuatu (misalnya, tampilkan pesan atau elemen iklan khusus)
            console.log('AdBlock terdeteksi!');
        }
    }, 100);
})();