Word highlighting

This commit is contained in:
Bingus_Violet 2024-01-27 12:02:59 -06:00
parent 0b2f1d6d82
commit 9c8af629fe
3 changed files with 40 additions and 5 deletions

View file

@ -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"
}
}

View file

@ -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 += `<em><span style="color: lightgray">"`
addedHTML += (status.state || "")
addedHTML += `<em><span style="color: lightgray; white-space: pre-wrap">"`
// addedHTML += (status.state || "")
var splitStatus = status.state.split(' ')
for (let index = 0; index < splitStatus.length; index++) {
const text = splitStatus[index];
if (highlight[text]) {
addedHTML += `<span style="color: ${highlight[text]}">${text}</span>`
} else {
addedHTML += text
}
addedHTML += ' '
}
addedHTML += `"</span>`
}
addedHTML += ` - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}</em></p>`
@ -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 += `<span style="color: ${highlight[text]}">${text}</span>`
} else {
finalQuote += text
}
finalQuote += ' '
}
quote = finalQuote.trim()
quote = quote.replace("{QUOTE_COUNT}", randomQuotes.length)
html = html.replace("{RANDOM_QUOTE}", quote)

View file

@ -23,7 +23,7 @@
<body>
<h1>Welcome to Violet's Purgatory</h1>
<p>{RANDOM_QUOTE}</p>
<p style="white-space: pre-wrap;">{RANDOM_QUOTE}</p>
<div class="fadediv">
<div class="container-fluid row" id="card">
<h2>Violet</h2>