Greasy Fork is available in English.

Disable Page Visibility API

Disable Page Visibility API Script

// ==UserScript==
// @name Disable Page Visibility API
// @version 1.1.1
// @description Disable Page Visibility API Script
// @match *://*/*
// @license MIT
// @grant none
// @run-at document-start
// @namespace https://greasyfork.org/users/956726
// ==/UserScript==

(function() {
    'use strict';

    Object.defineProperties(document,{ 'hidden': {value: false} });
    Object.defineProperties(document,{ 'mozHidden': {value: false} });
    Object.defineProperties(document,{ 'webkitHidden': {value: false} });
    Object.defineProperties(document,{ 'visibilityState': {value: 'visible'} });
    Object.defineProperties(document,{ 'mozvisibilityState': {value: 'visible'} });
    Object.defineProperties(document,{ 'webkitvisibilityState': {value: 'visible'} });

    const evt = e => {
        e.preventDefault();
        e.stopPropagation();
        e.stopImmediatePropagation();
    };
    document.addEventListener('visibilitychange', evt, true);
    document.addEventListener('mozvisibilitychange', evt, true);
    document.addEventListener('webkitvisibilitychange', evt, true);
    document.addEventListener('blur', evt, true);
    document.addEventListener('focus', evt, true);
    document.addEventListener('hasFocus', evt, true);

    console.log('Disable Page Visibility API Enabled.');
})();