REAL jank but it works!

This commit is contained in:
Bingus_Violet 2024-01-03 17:40:05 -06:00
parent bc56e39e1b
commit b58b964f4c

View file

@ -17,6 +17,10 @@ var lanyardData = undefined
var discData = null var discData = null
const activityImages = {
"ULTRAKILL": "https://thumbor-production-0e82.up.railway.app/unsafe/512x512/https://fs.violets-purgatory.dev/ULTRAKILL/etc/DiscordIcon.webp"
}
var mastoData = { var mastoData = {
"lastUpdate": 0, "lastUpdate": 0,
"HTML": "" "HTML": ""
@ -92,11 +96,28 @@ function pageUpdate() {
for (let index = 0; index < lanyardData.activities.length; index++) { for (let index = 0; index < lanyardData.activities.length; index++) {
const activity = lanyardData.activities[index]; const activity = lanyardData.activities[index];
var found = false
for (let index = 0; index < lanyardData.activities.length; index++) {
const act = lanyardData.activities[index]
if (act.name == activity.name) {
if (Object.keys(act).length > Object.keys(activity).length) {
found = true
}
}
}
if (found) {
continue
}
if (!debounce && activity.type != 4) { if (!debounce && activity.type != 4) {
addedHTML += `<h2><hr>What I'm up to:</h2><div class="container-fluid row" style="margin: 0; padding: 0; display: flex;">` addedHTML += `<h2><hr>What I'm up to:</h2><div class="container-fluid row" style="margin: 0; padding: 0; display: flex;">`
debounce = true debounce = true
} }
function get_img() { function get_img() {
if (activity.name in activityImages) {
return decodeURIComponent(activityImages[activity.name])
}
if ("assets" in activity) { if ("assets" in activity) {
var image = undefined var image = undefined
if ("large_image" in activity.assets) { if ("large_image" in activity.assets) {
@ -148,6 +169,10 @@ function pageUpdate() {
if (activity.timestamps) { if (activity.timestamps) {
time = activity.timestamps.start time = activity.timestamps.start
} }
if (!activity.assets) {
activity.assets = {"large_text": " ", "small_text": " "}
}
addedHTML += ` addedHTML += `
<div class="chip activity col-md-6 testing"> <div class="chip activity col-md-6 testing">
<img src="${get_img()}" title="${activity.assets.large_text || activity.assets.small_text}"> <img src="${get_img()}" title="${activity.assets.large_text || activity.assets.small_text}">