diff --git a/multichat-overlay/script.js b/multichat-overlay/script.js
index 2268fc3..6518e16 100644
--- a/multichat-overlay/script.js
+++ b/multichat-overlay/script.js
@@ -69,8 +69,7 @@ document.body.style.background = `${background}${hexOpacity}`;
const ignoreUserList = ignoreChatters.split(',').map(item => item.trim().toLowerCase()) || [];
// Set the scroll direction
-switch (scrollDirection)
-{
+switch (scrollDirection) {
case 1:
document.getElementById('messageList').classList.add('normalScrollDirection');
break;
@@ -78,7 +77,7 @@ switch (scrollDirection)
document.getElementById('messageList').classList.add('reverseScrollDirection');
break;
}
-
+
@@ -257,9 +256,9 @@ client.on('Fourthwall.GiftDrawStarted', (response) => {
FourthwallGiftDrawStarted(response.data);
})
-client.on('Fourthwall.GiftDrawEnd', (response) => {
+client.on('Fourthwall.GiftDrawEnded', (response) => {
console.debug(response.data);
- FourthwallGiftDrawEnd(response.data);
+ FourthwallGiftDrawEnded(response.data);
})
@@ -802,7 +801,7 @@ function TwitchChatMessageDeleted(data) {
messagesToRemove.forEach(item => {
item.style.opacity = 0;
item.style.height = 0;
- setTimeout(function() {
+ setTimeout(function () {
messageList.removeChild(item);
}, 1000);
});
@@ -1192,8 +1191,8 @@ function KofiDonation(data) {
if (currency == "USD")
titleDiv.innerHTML = `${kofiIcon} ${user} donated $${amount}`;
else
- titleDiv.innerHTML = `${kofiIcon} ${user} donated ${currency} ${amount}`;
-
+ titleDiv.innerHTML = `${kofiIcon} ${user} donated ${currency}${amount}`;
+
if (message != null)
contentDiv.innerHTML = `${message}`;
@@ -1232,7 +1231,7 @@ function KofiSubscription(data) {
titleDiv.innerHTML = `${kofiIcon} ${user} subscribed ($${amount})`;
else
titleDiv.innerHTML = `${kofiIcon} ${user} subscribed (${currency} ${amount})`;
-
+
if (message != null)
contentDiv.innerHTML = `${message}`;
@@ -1388,12 +1387,12 @@ function FourthwallOrderPlaced(data) {
const message = DecodeHTMLString(data.statmessageus);
const itemImageUrl = data.variants[0].image;
const fourthwallProductImage = ``;
-
+
let contents = "";
contents += fourthwallProductImage;
- contents += "
"
+ contents += "
";
// If there user did not provide a username, just say "Someone"
if (user == undefined)
@@ -1408,9 +1407,9 @@ function FourthwallOrderPlaced(data) {
if (orderTotal == 0)
contents += ``;
else if (currency == "USD")
- contents = ` ($${orderTotal})`;
+ contents += ` ($${orderTotal})`;
else
- contents = ` (${orderTotal} ${currency})`;
+ contents += ` (${orderTotal} ${currency})`;
titleDiv.innerHTML = contents;
@@ -1427,12 +1426,92 @@ function FourthwallDonation(data) {
if (!showFourthwallAlerts)
return;
+ // Get a reference to the template
+ const template = document.getElementById('cardTemplate');
+
+ // Create a new instance of the template
+ const instance = template.content.cloneNode(true);
+
+ // Get divs
+ const cardDiv = instance.querySelector("#card");
+ const headerDiv = instance.querySelector("#header");
+ const avatarDiv = instance.querySelector("#avatar");
+ const iconDiv = instance.querySelector("#icon");
+ const titleDiv = instance.querySelector("#title");
+ const contentDiv = instance.querySelector("#content");
+
+ // Set the card background colors
+ cardDiv.classList.add('fourthwall');
+
+ // Set the text
+ let user = data.username;
+ const amount = data.amount;
+ const currency = data.currency;
+ const message = data.message;
+
+ let contents = "";
+
+ // If the user ordered more than one item, write how many items they ordered
+ contents += `${user} donated`;
+
+ // If the user spent money, put the order total
+ if (currency == "USD")
+ contents += ` $${amount}`;
+ else
+ contents += ` ${currency}${amount}`;
+
+ titleDiv.innerHTML = contents;
+
+ // Add the custom message from the user
+ if (message.trim() != "")
+ contentDiv.innerHTML = `${message}`;
+ else
+ contentDiv.style.display = 'none'
+
+ AddMessageItem(instance, data.id);
}
function FourthwallSubscriptionPurchased(data) {
if (!showFourthwallAlerts)
return;
+ // Get a reference to the template
+ const template = document.getElementById('cardTemplate');
+
+ // Create a new instance of the template
+ const instance = template.content.cloneNode(true);
+
+ // Get divs
+ const cardDiv = instance.querySelector("#card");
+ const headerDiv = instance.querySelector("#header");
+ const avatarDiv = instance.querySelector("#avatar");
+ const iconDiv = instance.querySelector("#icon");
+ const titleDiv = instance.querySelector("#title");
+ const contentDiv = instance.querySelector("#content");
+
+ // Set the card background colors
+ cardDiv.classList.add('fourthwall');
+
+ // Set the text
+ let user = data.nickname;
+ const amount = data.amount;
+ const currency = data.currency;
+
+ let contents = "";
+
+ // If the user ordered more than one item, write how many items they ordered
+ contents += `${user} subscribed`;
+
+ // If the user spent money, put the order total
+ if (currency == "USD")
+ contents += ` ($${amount})`;
+ else
+ contents += ` (${currency}${amount})`;
+
+ titleDiv.innerHTML = contents;
+ contentDiv.style.display = 'none'
+
+ AddMessageItem(instance, data.id);
}
function FourthwallGiftPurchase(data) {
@@ -1440,18 +1519,143 @@ function FourthwallGiftPurchase(data) {
if (!showFourthwallAlerts)
return;
+ // Get a reference to the template
+ const template = document.getElementById('cardTemplate');
+
+ // Create a new instance of the template
+ const instance = template.content.cloneNode(true);
+
+ // Get divs
+ const cardDiv = instance.querySelector("#card");
+ const headerDiv = instance.querySelector("#header");
+ const avatarDiv = instance.querySelector("#avatar");
+ const iconDiv = instance.querySelector("#icon");
+ const titleDiv = instance.querySelector("#title");
+ const contentDiv = instance.querySelector("#content");
+
+ // Set the card background colors
+ cardDiv.classList.add('blank');
+ titleDiv.classList.add('centerThatShitHomie');
+ contentDiv.classList.add('centerThatShitHomie');
+
+ // Set the text
+ let user = data.username;
+ const total = data.total;
+ const currency = data.currency;
+ const gifts = data.gifts.length;
+ const itemName = data.offer.name;
+ const itemImageUrl = data.offer.imageUrl;
+ const fourthwallProductImage = ``;
+ const message = DecodeHTMLString(data.statmessageus);
+
+ let contents = "";
+
+ contents += fourthwallProductImage;
+
+ contents += "
";
+
+ // If the user ordered more than one item, write how many items they ordered
+ contents += `${user} gifted`;
+
+ // If there is more than one gifted item, display the number of gifts
+ if (gifts > 1)
+ contents += ` ${gifts} x `;
+
+ // The name of the item to be given away
+ contents += ` ${itemName}`;
+
+ // If the user spent money, put the order total
+ if (currency == "USD")
+ contents += ` ($${total})`;
+ else
+ contents += ` (${currency}${total})`;
+
+ titleDiv.innerHTML = contents;
+
+ // Add the custom message from the user
+ if (message.trim() != "")
+ contentDiv.innerHTML = `${message}`;
+ else
+ contentDiv.style.display = 'none'
+
+ AddMessageItem(instance, data.id);
}
function FourthwallGiftDrawStarted(data) {
if (!showFourthwallAlerts)
return;
+ // Get a reference to the template
+ const template = document.getElementById('cardTemplate');
+
+ // Create a new instance of the template
+ const instance = template.content.cloneNode(true);
+
+ // Get divs
+ const cardDiv = instance.querySelector("#card");
+ const headerDiv = instance.querySelector("#header");
+ const avatarDiv = instance.querySelector("#avatar");
+ const iconDiv = instance.querySelector("#icon");
+ const titleDiv = instance.querySelector("#title");
+ const contentDiv = instance.querySelector("#content");
+
+ // Set the card background colors
+ cardDiv.classList.add('fourthwall');
+ titleDiv.classList.add('centerThatShitHomie');
+ contentDiv.classList.add('centerThatShitHomie');
+
+ // Set the text
+ let durationSeconds = data.durationSeconds;
+ const itemName = data.offer.name;
+
+ let contents = "";
+
+ // If the user ordered more than one item, write how many items they ordered
+ contents += `