From 9c8af629fef0409d62f98b593c1594a14ea9d26c Mon Sep 17 00:00:00 2001
From: Bingus_Violet
Date: Sat, 27 Jan 2024 12:02:59 -0600
Subject: [PATCH] Word highlighting
---
config.json | 10 ++++++++--
index.js | 33 +++++++++++++++++++++++++++++++--
resources/mainPage.html | 2 +-
3 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/config.json b/config.json
index e26659d..e0f7d7a 100644
--- a/config.json
+++ b/config.json
@@ -53,7 +53,8 @@
"You know... I was a Roblox Developer Once...",
"I used to love Star Glitcher games",
"Git rebase my beloved...",
- "I'm gonna buy univerter.dev someday!"
+ "I'm gonna buy univerter.dev someday!",
+ "These birds are Pissing me off... I'm the original Starwalker"
],
"thumborInstances": [
@@ -61,5 +62,10 @@
"https://enormous-book-production.up.railway.app/",
"https://unusual-back-production.up.railway.app/",
"https://axiomatic-hair-production.up.railway.app/"
- ]
+ ],
+ "highlightedWords": {
+ "birds": "yellow",
+ "Pissing": "yellow",
+ "Starwalker": "yellow"
+ }
}
\ No newline at end of file
diff --git a/index.js b/index.js
index c36ec54..632ad86 100644
--- a/index.js
+++ b/index.js
@@ -19,6 +19,8 @@ var thumborInstances = config.thumborInstances
var activityImages = config.activityImages
+var highlight = config.highlightedWords
+
var thumbCount = 0
function getThumbor() {
@@ -106,8 +108,19 @@ function pageUpdate() {
}
}
if (status.state) {
- addedHTML += `"`
- addedHTML += (status.state || "")
+ addedHTML += `"`
+ // addedHTML += (status.state || "")
+ var splitStatus = status.state.split(' ')
+
+ for (let index = 0; index < splitStatus.length; index++) {
+ const text = splitStatus[index];
+ if (highlight[text]) {
+ addedHTML += `${text}`
+ } else {
+ addedHTML += text
+ }
+ addedHTML += ' '
+ }
addedHTML += `"`
}
addedHTML += ` - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}
`
@@ -300,6 +313,22 @@ function pageUpdate() {
var quote = randomQuotes[Math.floor(Math.random() * randomQuotes.length)]
+ var splitQuote = quote.split(' ')
+
+ var finalQuote = ''
+
+ for (let index = 0; index < splitQuote.length; index++) {
+ const text = splitQuote[index];
+ if (highlight[text]) {
+ finalQuote += `${text}`
+ } else {
+ finalQuote += text
+ }
+ finalQuote += ' '
+ }
+
+ quote = finalQuote.trim()
+
quote = quote.replace("{QUOTE_COUNT}", randomQuotes.length)
html = html.replace("{RANDOM_QUOTE}", quote)
diff --git a/resources/mainPage.html b/resources/mainPage.html
index 9266a4e..3abe897 100644
--- a/resources/mainPage.html
+++ b/resources/mainPage.html
@@ -23,7 +23,7 @@
Welcome to Violet's Purgatory
- {RANDOM_QUOTE}
+ {RANDOM_QUOTE}