Added a "Hide Action" setting

This commit is contained in:
nuttylmao
2025-05-05 02:02:04 +10:00
parent 2f31fd547f
commit 1a2f633cdb
2 changed files with 29 additions and 8 deletions
+18 -5
View File
@@ -44,7 +44,8 @@ const hideAfter = GetIntParam("hideAfter", 8);
const showAnimation = urlParams.get("showAnimation") || ""; const showAnimation = urlParams.get("showAnimation") || "";
const hideAnimation = urlParams.get("hideAnimation") || ""; const hideAnimation = urlParams.get("hideAnimation") || "";
const playSounds = GetBooleanParam("playSounds", true); const playSounds = GetBooleanParam("playSounds", true);
const globalAction = urlParams.get("globalAction") || ""; const globalShowAction = urlParams.get("globalShowAction") || "";
const globalHideAction = urlParams.get("globalHideAction") || "";
const showMesesages = GetBooleanParam("showMesesages", true); const showMesesages = GetBooleanParam("showMesesages", true);
// Which Twitch alerts do you want to see? // Which Twitch alerts do you want to see?
@@ -1236,9 +1237,9 @@ function UpdateAlertBox(platform, avatarURL, headerText, descriptionText, attrib
} }
// Run the Streamer.bot action if there is one // Run the Streamer.bot action if there is one
if (globalAction) { if (globalShowAction) {
console.debug('Running Streamer.bot action: ' + globalAction); console.debug('Running Streamer.bot action: ' + globalShowAction);
client.doAction({name: globalAction}, sbData); client.doAction({name: globalShowAction}, sbData);
} }
// Run the Streamer.bot action if there is one // Run the Streamer.bot action if there is one
@@ -1263,6 +1264,12 @@ function UpdateAlertBox(platform, avatarURL, headerText, descriptionText, attrib
theContentThatShowsLastInsteadOfFirst.style.opacity = 1; theContentThatShowsLastInsteadOfFirst.style.opacity = 1;
setTimeout(() => { setTimeout(() => {
// Run the Streamer.bot action if there is one
if (globalHideAction) {
console.debug('Running Streamer.bot action: ' + globalHideAction);
client.doAction({name: globalHideAction}, sbData);
}
alertBox.style.animation = `${hideAnimation} 0.5s ease-out forwards`; alertBox.style.animation = `${hideAnimation} 0.5s ease-out forwards`;
setTimeout(() => { setTimeout(() => {
@@ -1278,7 +1285,13 @@ function UpdateAlertBox(platform, avatarURL, headerText, descriptionText, attrib
} }
}, 1000); }, 1000);
}, hideAfter * 1000); }, hideAfter * 1000);
} else { } else {
// Run the Streamer.bot action if there is one
if (globalHideAction) {
console.debug('Running Streamer.bot action: ' + globalHideAction);
client.doAction({name: globalHideAction}, sbData);
}
alertBox.style.animation = `${hideAnimation} 0.5s ease-out forwards`; alertBox.style.animation = `${hideAnimation} 0.5s ease-out forwards`;
setTimeout(() => { setTimeout(() => {
+11 -3
View File
@@ -204,9 +204,17 @@
"group": "General" "group": "General"
}, },
{ {
"id": "globalAction", "id": "globalShowAction",
"label": "Streamer.bot Action", "label": "Show Action",
"description": "Run this Streamer.bot Action on every alert", "description": "Run this Streamer.bot Action at the start of every alert",
"type": "sb-actions",
"defaultValue": "",
"group": "General"
},
{
"id": "globalHideAction",
"label": "Hide Action",
"description": "Run this Streamer.bot Action at the end of every alert",
"type": "sb-actions", "type": "sb-actions",
"defaultValue": "", "defaultValue": "",
"group": "General" "group": "General"