Fix main page emojis
This commit is contained in:
parent
8a12b9d344
commit
7c9151e693
3 changed files with 75 additions and 1 deletions
7
index.js
7
index.js
|
@ -72,7 +72,12 @@ function pageUpdate() {
|
|||
var status = lanyardData.activities[0]
|
||||
addedHTML += "<hr><p>"
|
||||
if (status.emoji) {
|
||||
addedHTML += `<img class="emoji" src="https://cdn.discordapp.com/emojis/${status.emoji.id}.webp?size=32&quality=lossless"/> `
|
||||
if (status.emoji.id) {
|
||||
addedHTML += `<img class="emoji" src="https://cdn.discordapp.com/emojis/${status.emoji.id}.webp?size=32&quality=lossless"/> `
|
||||
} else {
|
||||
addedHTML += status.emoji.name
|
||||
}
|
||||
|
||||
}
|
||||
if (status.state) {
|
||||
addedHTML += `<em><span style="color: lightgray">"`
|
||||
|
|
43
static/discord/index.html
Normal file
43
static/discord/index.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="stylesheet" href="../style.css">
|
||||
|
||||
|
||||
<meta content="Discord Status - Violet's Purgatory" property="og:title" />
|
||||
<meta content="The answers to all your not-so-frequently-asked questions!" />
|
||||
<meta content="https://api.lanyard.rest/534132311781015564.png" property="og:image" />
|
||||
<meta content="#a200ff" data-react-helmet="true" name="theme-color" />
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||
|
||||
<title>Discord Status - Violet's Purgatory</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript><h2>Sorry! This page requires javascript... The rest of this site doesn't, though!</h2></noscript>
|
||||
<h1>Discord Status</h1>
|
||||
<p>This is a more fleshed out version of the main discord status on my site, issue being, it requires Javascript. So, I choose not to use it, though it coulda been cool...</p>
|
||||
<p>I still am tempted to add something like it to the main page, and just make it compatible without javascript, but I worry that'd upset people.</p>
|
||||
|
||||
<div class="container-fluid row" id="card">
|
||||
<h2>Violet</h2>
|
||||
<div style="display: flex; justify-content: center; align-items: center;">
|
||||
<img src="https://api.lanyard.rest/534132311781015564.png?" class="pfp">
|
||||
<div>
|
||||
<p><a href="pronouns">They/Them</a></p>
|
||||
<p>Developer</p>
|
||||
<p id="discStatus">Offline</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p id="discQuote"></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="./index.js"></script>
|
||||
</html>
|
26
static/discord/index.js
Normal file
26
static/discord/index.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var lanyard = new WebSocket('wss://api.lanyard.rest/socket')
|
||||
|
||||
function beat(dur) {
|
||||
lanyard.send(JSON.stringify({
|
||||
op: 3
|
||||
}))
|
||||
setTimeout(() => {
|
||||
beat(dur)
|
||||
}, dur);
|
||||
}
|
||||
|
||||
lanyard.addEventListener("message", (res) => {
|
||||
var data = JSON.parse(res.data)
|
||||
if (data.op == 1) {
|
||||
beat(data.d.heartbeat_interval)
|
||||
lanyard.send(JSON.stringify({
|
||||
op: 2,
|
||||
d: {
|
||||
subscribe_to_id: "534132311781015564"
|
||||
}
|
||||
}))
|
||||
} else if (data.op == 0) {
|
||||
var lanyardData = data.d
|
||||
$("*").text(JSON.stringify(lanyardData))
|
||||
}
|
||||
})
|
Loading…
Reference in a new issue