re-add clan tags, never moved them after the js move
All checks were successful
Code quality checks / biome (push) Successful in 13s

This commit is contained in:
creations 2025-04-26 17:28:31 -04:00
parent bafdfb47f9
commit 94046881dd
Signed by: creations
GPG key ID: 8F553AA4320FC711
3 changed files with 81 additions and 38 deletions

View file

@ -102,7 +102,7 @@ body {
} }
.open-source-logo:hover { .open-source-logo:hover {
opacity: 1; opacity: 1 !important;
} }
.hidden { .hidden {
@ -349,6 +349,8 @@ ul {
padding: 0.75rem 1rem; padding: 0.75rem 1rem;
border-radius: 10px; border-radius: 10px;
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
transition: background-color 0.3s ease;
} }
.activity:hover { .activity:hover {

View file

@ -390,6 +390,8 @@ async function updatePresence(data) {
document.title = username; document.title = username;
} }
updateClanBadge(data);
const platform = { const platform = {
mobile: data.active_on_discord_mobile, mobile: data.active_on_discord_mobile,
web: data.active_on_discord_web, web: data.active_on_discord_web,
@ -559,6 +561,38 @@ async function getAllNoAsset() {
} }
} }
function updateClanBadge(data) {
const userInfoInner = document.querySelector(".user-info-inner");
if (!userInfoInner) return;
const clan = data?.discord_user?.clan;
if (!clan || !clan.tag || !clan.identity_guild_id || !clan.badge) return;
const existing = userInfoInner.querySelector(".clan-badge");
if (existing) existing.remove();
const wrapper = document.createElement("div");
wrapper.className = "clan-badge";
const img = document.createElement("img");
img.src = `https://cdn.discordapp.com/clan-badges/${clan.identity_guild_id}/${clan.badge}`;
img.alt = "Clan Badge";
const span = document.createElement("span");
span.className = "clan-name";
span.textContent = clan.tag;
wrapper.appendChild(img);
wrapper.appendChild(span);
const usernameEl = userInfoInner.querySelector(".username");
if (usernameEl) {
usernameEl.insertAdjacentElement("afterend", wrapper);
} else {
userInfoInner.appendChild(wrapper);
}
}
if (instanceUri) { if (instanceUri) {
if (!instanceUri.startsWith("http")) { if (!instanceUri.startsWith("http")) {
instanceUri = `https://${instanceUri}`; instanceUri = `https://${instanceUri}`;

View file

@ -1,32 +1,40 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head>
<head> <meta charset="UTF-8" />
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Discord Presence</title> <title>Discord Presence</title>
<link rel="stylesheet" href="/public/css/index.css"> <link rel="stylesheet" href="/public/css/index.css" />
<link rel="stylesheet" href="/public/css/root.css"> <link rel="stylesheet" href="/public/css/root.css" />
<meta name="color-scheme" content="dark"> <meta name="color-scheme" content="dark" />
<link rel="icon" id="site-icon" type="image/png"> <link rel="icon" id="site-icon" type="image/png" />
</head> </head>
<body> <body>
<div id="loading-overlay"> <div id="loading-overlay">
<div class="loading-spinner"></div> <div class="loading-spinner"></div>
</div> </div>
<a href="https://git.creations.works/creations/profilePage" target="_blank" rel="noopener noreferrer"> <a
<img class="open-source-logo" src="/public/assets/forgejo_logo.svg" alt="Forgejo Logo" style="opacity: 0.5;"> href="https://git.creations.works/creations/profilePage"
target="_blank"
rel="noopener noreferrer"
>
<img
class="open-source-logo"
src="/public/assets/forgejo_logo.svg"
alt="Forgejo Logo"
style="opacity: 0.5"
/>
</a> </a>
<div class="user-card"> <div class="user-card">
<div class="avatar-status-wrapper"> <div class="avatar-status-wrapper">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img class="avatar hidden" src=""> <img class="avatar hidden" src="" />
<div class="status-indicator offline hidden"></div> <div class="status-indicator offline hidden"></div>
</div> </div>
<div class="user-info"> <div class="user-info">
@ -47,6 +55,5 @@
</section> </section>
<script src="/public/js/index.js"></script> <script src="/public/js/index.js"></script>
</body> </body>
</html> </html>