Added platform icons
Now print all recipients on Gift Bombs (Twitch + Kick)
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
@@ -29,6 +29,7 @@
|
|||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div id="date"></div>
|
<div id="date"></div>
|
||||||
|
<img id="icon" src="icons/platforms/twitch.png">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ async function CustomEvent(data) {
|
|||||||
const avatarEl = instance.querySelector('#avatar');
|
const avatarEl = instance.querySelector('#avatar');
|
||||||
const titleEl = instance.querySelector('#title');
|
const titleEl = instance.querySelector('#title');
|
||||||
const subtitleEl = instance.querySelector('#subtitle');
|
const subtitleEl = instance.querySelector('#subtitle');
|
||||||
|
const iconEl = instance.querySelector('#icon');
|
||||||
const dateEl = instance.querySelector('#date');
|
const dateEl = instance.querySelector('#date');
|
||||||
|
|
||||||
// Set the main contents
|
// Set the main contents
|
||||||
@@ -126,6 +127,9 @@ async function CustomEvent(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'twitch');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('TwitchSub'):
|
case ('TwitchSub'):
|
||||||
@@ -138,6 +142,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML = '<b>First time subscriber!</b>';
|
messageEl.innerHTML = '<b>First time subscriber!</b>';
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'twitch');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('TwitchReSub'):
|
case ('TwitchReSub'):
|
||||||
@@ -152,13 +159,17 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML += `<br><br><i>${data.messageStripped}</i>`;
|
messageEl.innerHTML += `<br><br><i>${data.messageStripped}</i>`;
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'twitch');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('TwitchGiftSub'):
|
case ('TwitchGiftSub'):
|
||||||
{
|
{
|
||||||
// Don't put profile pictures for subs that come from Gift Bombs to avoid rate limits
|
// Don't put profile pictures for subs that come from Gift Bombs to avoid rate limits
|
||||||
if (data.fromGiftBomb)
|
if (data.fromGiftBomb)
|
||||||
avatarEl.style.display = 'none';
|
//avatarEl.style.display = 'none';
|
||||||
|
return;
|
||||||
else
|
else
|
||||||
avatarEl.src = await GetAvatar(data.recipientUserName, 'twitch');
|
avatarEl.src = await GetAvatar(data.recipientUserName, 'twitch');
|
||||||
titleEl.innerText = `Gifted Sub`;
|
titleEl.innerText = `Gifted Sub`;
|
||||||
@@ -171,6 +182,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML += `<b>${data.user}</b>!`;
|
messageEl.innerHTML += `<b>${data.user}</b>!`;
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'twitch');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('TwitchGiftBomb'):
|
case ('TwitchGiftBomb'):
|
||||||
@@ -183,15 +197,23 @@ async function CustomEvent(data) {
|
|||||||
else
|
else
|
||||||
subtitleEl.innerHTML += `<br>${data.user}`;
|
subtitleEl.innerHTML += `<br>${data.user}`;
|
||||||
|
|
||||||
|
const messageEl = document.createElement('div');
|
||||||
if (data.totalGifts > 1) {
|
if (data.totalGifts > 1) {
|
||||||
const messageEl = document.createElement('div');
|
messageEl.innerHTML = `They've gifted <b>${data.totalGifts} subs</b> in total!</br></br>`;
|
||||||
messageEl.innerHTML = `They've gifted <b>${data.totalGifts} subs</b> in total!`;
|
}
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
// Get a list of all recipient users
|
||||||
}
|
Object.keys(data)
|
||||||
else {
|
.filter(key => /^gift\.recipientUser\d+$/.test(key))
|
||||||
contentEl.style.display = 'none';
|
.forEach((key, index) => {
|
||||||
}
|
const username = data[key];
|
||||||
|
messageEl.innerHTML += `${username}</br>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'twitch');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('TwitchRaid'):
|
case ('TwitchRaid'):
|
||||||
@@ -202,6 +224,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML = `<b>${data.user}</b><br>is raiding with a party of<br><b>${data.viewers} viewers!</b>`;
|
messageEl.innerHTML = `<b>${data.user}</b><br>is raiding with a party of<br><b>${data.viewers} viewers!</b>`;
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'twitch');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -217,6 +242,9 @@ async function CustomEvent(data) {
|
|||||||
subtitleEl.innerText = `${data.user}`;
|
subtitleEl.innerText = `${data.user}`;
|
||||||
|
|
||||||
contentEl.style.display = 'none';
|
contentEl.style.display = 'none';
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'youtube');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('YouTubeGiftMembershipReceived'):
|
case ('YouTubeGiftMembershipReceived'):
|
||||||
@@ -231,6 +259,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML = `<b>${data.user}</b><br>received a membership from<br><b>${data.gifterUser}</b>!`;
|
messageEl.innerHTML = `<b>${data.user}</b><br>received a membership from<br><b>${data.gifterUser}</b>!`;
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'youtube');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('YouTubeSuperChat'):
|
case ('YouTubeSuperChat'):
|
||||||
@@ -248,6 +279,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML += `<br><br><i>${data.message}</i>`;
|
messageEl.innerHTML += `<br><br><i>${data.message}</i>`;
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'youtube');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('YouTubeSuperSticker'):
|
case ('YouTubeSuperSticker'):
|
||||||
@@ -264,6 +298,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML = `<b>${data.user}</b><br>sent a Super Sticker!`;
|
messageEl.innerHTML = `<b>${data.user}</b><br>sent a Super Sticker!`;
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'youtube');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
@@ -283,6 +320,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML = '<b>First time subscriber!</b>';
|
messageEl.innerHTML = '<b>First time subscriber!</b>';
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'kick');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('KickGiftSubscription'):
|
case ('KickGiftSubscription'):
|
||||||
@@ -294,6 +334,9 @@ async function CustomEvent(data) {
|
|||||||
messageEl.innerHTML = `<b>${data["recipient.userName"]}</b><br>received a sub from<br><b>${data.user}</b>!`;
|
messageEl.innerHTML = `<b>${data["recipient.userName"]}</b><br>received a sub from<br><b>${data.user}</b>!`;
|
||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'kick');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ('KickMassGiftSubscription'):
|
case ('KickMassGiftSubscription'):
|
||||||
@@ -354,6 +397,9 @@ async function CustomEvent(data) {
|
|||||||
|
|
||||||
contentEl.appendChild(messageEl);
|
contentEl.appendChild(messageEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the platform icon
|
||||||
|
SetPlatformIcon(iconEl, 'kick');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -682,6 +728,14 @@ function EscapeRegExp(string) {
|
|||||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SetPlatformIcon(el, platform) {
|
||||||
|
// Set the platform icon
|
||||||
|
let baseURL = window.location.href;
|
||||||
|
baseURL = baseURL.replace(/index\.html$/i, '');
|
||||||
|
|
||||||
|
el.src = `${baseURL}/icons/platforms/${platform}.png`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
|
|||||||
@@ -31,22 +31,25 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
border-top: 1px solid black;
|
/* border-top: 1px solid black;
|
||||||
border-bottom: 1px solid black;
|
border-bottom: 1px solid black;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
margin: 1em 0em;
|
margin: 1em 0em; */
|
||||||
padding: 0.5em 0em;
|
padding: 0.5em 0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#icon {
|
||||||
|
height: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
#date {
|
#date {
|
||||||
margin-top: 1em;
|
margin: 0.5em 0em;
|
||||||
font-size: 0.7em;
|
font-size: 0.7em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
#footer {
|
#footer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.emote {
|
.emote {
|
||||||
|
|||||||