Greasy Fork is available in English.

Disable Page Visibility API

Disable Page Visibility API Script

// ==UserScript==
// @name Disable Page Visibility API
// @version 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'} });

    document.addEventListener( 'visibilitychange', evt => evt.stopImmediatePropagation(), true);
    document.addEventListener( 'mozvisibilitychange', evt => evt.stopImmediatePropagation(), true);
    document.addEventListener( 'webkitvisibilitychange', evt => evt.stopImmediatePropagation(), true);
    document.addEventListener( 'blur', evt => evt.stopImmediatePropagation(), true);
    document.addEventListener( 'focus', evt => evt.stopImmediatePropagation(), true);
    document.hasFocus = function () {return true;};

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