mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-11-04 00:20:59 -05:00
@@ -0,0 +1,70 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
||||||
|
|
||||||
|
.connection-status {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
z-index: 99999;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: italic;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #D12025;
|
||||||
|
|
||||||
|
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
/* Centering and entrance animation */
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
transform: translate(-50%, calc(-50% + 10px));
|
||||||
|
|
||||||
|
transition:
|
||||||
|
opacity 200ms ease,
|
||||||
|
transform 200ms ease,
|
||||||
|
visibility 200ms ease;
|
||||||
|
|
||||||
|
pointer-events: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-status.is-visible {
|
||||||
|
opacity: 0.9;
|
||||||
|
visibility: visible;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Optional dark translucent backdrop */
|
||||||
|
.connection-status-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 99998;
|
||||||
|
|
||||||
|
background: rgba(0, 0, 0, 0.45);
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
|
||||||
|
transition:
|
||||||
|
opacity 200ms ease,
|
||||||
|
visibility 200ms ease;
|
||||||
|
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-status-backdrop.is-visible {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-status--streamerbot {
|
||||||
|
background: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
#a257ed 0%,
|
||||||
|
#a257ed 20%,
|
||||||
|
#0b72ff 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
class ConnectionStatus {
|
||||||
|
constructor({
|
||||||
|
target = document.body,
|
||||||
|
name = "Service",
|
||||||
|
disconnectedMessage,
|
||||||
|
className = "",
|
||||||
|
showDelay = 0,
|
||||||
|
} = {}) {
|
||||||
|
this.name = name;
|
||||||
|
this.showDelay = showDelay;
|
||||||
|
this.wasConnected = false;
|
||||||
|
this.disconnectTimer = null;
|
||||||
|
|
||||||
|
// Generate a CSS class from the service name.
|
||||||
|
const serviceClass = {
|
||||||
|
"Streamer.bot": "connection-status--streamerbot",
|
||||||
|
}[name] || "";
|
||||||
|
|
||||||
|
this.element = document.createElement("div");
|
||||||
|
this.element.className = [
|
||||||
|
"connection-status",
|
||||||
|
serviceClass,
|
||||||
|
className
|
||||||
|
].filter(Boolean).join(" ");
|
||||||
|
|
||||||
|
this.element.setAttribute("role", "status");
|
||||||
|
this.element.setAttribute("aria-live", "polite");
|
||||||
|
this.element.hidden = true;
|
||||||
|
|
||||||
|
this.disconnectedMessage =
|
||||||
|
disconnectedMessage ?? `${name} disconnected`;
|
||||||
|
|
||||||
|
target.appendChild(this.element);
|
||||||
|
}
|
||||||
|
|
||||||
|
setConnected(connected) {
|
||||||
|
clearTimeout(this.disconnectTimer);
|
||||||
|
this.disconnectTimer = null;
|
||||||
|
|
||||||
|
if (connected) {
|
||||||
|
this.wasConnected = true;
|
||||||
|
this.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.disconnectTimer = setTimeout(() => {
|
||||||
|
this.show(this.disconnectedMessage);
|
||||||
|
}, this.showDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
show(message) {
|
||||||
|
this.element.textContent = message;
|
||||||
|
this.element.hidden = false;
|
||||||
|
this.element.classList.remove("is-visible");
|
||||||
|
|
||||||
|
void this.element.offsetHeight;
|
||||||
|
|
||||||
|
this.element.classList.add("is-visible");
|
||||||
|
}
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
this.element.classList.remove("is-visible");
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!this.element.classList.contains("is-visible")) {
|
||||||
|
this.element.hidden = true;
|
||||||
|
}
|
||||||
|
}, 220);
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
clearTimeout(this.disconnectTimer);
|
||||||
|
this.element.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="statusContainer">Connecting...</div>
|
|
||||||
<div id="mainContainer" class="slide-fade">
|
<div id="mainContainer" class="slide-fade">
|
||||||
<ul id="messageList">
|
<ul id="messageList">
|
||||||
</ul>
|
</ul>
|
||||||
@@ -39,4 +38,6 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src="/.common/utils/helpers.js"></script>
|
<script src="/.common/utils/helpers.js"></script>
|
||||||
|
<link rel="stylesheet" href="/.common/utils/connection-status.css">
|
||||||
|
<script src="/.common/utils/connection-status.js"></script>
|
||||||
<script src="./script.js"></script>
|
<script src="./script.js"></script>
|
||||||
+10
-28
@@ -125,6 +125,14 @@ document.documentElement.style.setProperty('--animation-speed', `${animationSpee
|
|||||||
// STREAMER.BOT CLIENT //
|
// STREAMER.BOT CLIENT //
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
const connectionStatus = new ConnectionStatus({
|
||||||
|
name: "Streamer.bot",
|
||||||
|
showDelay: 1000,
|
||||||
|
disconnectedMessage: "Connecting to Streamer.bot..."
|
||||||
|
});
|
||||||
|
|
||||||
|
connectionStatus.setConnected(false);
|
||||||
|
|
||||||
const client = new StreamerbotClient({
|
const client = new StreamerbotClient({
|
||||||
host: sbServerAddress,
|
host: sbServerAddress,
|
||||||
port: sbServerPort,
|
port: sbServerPort,
|
||||||
@@ -132,13 +140,13 @@ const client = new StreamerbotClient({
|
|||||||
onConnect: (data) => {
|
onConnect: (data) => {
|
||||||
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
||||||
console.debug(data);
|
console.debug(data);
|
||||||
SetConnectionStatus(true);
|
connectionStatus.setConnected(true);
|
||||||
KickConnect();
|
KickConnect();
|
||||||
},
|
},
|
||||||
|
|
||||||
onDisconnect: () => {
|
onDisconnect: () => {
|
||||||
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
||||||
SetConnectionStatus(false);
|
connectionStatus.setConnected(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1848,30 +1856,4 @@ function GetWinnersList(gifts) {
|
|||||||
const secondLastWinner = winners.pop();
|
const secondLastWinner = winners.pop();
|
||||||
return `${winners.join(", ")}, ${secondLastWinner} and ${lastWinner}`;
|
return `${winners.join(", ")}, ${secondLastWinner} and ${lastWinner}`;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
|
||||||
// STREAMER.BOT WEBSOCKET STATUS //
|
|
||||||
///////////////////////////////////
|
|
||||||
|
|
||||||
// This function sets the visibility of the Streamer.bot status label on the overlay
|
|
||||||
function SetConnectionStatus(connected) {
|
|
||||||
let statusContainer = document.getElementById("statusContainer");
|
|
||||||
if (connected) {
|
|
||||||
statusContainer.style.background = "#2FB774";
|
|
||||||
statusContainer.innerText = "Connected!";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
setTimeout(() => {
|
|
||||||
statusContainer.style.transition = "all 2s ease";
|
|
||||||
statusContainer.style.opacity = 0;
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
statusContainer.style.background = "#D12025";
|
|
||||||
statusContainer.innerText = "Connecting...";
|
|
||||||
statusContainer.style.transition = "";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -21,20 +21,6 @@ html {
|
|||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
#statusContainer {
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 30px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #D12025;
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
#mainContainer {
|
#mainContainer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: calc(100% - 2 * var(--margin));
|
height: calc(100% - 2 * var(--margin));
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="statusContainer" style="display: none;"></div>
|
|
||||||
<div id="mainContainer" class="slide-fade">
|
<div id="mainContainer" class="slide-fade">
|
||||||
<ul id="messageList">
|
<ul id="messageList">
|
||||||
</ul>
|
</ul>
|
||||||
@@ -106,4 +105,6 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src="/.common/utils/helpers.js"></script>
|
<script src="/.common/utils/helpers.js"></script>
|
||||||
|
<link rel="stylesheet" href="/.common/utils/connection-status.css">
|
||||||
|
<script src="/.common/utils/connection-status.js"></script>
|
||||||
<script src="./script.js"></script>
|
<script src="./script.js"></script>
|
||||||
+10
-28
@@ -145,6 +145,14 @@ document.documentElement.style.setProperty('--animation-speed', `${animationSpee
|
|||||||
// STREAMER.BOT CLIENT //
|
// STREAMER.BOT CLIENT //
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
const connectionStatus = new ConnectionStatus({
|
||||||
|
name: "Streamer.bot",
|
||||||
|
showDelay: 1000,
|
||||||
|
disconnectedMessage: "Connecting to Streamer.bot..."
|
||||||
|
});
|
||||||
|
|
||||||
|
connectionStatus.setConnected(false);
|
||||||
|
|
||||||
const client = new StreamerbotClient({
|
const client = new StreamerbotClient({
|
||||||
host: sbServerAddress,
|
host: sbServerAddress,
|
||||||
port: sbServerPort,
|
port: sbServerPort,
|
||||||
@@ -153,13 +161,13 @@ const client = new StreamerbotClient({
|
|||||||
onConnect: (data) => {
|
onConnect: (data) => {
|
||||||
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
||||||
console.debug(data);
|
console.debug(data);
|
||||||
SetConnectionStatus(true);
|
connectionStatus.setConnected(true);
|
||||||
KickConnect();
|
KickConnect();
|
||||||
},
|
},
|
||||||
|
|
||||||
onDisconnect: () => {
|
onDisconnect: () => {
|
||||||
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
||||||
SetConnectionStatus(false);
|
connectionStatus.setConnected(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3383,32 +3391,6 @@ function GetWinnersList(gifts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
|
||||||
// STREAMER.BOT WEBSOCKET STATUS //
|
|
||||||
///////////////////////////////////
|
|
||||||
|
|
||||||
// This function sets the visibility of the Streamer.bot status label on the overlay
|
|
||||||
function SetConnectionStatus(connected) {
|
|
||||||
let statusContainer = document.getElementById("statusContainer");
|
|
||||||
if (connected) {
|
|
||||||
statusContainer.style.background = "#2FB774";
|
|
||||||
statusContainer.innerText = "Connected!";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
setTimeout(() => {
|
|
||||||
statusContainer.style.transition = "all 2s ease";
|
|
||||||
statusContainer.style.opacity = 0;
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
statusContainer.style.background = "#D12025";
|
|
||||||
statusContainer.innerText = "Connecting...";
|
|
||||||
statusContainer.style.transition = "";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function GetYouTubeVideoData(videoId) {
|
async function GetYouTubeVideoData(videoId) {
|
||||||
const url = `https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${videoId}&format=json`;
|
const url = `https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${videoId}&format=json`;
|
||||||
|
|
||||||
|
|||||||
@@ -21,20 +21,6 @@ html {
|
|||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
#statusContainer {
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 30px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #D12025;
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
#mainContainer {
|
#mainContainer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: calc(100% - 2 * var(--margin));
|
height: calc(100% - 2 * var(--margin));
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="statusContainer">Connecting...</div>
|
|
||||||
<div id="mainContainer" class="slide-fade">
|
<div id="mainContainer" class="slide-fade">
|
||||||
<div id="alertBox" class="highlightMessage">
|
<div id="alertBox" class="highlightMessage">
|
||||||
<div id="theContentThatShowsFirstInsteadOfSecond">
|
<div id="theContentThatShowsFirstInsteadOfSecond">
|
||||||
@@ -45,4 +44,6 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src="/.common/utils/helpers.js"></script>
|
<script src="/.common/utils/helpers.js"></script>
|
||||||
|
<link rel="stylesheet" href="/.common/utils/connection-status.css">
|
||||||
|
<script src="/.common/utils/connection-status.js"></script>
|
||||||
<script src="./script.js"></script>
|
<script src="./script.js"></script>
|
||||||
@@ -173,6 +173,14 @@ switch (alignment)
|
|||||||
// STREAMER.BOT CLIENT //
|
// STREAMER.BOT CLIENT //
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
const connectionStatus = new ConnectionStatus({
|
||||||
|
name: "Streamer.bot",
|
||||||
|
showDelay: 1000,
|
||||||
|
disconnectedMessage: "Connecting to Streamer.bot..."
|
||||||
|
});
|
||||||
|
|
||||||
|
connectionStatus.setConnected(false);
|
||||||
|
|
||||||
const client = new StreamerbotClient({
|
const client = new StreamerbotClient({
|
||||||
host: sbServerAddress,
|
host: sbServerAddress,
|
||||||
port: sbServerPort,
|
port: sbServerPort,
|
||||||
@@ -180,13 +188,13 @@ const client = new StreamerbotClient({
|
|||||||
onConnect: (data) => {
|
onConnect: (data) => {
|
||||||
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
||||||
console.debug(data);
|
console.debug(data);
|
||||||
SetConnectionStatus(true);
|
connectionStatus.setConnected(true);
|
||||||
KickConnect();
|
KickConnect();
|
||||||
},
|
},
|
||||||
|
|
||||||
onDisconnect: () => {
|
onDisconnect: () => {
|
||||||
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
||||||
SetConnectionStatus(false);
|
connectionStatus.setConnected(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1813,29 +1821,4 @@ async function testWidget()
|
|||||||
`O-oooooooooo AAAAE-A-A-I-A-U- JO-oooooooooooo AAE-O-A-A-U-U-A- E-eee-ee-eee AAAAE-A-E-I-E-A-JO-ooo-oo-oo-oo EEEEO-A-AAA-AAAA`
|
`O-oooooooooo AAAAE-A-A-I-A-U- JO-oooooooooooo AAE-O-A-A-U-U-A- E-eee-ee-eee AAAAE-A-E-I-E-A-JO-ooo-oo-oo-oo EEEEO-A-AAA-AAAA`
|
||||||
//``
|
//``
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
|
||||||
// STREAMER.BOT WEBSOCKET STATUS //
|
|
||||||
///////////////////////////////////
|
|
||||||
|
|
||||||
// This function sets the visibility of the Streamer.bot status label on the overlay
|
|
||||||
function SetConnectionStatus(connected) {
|
|
||||||
let statusContainer = document.getElementById("statusContainer");
|
|
||||||
if (connected) {
|
|
||||||
statusContainer.style.background = "#2FB774";
|
|
||||||
statusContainer.innerText = "Connected!";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
setTimeout(() => {
|
|
||||||
statusContainer.style.transition = "all 2s ease";
|
|
||||||
statusContainer.style.opacity = 0;
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
statusContainer.style.background = "#D12025";
|
|
||||||
statusContainer.innerText = "Connecting...";
|
|
||||||
statusContainer.style.transition = "";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -22,20 +22,6 @@ html {
|
|||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
#statusContainer {
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 30px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #D12025;
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
#mainContainer {
|
#mainContainer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ async function ChangeTrack(mediaProps, accentColorPalette) {
|
|||||||
boxes[role].style.color = colorValue;
|
boxes[role].style.color = colorValue;
|
||||||
labels[role].style.opacity = '';
|
labels[role].style.opacity = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
SetVisibility(true); // Show the overlay for a few seconds if autoHide is enabled
|
||||||
}, 250);
|
}, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="statusContainer">Connecting...</div>
|
|
||||||
<div id="mainContainer">
|
<div id="mainContainer">
|
||||||
<div id="infoContainer">
|
<div id="infoContainer">
|
||||||
<div id="streamInfo">
|
<div id="streamInfo">
|
||||||
@@ -77,4 +76,6 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js'></script>
|
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js'></script>
|
||||||
|
<link rel="stylesheet" href="/.common/utils/connection-status.css">
|
||||||
|
<script src="/.common/utils/connection-status.js"></script>
|
||||||
<script src="./script.js"></script>
|
<script src="./script.js"></script>
|
||||||
+9
-22
@@ -25,6 +25,13 @@ let previousOutputTimecode = 0;
|
|||||||
let previousOutputBytes = 0;
|
let previousOutputBytes = 0;
|
||||||
let activeFps;
|
let activeFps;
|
||||||
|
|
||||||
|
const connectionStatus = new ConnectionStatus({
|
||||||
|
showDelay: 1000,
|
||||||
|
disconnectedMessage: "Connecting to Streamer.bot..."
|
||||||
|
});
|
||||||
|
|
||||||
|
connectionStatus.setConnected(false);
|
||||||
|
|
||||||
function connectws() {
|
function connectws() {
|
||||||
if ("WebSocket" in window) {
|
if ("WebSocket" in window) {
|
||||||
|
|
||||||
@@ -32,7 +39,7 @@ function connectws() {
|
|||||||
|
|
||||||
// Reconnect
|
// Reconnect
|
||||||
ws.onclose = function () {
|
ws.onclose = function () {
|
||||||
SetConnectionStatus(false);
|
connectionStatus.setConnected(false);
|
||||||
setTimeout(connectws, 5000);
|
setTimeout(connectws, 5000);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,7 +74,7 @@ function connectws() {
|
|||||||
break;
|
break;
|
||||||
case 2: // Identify OpCode
|
case 2: // Identify OpCode
|
||||||
console.log("Connected to OBS!");
|
console.log("Connected to OBS!");
|
||||||
SetConnectionStatus(true);
|
connectionStatus.setConnected(true);
|
||||||
break;
|
break;
|
||||||
case 5: // Event OpCode
|
case 5: // Event OpCode
|
||||||
switch (data.d.eventType) {
|
switch (data.d.eventType) {
|
||||||
@@ -379,26 +386,6 @@ function hexToBase64(hexstring) {
|
|||||||
// WEBSOCKET STATUS //
|
// WEBSOCKET STATUS //
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|
||||||
// This function sets the visibility of the Streamer.bot status label on the overlay
|
|
||||||
function SetConnectionStatus(connected) {
|
|
||||||
let statusContainer = document.getElementById("statusContainer");
|
|
||||||
|
|
||||||
if (connected) {
|
|
||||||
statusContainer.style.background = "#2FB774";
|
|
||||||
statusContainer.innerText = "Connected!";
|
|
||||||
mainContainer.style.visibility = `visible`;
|
|
||||||
var tl = new TimelineMax();
|
|
||||||
tl
|
|
||||||
.to(statusContainer, 2, { opacity: 0, ease: Linear.easeNone });
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
statusContainer.style.background = "#D12025";
|
|
||||||
statusContainer.innerText = "Connecting...";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
mainContainer.style.visibility = `hidden`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
connectws();
|
connectws();
|
||||||
|
|
||||||
setInterval(GetStreamStatus, 1000);
|
setInterval(GetStreamStatus, 1000);
|
||||||
|
|||||||
@@ -6,24 +6,6 @@ body {
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
#statusContainer {
|
|
||||||
font-family: 'Metropolis';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 30px;
|
|
||||||
width: 400px;
|
|
||||||
max-width: fit-content;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #D12025;
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
#top,
|
#top,
|
||||||
#bottom,
|
#bottom,
|
||||||
#left,
|
#left,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="statusContainer">Connecting...</div>
|
|
||||||
<div id="mainContainer">
|
<div id="mainContainer">
|
||||||
<div id="timer-bar"></div>
|
<div id="timer-bar"></div>
|
||||||
<div id="timer-label">
|
<div id="timer-label">
|
||||||
@@ -26,4 +25,6 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src="/.common/utils/helpers.js"></script>
|
<script src="/.common/utils/helpers.js"></script>
|
||||||
|
<link rel="stylesheet" href="/.common/utils/connection-status.css">
|
||||||
|
<script src="/.common/utils/connection-status.js"></script>
|
||||||
<script src="./script.js"></script>
|
<script src="./script.js"></script>
|
||||||
@@ -113,6 +113,14 @@ switch (timerPosition) {
|
|||||||
// STREAMER.BOT CLIENT //
|
// STREAMER.BOT CLIENT //
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
const connectionStatus = new ConnectionStatus({
|
||||||
|
name: "Streamer.bot",
|
||||||
|
showDelay: 1000,
|
||||||
|
disconnectedMessage: "Connecting to Streamer.bot..."
|
||||||
|
});
|
||||||
|
|
||||||
|
connectionStatus.setConnected(false);
|
||||||
|
|
||||||
const client = new StreamerbotClient({
|
const client = new StreamerbotClient({
|
||||||
host: sbServerAddress,
|
host: sbServerAddress,
|
||||||
port: sbServerPort,
|
port: sbServerPort,
|
||||||
@@ -120,12 +128,12 @@ const client = new StreamerbotClient({
|
|||||||
onConnect: (data) => {
|
onConnect: (data) => {
|
||||||
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
|
||||||
console.debug(data);
|
console.debug(data);
|
||||||
SetConnectionStatus(true);
|
connectionStatus.setConnected(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDisconnect: () => {
|
onDisconnect: () => {
|
||||||
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
|
||||||
SetConnectionStatus(false);
|
connectionStatus.setConnected(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -355,31 +363,4 @@ function testAd() {
|
|||||||
|
|
||||||
function testUpcomingAdWarning() {
|
function testUpcomingAdWarning() {
|
||||||
UpcomingAdWarning(warningSeconds);
|
UpcomingAdWarning(warningSeconds);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
|
||||||
// STREAMER.BOT WEBSOCKET STATUS //
|
|
||||||
///////////////////////////////////
|
|
||||||
|
|
||||||
// This function sets the visibility of the Streamer.bot status label on the overlay
|
|
||||||
function SetConnectionStatus(connected) {
|
|
||||||
let statusContainer = document.getElementById("statusContainer");
|
|
||||||
if (connected) {
|
|
||||||
statusContainer.style.background = "#2FB774";
|
|
||||||
statusContainer.innerText = "Connected!";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
setTimeout(() => {
|
|
||||||
statusContainer.style.transition = "all 2s ease";
|
|
||||||
statusContainer.style.opacity = 0;
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
statusContainer.style.background = "#D12025";
|
|
||||||
statusContainer.innerText = "Connecting...";
|
|
||||||
statusContainer.style.transition = "";
|
|
||||||
statusContainer.style.opacity = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -14,20 +14,6 @@ html {
|
|||||||
overflow-wrap: break-word; */
|
overflow-wrap: break-word; */
|
||||||
}
|
}
|
||||||
|
|
||||||
#statusContainer {
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 30px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #D12025;
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
#timer-bar {
|
#timer-bar {
|
||||||
width: 0px;
|
width: 0px;
|
||||||
height: 0px;
|
height: 0px;
|
||||||
|
|||||||
Reference in New Issue
Block a user