forked from nin0/website
restructured everything
This commit is contained in:
parent
20a423fb4e
commit
c8414116ca
17 changed files with 1983 additions and 304 deletions
66
public/js/index.js
Normal file
66
public/js/index.js
Normal file
|
@ -0,0 +1,66 @@
|
|||
const shouldLog = false;
|
||||
function log(content) {
|
||||
if (shouldLog) console.log(content);
|
||||
}
|
||||
function onUpdate(data) {
|
||||
// set status
|
||||
log(data);
|
||||
const pfp = document.getElementById("pfp");
|
||||
switch(data.discord_status) {
|
||||
case "online":
|
||||
pfp.style.borderColor = "var(--online-color)";
|
||||
break;
|
||||
case "idle":
|
||||
pfp.style.borderColor = "var(--idle-color)";
|
||||
break;
|
||||
case "dnd":
|
||||
pfp.style.borderColor = "var(--dnd-color)";
|
||||
break;
|
||||
case "offline":
|
||||
pfp.style.borderColor = "var(--offline-color)";
|
||||
break;
|
||||
}
|
||||
// set presence
|
||||
log(data.activities);
|
||||
let listening = false;
|
||||
let content = "";
|
||||
data.activities.forEach(presence => {
|
||||
if(presence.application_id === "463151177836658699" && presence.assets.small_text != "Paused") { // premid
|
||||
listening = true;
|
||||
artist = presence.state.substring(0, presence.state.indexOf(" -"));
|
||||
if (artist === "") {
|
||||
artist = presence.state;
|
||||
}
|
||||
content = `Listening to ${presence.details} - ${artist}`;
|
||||
}
|
||||
if(presence.application_id === "1108588077900898414") { // vencord lastfm
|
||||
listening = true;
|
||||
content = `Listening to ${presence.details} - ${presence.state}`;
|
||||
}
|
||||
if(presence.application_id === "1054951789318909972") { // vendetta lastfm
|
||||
listening = true;
|
||||
content = `Listening to ${presence.details} - ${presence.state}`;
|
||||
}
|
||||
if(presence.id === "spotify:1") { // built in spotify hooluy shit normal presence)
|
||||
listening = true;
|
||||
content = `Listening to ${presence.details} - ${presence.state}`;
|
||||
}
|
||||
if(presence.type === 0 && presence.application_id !== "463151177836658699" && presence.application_id !== "1108588077900898414") { // generic playing status that isn't vencord lastfm or premid
|
||||
listening = false;
|
||||
content = `Playing ${presence.name}`;
|
||||
}
|
||||
|
||||
});
|
||||
document.getElementById("presence").style.display = content === "" ? "none": "flex";
|
||||
document.getElementById("presence-content").innerText = content;
|
||||
document.getElementById("presence-icon").src = listening ? "music.ico" : "game.ico";
|
||||
}
|
||||
LanyardWrapper.connectWebSocket("886685857560539176", onUpdate)
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function showCredits() {
|
||||
document.getElementById("credits").style.display = "block";
|
||||
document.getElementById("credits-button").style.display = "none";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue