OmniFocus

Make sure websites always think you are focused on them

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name          OmniFocus
// @namespace     https://greasyfork.org/en/users/198860-zyenith
// @author        zyenith
// @version       0.0.1
// @description   Make sure websites always think you are focused on them
// @match         *://*/*
// @run-at        document-start
// @grant         unsafeWindow
// @antifeature   Tracking, for compatibility info
// @require       https://greasyfork.org/scripts/410512-sci-js-from-ksw2-center/code/scijs%20(from%20ksw2-center).js
// ==/UserScript==

const { document } = unsafeWindow;

unsafeWindow.onblur = null;
unsafeWindow.blurred = false;

unsafeWindow.document.hasFocus = function() {
    return true;
};

unsafeWindow.document.onvisibilitychange = undefined;

const _arr = ["visibilitychange", "webkitvisibilitychange", "blur", "mozvisibilitychange", "msvisibilitychange"];
for (const eventName of _arr) {
    unsafeWindow.document.addEventListener(eventName, (event) => {
        event.stopImmediatePropagation();
    }, true);
}

Object.defineProperties(unsafeWindow.document, {
    hidden: {
        value: false
    },
    mozHidden: {
        value: false
    },
    msHidden: {
        value: false
    },
    webkitHidden: {
        value: false
    },
    visibilityState: {
        get() {
            return "visible";
        }
    }
});