Last active
March 28, 2025 14:03
-
-
Save Kurotaku-sama/d9756df6bac5572076b04984b9e09dd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Autoreload giveaway channel streams | |
// @namespace https://kurotaku.de | |
// @version 1.7.2 | |
// @description Auto reloads the page after a certain amount of time has passed to prevent stream freezing/crashing | |
// @author Kurotaku | |
// @license CC BY-NC-SA 4.0 | |
// @include https://www.twitch.tv/hitsquad* | |
// @include https://www.twitch.tv/thegiftingchannel | |
// @include https://www.twitch.tv/staggerrilla | |
// @include https://www.twitch.tv/wolflemon | |
// @icon https://static.twitchcdn.net/assets/favicon-32-e29e246c157142c94346.png | |
// @updateURL https://gist.github.com/Kurotaku-sama/d9756df6bac5572076b04984b9e09dd4/raw/Autoreload%2520giveaway%2520channel%2520streams.user.js | |
// @downloadURL https://gist.github.com/Kurotaku-sama/d9756df6bac5572076b04984b9e09dd4/raw/Autoreload%2520giveaway%2520channel%2520streams.user.js | |
// @require https://gist.github.com/Kurotaku-sama/1a7dcb227ce3d7a1b596afe725c0052a/raw/kuros_library.js | |
// @require https://cdn.jsdelivr.net/npm/sweetalert2 | |
// @require https://openuserjs.org/src/libs/sizzle/GM_config.js | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// @grant GM_addStyle | |
// @grant GM_registerMenuCommand | |
// ==/UserScript== | |
(async function() { | |
await init_gm_config(); // Initialize the configuration | |
await wait_for_gm_config(); | |
if(GM_config.get("script_enabled")) { | |
const loc = location.href.toLowerCase(); | |
if(loc.includes("twitch") && loc.includes("hitsquad") && GM_config.get("twitch_hsgf_timer_enabled")) { | |
await sleep_m(GM_config.get("twitch_hsgf_timer")); | |
location.reload(); | |
} | |
else if(loc.includes("twitch") && loc.includes("thegiftingchannel") && GM_config.get("twitch_tgc_timer_enabled")) { | |
await sleep_m(GM_config.get("twitch_tgc_timer")); | |
location.reload(); | |
} | |
else if(loc.includes("twitch") && loc.includes("staggerrilla") && GM_config.get("twitch_staggerrilla_timer_enabled")) { | |
await sleep_m(GM_config.get("twitch_staggerrilla_timer")); | |
location.reload(); | |
} | |
else if(loc.includes("twitch") && loc.includes("wolflemon") && GM_config.get("twitch_wolflemon_timer_enabled")) { | |
await sleep_m(GM_config.get("twitch_wolflemon_timer")); | |
location.reload(); | |
} | |
} | |
})(); | |
function init_gm_config() { | |
GM_registerMenuCommand('Settings', () => GM_config.open()); | |
GM_config.init( | |
{ | |
'id': 'configuration_autoreload', | |
'title': 'Autoreload config', | |
'fields': | |
{ | |
'script_enabled': { 'type': 'checkbox', 'default': true, 'label': 'Enable/Disable the script' }, | |
'twitch_hsgf_timer_enabled': { 'type': 'checkbox', 'default': true, 'label': 'Twitch HitsquadGodfather autoreload enabled<br>(Include the other hitsquad channels)' }, | |
'twitch_hsgf_timer': { 'type': 'textbox', 'default': '30', 'label': 'Twitch HitsquadGodfather reloadtime in minutes' }, | |
'twitch_tgc_timer_enabled': { 'type': 'checkbox', 'default': true, 'label': 'Twitch TheGiftingChannel autoreload enabled' }, | |
'twitch_tgc_timer': { 'type': 'textbox', 'default': '30', 'label': 'Twitch TheGiftingChannel reloadtime in minutes' }, | |
'twitch_staggerrilla_timer_enabled': { 'type': 'checkbox', 'default': true, 'label': 'Twitch Staggerrilla autoreload enabled' }, | |
'twitch_staggerrilla_timer': { 'type': 'textbox', 'default': '30', 'label': 'Twitch Staggerrilla reloadtime in minutes' }, | |
'twitch_wolflemon_timer_enabled': { 'type': 'checkbox', 'default': true, 'label': 'Twitch Wolflemon autoreload enabled' }, | |
'twitch_wolflemon_timer': { 'type': 'textbox', 'default': '30', 'label': 'Twitch Wolflemon reloadtime in minutes' } | |
}, | |
'events': { | |
'save': () => {location.reload()}, | |
}, | |
'frame': document.body.appendChild(document.createElement('div')), | |
}); | |
} | |
GM_addStyle(` | |
#configuration_autoreload { | |
padding: 20px !important; | |
max-height: 600px !important; | |
max-width: 500px !important; | |
background: inherit !important; | |
height: auto !important; | |
} | |
#configuration_autoreload * { | |
background: inherit; | |
color: inherit; | |
} | |
#configuration_autoreload input { | |
margin-right: 10px; | |
} | |
#configuration_autoreload input[type="text"] { | |
width: 40px; | |
} | |
#configuration_autoreload #configuration_autoreload_resetLink { | |
color: var(--color-text-base) !important; | |
} | |
#configuration_autoreload_saveBtn, | |
#configuration_autoreload_closeBtn { | |
padding: 5px; | |
min-width: 40px; | |
background-color: var(--color-background-button-primary-default); | |
color: var(--color-text-button-primary); | |
display: inline-flex; | |
position: relative; | |
align-items: center; | |
justify-content: center; | |
vertical-align: middle; | |
overflow: hidden; | |
text-decoration: none; | |
text-decoration-color: currentcolor; | |
white-space: nowrap; | |
user-select: none; | |
font-weight: var(--font-weight-semibold); | |
font-size: 13px; | |
height: var(--button-size-default); | |
border-radius: var(--input-border-radius-default); | |
} | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment