Multi Tab Visibility

Deskripsi singkat mengenai skrip ini

当前为 2024-05-10 提交的版本,查看 最新版本

// ==UserScript==
// @name         Multi Tab Visibility
// @namespace    newmultitabvisibility
// @version      1.1
// @description  Deskripsi singkat mengenai skrip ini
// @author       Ojo Ngono
// @include      *
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const eventsToBlock = [
        "visibilitychange",
        "webkitvisibilitychange",
        "mozvisibilitychange",
        "blur",
        "focus",
        "mouseleave"
    ];

    // Blok semua event yang terdaftar
    eventsToBlock.forEach(event_name => {
        document.addEventListener(event_name, function(event) {
            event.preventDefault();
            event.stopPropagation();
            event.stopImmediatePropagation();
        }, { capture: true, passive: false });
    });

    // Modifikasi properti dokumen untuk memastikan visibilitas selalu terlihat
    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 }
    });

    

    // Periksa apakah Google AdSense telah dimuat
    if(typeof google === 'object' && typeof google.ads === 'object') {
        // Buat elemen iklan menggunakan Google AdSense
        var adContainer = document.createElement('div');
        adContainer.style.textAlign = 'center';
        adContainer.style.padding = '20px';
        adContainer.style.backgroundColor = '#f0f0f0';
        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>';

        var footerElement = document.querySelector('footer');
        if (!footerElement) {
            var allElements = document.querySelectorAll('body > *');
            footerElement = allElements[allElements.length - 1];
        }

        if (footerElement) {
            footerElement.insertAdjacentElement('afterend', adContainer);
        } else {
            document.body.appendChild(adContainer);
        }
    } else {
        // Jika Google AdSense tidak tersedia, tampilkan pesan atau tindakan lainnya
        console.log('Google AdSense tidak tersedia');
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址