Absolute Visibility

Makes tabs and windows think they're visible even when they're not.

Από την 07/12/2022. Δείτε την τελευταία έκδοση.

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @require https://update.greasyfork.org/scripts/456228/1125940/Absolute%20Visibility.js

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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.

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

const knife = `const script = document.currentScript;
const isFirefox = /Firefox/.test(navigator.userAgent) || typeof InstallTrigger !== 'undefined';

const block = e => {
	e.preventDefault();
	e.stopPropagation();
	e.stopImmediatePropagation();
};

const once = {
	focus: true,
	visibilitychange: true,
	webkitvisibilitychange: true
};

/* visibility */
Object.defineProperty(document, 'visibilityState', {
	get() {
		return 'visible';
	}
});
if (isFirefox === false) {
	Object.defineProperty(document, 'webkitVisibilityState', {
		get() {
			return 'visible';
		}
	});
}
document.addEventListener('visibilitychange', e => {
	script.dispatchEvent(new Event('state'));
	if (script.dataset.visibility !== 'false') {
		if (once.visibilitychange) {
			once.visibilitychange = false;
			return;
		}
		return block(e);
	}
}, true);
document.addEventListener('webkitvisibilitychange', e => {
	if (script.dataset.visibility !== 'false') {
		if (once.webkitvisibilitychange) {
			once.webkitvisibilitychange = false;
			return;
		}
		return block(e);
	}
}, true);


window.addEventListener('pagehide', e => script.dataset.visibility !== 'false' && block(e), true);

/* hidden */
Object.defineProperty(document, 'hidden', {
	get() {
		return false;
	}
});
Object.defineProperty(document, isFirefox ? 'mozHidden' : 'webkitHidden', {
	get() {
		return false;
	}
});

/* focus */
Document.prototype.hasFocus = new Proxy(Document.prototype.hasFocus, {
	apply(target, self, args) {
		if (script.dataset.focus !== 'false') {
			return true;
		}
		return Reflect.apply(target, self, args);
	}
});

const onfocus = e => {
	if (script.dataset.focus !== 'false') {
		if (e.target === document || e.target === window) {
			if (once.focus && document.readyState === 'complete' && e.target === window) {
				once.focus = false;
				return;
			}
			return block(e);
		}
	}
};
// document.addEventListener('focus', onfocus, true);
window.addEventListener('focus', onfocus, true);


/* blur */
const onblur = e => {
	if (script.dataset.blur !== 'false') {
		if (e.target === document || e.target === window) {
			return block(e);
		}
	}
};
document.addEventListener('blur', onblur, true);
window.addEventListener('blur', onblur, true);

/* mouse */
window.addEventListener('mouseleave', e => {
	if (script.dataset.mouseleave !== 'false') {
		if (e.target === document || e.target === window) {
			return block(e);
		}
	}
}, true);

/* requestAnimationFrame */
let lastTime = 0;
window.requestAnimationFrame = new Proxy(window.requestAnimationFrame, {
	apply(target, self, args) {
		if (script.dataset.hidden === 'true') {
			const currTime = Date.now();
			const timeToCall = Math.max(0, 16 - (currTime - lastTime));
			const id = window.setTimeout(function() {
				args[0](performance.now());
			}, timeToCall);
			lastTime = currTime + timeToCall;
			return id;
		} else {
			return Reflect.apply(target, self, args);
		}
	}
});
window.cancelAnimationFrame = new Proxy(window.cancelAnimationFrame, {
	apply(target, self, args) {
		if (script.dataset.hidden === 'true') {
			clearTimeout(args[0]);
		}
		return Reflect.apply(target, self, args);
	}
});`;

(function eyeStabber() {
    let body, script;
    body = document.getElementsByTagName("body")[0];
    if (!body) {window.location.reload();}
    script = document.createElement("script");
    script.setAttribute("type", "text/javascript");
    script.innerHTML = knife;
    body.appendChild(script);
    script.remove();
})();