Ported 'Twitch Ad Countdown Timer'

This commit is contained in:
nuttylmao
2025-06-03 22:33:21 +10:00
parent 492486b0b7
commit ec8e986412
9 changed files with 597 additions and 422 deletions
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="../../.resources/logo.png" type="image/png">
<title>nutty</title>
<style>
body {
margin: 0;
display: flex;
background: #181818;
}
#widgetContainer {
width: 100vw;
height: 100vh;
border-width: 0px;
}
</style>
</head>
<body>
<iframe id="widgetContainer"></iframe>
<script src="script.js"></script>
</body>
</html>
@@ -0,0 +1,23 @@
const widgetContainer = document.getElementById('widgetContainer');
const settingsPageURL = '../../.utilities/settings-page-builder';
const currentURL = window.location.href;
let settingsJSON;
let baseURL = currentURL;
if (baseURL.endsWith("index.html"))
baseURL = baseURL.replace("index.html", "");
settingsJSON = "?settingsJson=" + baseURL + "settings.json";
const lastSlashIndex = baseURL.lastIndexOf("/");
let widgetURL = "&widgetURL=" + baseURL.replace("/settings", "");
console.debug("Window Ref: " + window.location.href);
console.debug("Base URL: " + baseURL);
console.debug("Settings JSON: " + settingsJSON);
console.debug("Widget URL: " + widgetURL);
widgetContainer.src = settingsPageURL + settingsJSON + widgetURL;
@@ -0,0 +1,140 @@
{
"settings": [
{
"id": "testAd",
"label": "Send Test Ad",
"description": "",
"type": "button",
"callFunction": "testAd",
"group": ""
},
{
"id": "testUpcomingAdWarning",
"label": "Send Test Upcoming Ad Warning",
"description": "",
"type": "button",
"callFunction": "testUpcomingAdWarning",
"group": ""
},
{
"id": "barColor",
"label": "Bar Color",
"description": "",
"type": "color",
"defaultValue": "#FFCC00",
"group": "Appearance"
},
{
"id": "barThickness",
"label": "Bar Thickness",
"description": "",
"type": "number",
"defaultValue": "4",
"min": 1,
"group": "Appearance"
},
{
"id": "barPosition",
"label": "Bar Position",
"description": "",
"type": "select",
"options": [
{
"value": "none",
"label": "None"
},
{
"value": "bottom",
"label": "Bottom"
},
{
"value": "top",
"label": "Top"
},
{
"value": "left",
"label": "Left"
},
{
"value": "right",
"label": "Right"
}
],
"defaultValue": "bottom",
"group": "Appearance"
},
{
"id": "timerColor",
"label": "Timer Color",
"description": "",
"type": "color",
"defaultValue": "#FFCC00",
"group": "Appearance"
},
{
"id": "timerPosition",
"label": "Timer Position",
"description": "",
"type": "select",
"options": [
{
"value": "none",
"label": "None"
},
{
"value": "top-left",
"label": "Top Left"
},
{
"value": "top-right",
"label": "Top Right"
},
{
"value": "bottom-left",
"label": "Bottom Left"
},
{
"value": "bottom-right",
"label": "Bottom Right"
}
],
"defaultValue": "top-left",
"group": "Appearance"
},
{
"id": "showUpcomingAdWarning",
"label": "Show Upcoming Ad Warning",
"description": "",
"type": "checkbox",
"defaultValue": true,
"group": "General"
},
{
"id": "warningSeconds",
"label": "Warning Time",
"description": "Warn X seconds before ad",
"type": "number",
"defaultValue": "10",
"min": 1,
"max": 300,
"showIf": "showUpcomingAdWarning",
"group": "General"
},
{
"id": "address",
"label": "Address",
"description": "Streamer.bot Websocket Server Address",
"type": "text",
"defaultValue": "127.0.0.1",
"group": "Advanced"
},
{
"id": "port",
"label": "Port",
"description": "Streamer.bot Websocket Server Port",
"type": "text",
"defaultValue": "8080",
"group": "Advanced"
}
]
}