Greasy Fork is available in English.
Keeps Kick tab as always active even when in background tabs. This allows you to keep favorite streamer page open in background tab and it willl automatically start playing when live.
当前为
// ==UserScript==
// @name Always Active Kick
// @namespace http://greasyfork.icu/en/users/1200587-trilla-g
// @match *://*.kick.com/*
// @description Keeps Kick tab as always active even when in background tabs. This allows you to keep favorite streamer page open in background tab and it willl automatically start playing when live.
// @version 2.0
// @license MIT
// @author Trilla_G
// ==/UserScript==
// Prevent the page from being hidden
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
document.hidden = false;
document.visibilityState = 'visible';
// Dispatch a visibilitychange event to simulate a visibility update
var event = new Event('visibilitychange');
document.dispatchEvent(event);
}
});
// Keep the page in focus by listening to blur and focus events
window.addEventListener('blur', function() {
window.setTimeout(function() {
window.focus();
}, 0);
});
// Try to set the document's visibilityState directly
Object.defineProperty(document, 'hidden', { value: false, writable: false });
Object.defineProperty(document, 'visibilityState', { value: 'visible', writable: false });