always-active
always-active copied to clipboard
Character.ai detects inactive tabs
I believe you can test this without signing up - but creating an account is free. The animations during AI chat will pause when the window is not active, so they are using a mechanism this extension doesn't handle.
It appears that on this page, the combination of "ResizeObserver" and "requestAnimationFrame" is used for rendering. While we do modify "requestAnimationFrame," the browser doesn't refresh the DOM's visual updates when the tab is hidden. As a result, the "ResizeObserver" function isn't triggered.
I'm not sure how we can bypass this
This userscript works on Firefox but not Chromium. I've tried all kind of things on Chromium but I just can't get it to work
(function() {
'use strict';
// Override the visibilityState property of the document to always return "visible"
Object.defineProperty(document, "visibilityState", {value: "visible", writable: false});
// Override the hidden property of the document to always return false
Object.defineProperty(document, "hidden", {value: false, writable: false});
// Override the addEventListener method of the document to prevent visibilitychange events from being registered
const originalAddEventListener = document.addEventListener;
document.addEventListener = function(type, listener, options) {
if (type !== "visibilitychange") {
originalAddEventListener.call(document, type, listener, options);
}
};
})();