mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Added support for TipeeeStream
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -48,6 +48,7 @@ const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true)
|
|||||||
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
||||||
const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true);
|
const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true);
|
||||||
const showKofiDonations = GetBooleanParam("showKofiDonations", true);
|
const showKofiDonations = GetBooleanParam("showKofiDonations", true);
|
||||||
|
const showTipeeestreamDonations = GetBooleanParam("showTipeeestreamDonations", true);
|
||||||
|
|
||||||
// Set fonts for the widget
|
// Set fonts for the widget
|
||||||
document.body.style.fontFamily = font;
|
document.body.style.fontFamily = font;
|
||||||
@@ -211,6 +212,11 @@ client.on('Kofi.ShopOrder', (response) => {
|
|||||||
KofiShopOrder(response.data);
|
KofiShopOrder(response.data);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('TipeeeStream.Donation', (response) => {
|
||||||
|
console.debug(response.data);
|
||||||
|
TipeeeStreamDonation(response.data);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
@@ -774,6 +780,24 @@ function KofiShopOrder(data) {
|
|||||||
ShowAlert(message, 'kofi');
|
ShowAlert(message, 'kofi');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TipeeeStreamDonation(data) {
|
||||||
|
if (!showTipeeestreamDonations)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const user = data.username;
|
||||||
|
const amount = data.amount;
|
||||||
|
const currency = data.currency;
|
||||||
|
const tipeeeStreamIcon = `<img src="icons/platforms/tipeeeStream.png" class="platform"/>`;
|
||||||
|
|
||||||
|
let message = "";
|
||||||
|
if (currency == "USD")
|
||||||
|
message = `${tipeeeStreamIcon} ${user} donated $${amount}`;
|
||||||
|
else
|
||||||
|
message = `${tipeeeStreamIcon} ${user} ordered ${itemTotal} item(s) on Ko-fi (${currency} ${amount})`;
|
||||||
|
|
||||||
|
ShowAlert(message, 'tipeeeStream');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|||||||
@@ -223,6 +223,14 @@
|
|||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"group": "Which donation messages do you want to see?"
|
"group": "Which donation messages do you want to see?"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "showTipeeeStreamDonations",
|
||||||
|
"label": "TipeeeStream Donations",
|
||||||
|
"description": "",
|
||||||
|
"type": "checkbox",
|
||||||
|
"defaultValue": true,
|
||||||
|
"group": "Which donation messages do you want to see?"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "address",
|
"id": "address",
|
||||||
"label": "Address",
|
"label": "Address",
|
||||||
|
|||||||
@@ -249,6 +249,10 @@ li {
|
|||||||
background: linear-gradient(#54c7ee, #08c2ff) !important;
|
background: linear-gradient(#54c7ee, #08c2ff) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tipeeeStream {
|
||||||
|
background: linear-gradient(#120e23, #5d192a) !important;
|
||||||
|
}
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/** ANIMATIONS **/
|
/** ANIMATIONS **/
|
||||||
/****************/
|
/****************/
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -47,6 +47,7 @@ const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true)
|
|||||||
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
||||||
const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true);
|
const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true);
|
||||||
const showKofiDonations = GetBooleanParam("showKofiDonations", true);
|
const showKofiDonations = GetBooleanParam("showKofiDonations", true);
|
||||||
|
const showTipeeestreamDonations = GetBooleanParam("showTipeeestreamDonations", true);
|
||||||
|
|
||||||
// Set fonts for the widget
|
// Set fonts for the widget
|
||||||
document.body.style.fontFamily = font;
|
document.body.style.fontFamily = font;
|
||||||
@@ -225,6 +226,11 @@ client.on('Kofi.ShopOrder', (response) => {
|
|||||||
KofiShopOrder(response.data);
|
KofiShopOrder(response.data);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('TipeeeStream.Donation', (response) => {
|
||||||
|
console.debug(response.data);
|
||||||
|
TipeeeStreamDonation(response.data);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@@ -1276,6 +1282,45 @@ function KofiShopOrder(data) {
|
|||||||
AddMessageItem(instance, data.id);
|
AddMessageItem(instance, data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TipeeeStreamDonation(data) {
|
||||||
|
if (!showTipeeestreamDonations)
|
||||||
|
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('tipeeeStream');
|
||||||
|
|
||||||
|
// Set the text
|
||||||
|
const user = data.username;
|
||||||
|
const amount = data.amount;
|
||||||
|
const currency = data.currency;
|
||||||
|
const message = data.message;
|
||||||
|
const tipeeeStreamIcon = `<img src="icons/platforms/tipeeeStream.png" class="platform"/>`;
|
||||||
|
|
||||||
|
if (currency == "USD")
|
||||||
|
titleDiv.innerHTML = `${tipeeeStreamIcon} ${user} donated $${amount}`;
|
||||||
|
else
|
||||||
|
titleDiv.innerHTML = `${tipeeeStreamIcon} ${user} donated ${currency} ${amount}`;
|
||||||
|
|
||||||
|
if (message != null)
|
||||||
|
contentDiv.innerHTML = `${message}`;
|
||||||
|
|
||||||
|
AddMessageItem(instance, data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|||||||
@@ -285,6 +285,14 @@
|
|||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"group": "Which donation messages do you want to see?"
|
"group": "Which donation messages do you want to see?"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "showTipeeeStreamDonations",
|
||||||
|
"label": "TipeeeStream Donations",
|
||||||
|
"description": "",
|
||||||
|
"type": "checkbox",
|
||||||
|
"defaultValue": true,
|
||||||
|
"group": "Which donation messages do you want to see?"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "address",
|
"id": "address",
|
||||||
"label": "Address",
|
"label": "Address",
|
||||||
|
|||||||
@@ -215,6 +215,10 @@ li {
|
|||||||
background: linear-gradient(#54c7ee, #08c2ff) !important;
|
background: linear-gradient(#54c7ee, #08c2ff) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tipeeeStream {
|
||||||
|
background: linear-gradient(#120e23, #5d192a) !important;
|
||||||
|
}
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/** ANIMATIONS **/
|
/** ANIMATIONS **/
|
||||||
/****************/
|
/****************/
|
||||||
|
|||||||
Reference in New Issue
Block a user