More updates to discord page, removed extra code
This commit is contained in:
parent
7c9151e693
commit
3cdf3b0bce
4 changed files with 38 additions and 16 deletions
13
index.js
13
index.js
|
@ -92,19 +92,6 @@ function pageUpdate() {
|
||||||
|
|
||||||
addedHTML = ""
|
addedHTML = ""
|
||||||
|
|
||||||
if (lanyardData) {
|
|
||||||
for (let index = 0; index < lanyardData.activities.length; index++) {
|
|
||||||
const activity = lanyardData.activities[index];
|
|
||||||
if (activity.type == 4) {
|
|
||||||
addedHTML += `<p><em><span style="color: lightgray">"${lanyardData.activities[0].state}"</span> - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}</em></p>`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
html = html.replace("{LANYARD_SPOTIFY}", addedHTML)
|
|
||||||
|
|
||||||
addedHTML = ""
|
|
||||||
|
|
||||||
var debounce = false
|
var debounce = false
|
||||||
|
|
||||||
if (lanyardData && lanyardData.activities.length > 0) {
|
if (lanyardData && lanyardData.activities.length > 0) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<hr>
|
<hr>
|
||||||
<p class="chip"><a href="./pronouns">Pronouns</a></p>
|
<p class="chip"><a href="./discord">Disc Status</a></p>
|
||||||
<p class="chip"><a href="./socials">Socials</a></p>
|
<p class="chip"><a href="./socials">Socials</a></p>
|
||||||
<p class="chip"><a href="./projects">Projects</a></p>
|
<p class="chip"><a href="./projects">Projects</a></p>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<div>
|
<div>
|
||||||
<p><a href="pronouns">They/Them</a></p>
|
<p><a href="pronouns">They/Them</a></p>
|
||||||
<p>Developer</p>
|
<p>Developer</p>
|
||||||
<p id="discStatus">Offline</p>
|
<p id="discStatus" style="transition: all 2s cubic-bezier(0.075, 0.82, 0.165, 1);">Offline</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
var lanyard = new WebSocket('wss://api.lanyard.rest/socket')
|
var lanyard = new WebSocket('wss://api.lanyard.rest/socket')
|
||||||
|
|
||||||
|
var statuses = {
|
||||||
|
"online": {
|
||||||
|
"text": "Online",
|
||||||
|
"color": "rgb(100, 255, 100)"
|
||||||
|
},
|
||||||
|
"dnd": {
|
||||||
|
"text": "DND",
|
||||||
|
"color": "rgb(255, 100, 100)"
|
||||||
|
},
|
||||||
|
"idle": {
|
||||||
|
"text": "Idle",
|
||||||
|
"color": "rgb(255, 255, 75)"
|
||||||
|
},
|
||||||
|
"offline": {
|
||||||
|
"text": "Offline",
|
||||||
|
"color": "rgb(125, 125, 125)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function beat(dur) {
|
function beat(dur) {
|
||||||
lanyard.send(JSON.stringify({
|
lanyard.send(JSON.stringify({
|
||||||
op: 3
|
op: 3
|
||||||
|
@ -21,6 +40,22 @@ lanyard.addEventListener("message", (res) => {
|
||||||
}))
|
}))
|
||||||
} else if (data.op == 0) {
|
} else if (data.op == 0) {
|
||||||
var lanyardData = data.d
|
var lanyardData = data.d
|
||||||
$("*").text(JSON.stringify(lanyardData))
|
// $("*").text(JSON.stringify(lanyardData))
|
||||||
|
|
||||||
|
|
||||||
|
var statusData = statuses[lanyardData.discord_status]
|
||||||
|
|
||||||
|
$("#discStatus").text(statusData.text)
|
||||||
|
$("#discStatus").css("color", statusData.color)
|
||||||
|
$(".pfp").css("border-color", statusData.color)
|
||||||
|
|
||||||
|
if (lanyardData) {
|
||||||
|
for (let index = 0; index < lanyardData.activities.length; index++) {
|
||||||
|
const activity = lanyardData.activities[index];
|
||||||
|
if (activity.type == 4) {
|
||||||
|
$("#discQuote").html(`<hr><em><span style="color: lightgray">"${lanyardData.activities[0].state}"</span> - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}</em>`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
Loading…
Reference in a new issue