From 808207bbeb3bb551f7f556391cb211cbfc24409e Mon Sep 17 00:00:00 2001 From: Clove Twilight Date: Tue, 16 Jun 2026 22:52:45 +0100 Subject: [PATCH] statuses --- css/main.css | 46 +++++++++++++++++++++++++++++++++++++++++ discord-bots/index.html | 6 +++--- js/dev-info.js | 25 ++++++++++++++++++++++ js/friends.js | 27 ++++++++++++++++++++++++ js/now-playing.js | 4 ++++ music/index.html | 4 ++-- 6 files changed, 107 insertions(+), 5 deletions(-) diff --git a/css/main.css b/css/main.css index a1c7e3d..4de28bf 100644 --- a/css/main.css +++ b/css/main.css @@ -2093,6 +2093,25 @@ a.fc-name:hover { color: rgb(var(--accent-rgb)); } } .fc-user:empty { display: none; } +/* custom status (Discord activity type 4) */ +.fc-custom { + display: inline-flex; + align-items: center; + gap: 0.25rem; + font-size: 0.72rem; + color: var(--subtext-1); + margin-top: 0.1rem; + min-width: 0; +} +.fc-custom[hidden] { display: none; } +.fc-custom-emoji { width: 14px; height: 14px; display: block; flex: none; } +.fc-custom-emoji-uni { font-size: 0.8rem; line-height: 1; flex: none; } +.fc-custom-text { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .fc-badges { display: inline-flex; align-items: center; @@ -2923,6 +2942,33 @@ html[data-theme] body.api-body { } .pc-user:empty { display: none; } +/* status word (Online / Idle / Do Not Disturb / Offline) */ +.pc-status-text { + font-size: 0.7rem; + font-weight: 600; + white-space: nowrap; + color: var(--overlay-1); +} +.pc-status-text:empty { display: none; } +.pc-status-text::before { + content: ""; + display: inline-block; + width: 7px; + height: 7px; + border-radius: 50%; + margin-right: 0.3rem; + vertical-align: baseline; + background: var(--overlay-0); +} +.presence-card[data-status="online"] .pc-status-text { color: var(--green); } +.presence-card[data-status="online"] .pc-status-text::before { background: var(--green); } +.presence-card[data-status="idle"] .pc-status-text { color: var(--yellow); } +.presence-card[data-status="idle"] .pc-status-text::before { background: var(--yellow); } +.presence-card[data-status="dnd"] .pc-status-text { color: var(--red); } +.presence-card[data-status="dnd"] .pc-status-text::before { background: var(--red); } +.presence-card[data-status="offline"] .pc-status-text { color: var(--overlay-1); } +.presence-card[data-status="offline"] .pc-status-text::before { background: var(--overlay-0); } + /* ---- expandable sections ---- */ .pc-sections { display: flex; diff --git a/discord-bots/index.html b/discord-bots/index.html index 4407fe1..32056aa 100644 --- a/discord-bots/index.html +++ b/discord-bots/index.html @@ -64,7 +64,7 @@ -
+

Girls-Network

@@ -96,7 +96,7 @@
-
+

My Bots

@@ -160,7 +160,7 @@
-
+

Tools

diff --git a/js/dev-info.js b/js/dev-info.js index 4ee8a3c..6a397f1 100644 --- a/js/dev-info.js +++ b/js/dev-info.js @@ -291,4 +291,29 @@ } else { init(); } + + // ---- anchor links: open the targeted
and scroll to it -------- + // Sections are collapsible (and some are populated/un-hidden async), so a + // plain #hash won't reliably reveal them. Open + scroll on load and on + // hashchange, retrying briefly while late content settles in. + function openFromHash() { + var id = (location.hash || "").slice(1); + if (!id) return; + var attempts = 0; + (function tryOpen() { + var target = document.getElementById(id); + if (target && !target.hidden) { + if (target.tagName === "DETAILS") target.open = true; + target.scrollIntoView(); + return; + } + if (attempts++ < 10) setTimeout(tryOpen, 200); + })(); + } + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", openFromHash); + } else { + openFromHash(); + } + window.addEventListener("hashchange", openFromHash); })(); diff --git a/js/friends.js b/js/friends.js index e292e39..60447ed 100644 --- a/js/friends.js +++ b/js/friends.js @@ -97,6 +97,30 @@ return proxyImg(url, { w: 480 }); } + // custom-status emoji → CDN url (custom emoji) or null (unicode emoji) + function customEmojiUrl(e) { + if (!e || !e.id) return null; + return proxyImg("https://cdn.discordapp.com/emojis/" + e.id + (e.animated ? ".gif" : ".png") + "?size=32"); + } + // Render the Discord custom status (activity type 4): emoji + text. + function renderCustomStatus(refs, activities) { + if (!refs.custom) return; + var c = (activities || []).find(function (a) { return a && a.type === 4; }); + var text = c && c.state ? String(c.state) : ""; + var emoji = c && c.emoji; + if (!text && !(emoji && (emoji.id || emoji.name))) { + refs.custom.hidden = true; + refs.custom.innerHTML = ""; + return; + } + var eu = emoji ? customEmojiUrl(emoji) : null; + var emojiHtml = eu + ? '' + : (emoji && emoji.name ? '' + esc(emoji.name) + "" : ""); + refs.custom.innerHTML = emojiHtml + (text ? '' + esc(text) + "" : ""); + refs.custom.hidden = false; + } + // dstn.to badge list → small icon row (same source the presence card uses) function renderDstnBadges(badges) { if (!Array.isArray(badges)) return ""; @@ -150,6 +174,7 @@ '' + '' + '' + + '' + '' + '' + '
'; @@ -159,6 +184,7 @@ pfp: card.querySelector(".fc-pfp"), statusDot: card.querySelector(".fc-status"), user: card.querySelector(".fc-user"), + custom: card.querySelector(".fc-custom"), tag: card.querySelector(".fc-tag"), badges: card.querySelector(".fc-badges"), banner: card.querySelector(".fc-banner") @@ -188,6 +214,7 @@ refs.statusDot.title = STATUS_TITLE[status] || "Offline"; if (u.avatar) refs.pfp.src = avatarUrl(u); if (u.username) refs.user.textContent = "@" + u.username; + renderCustomStatus(refs, d.activities); renderClanTag(refs, u.primary_guild); return true; }) diff --git a/js/now-playing.js b/js/now-playing.js index 4d76bd6..bf8ca66 100644 --- a/js/now-playing.js +++ b/js/now-playing.js @@ -51,6 +51,7 @@ '' + '' + '' + + '' + '' + '' + '' + @@ -71,6 +72,8 @@ const tagEl = card.querySelector(".pc-tag"); const userEl = card.querySelector(".pc-user"); const platformsEl = card.querySelector(".pc-platforms"); + const statusTextEl = card.querySelector(".pc-status-text"); + const STATUS_TITLE = { online: "Online", idle: "Idle", dnd: "Do Not Disturb", offline: "Offline" }; const metaEl = card.querySelector(".pc-meta"); const badgesEl = card.querySelector(".pc-badges"); const sections = card.querySelector(".pc-sections"); @@ -505,6 +508,7 @@ const u = d.discord_user || {}; const status = d.discord_status || "offline"; card.dataset.status = status; + if (statusTextEl) statusTextEl.textContent = STATUS_TITLE[status] || "Offline"; avImg.src = avatarUrl(u); const deco = u.avatar_decoration_data; diff --git a/music/index.html b/music/index.html index 42824c3..62cacfc 100644 --- a/music/index.html +++ b/music/index.html @@ -62,14 +62,14 @@ -
+

Lyrics

Waiting for a track…

-

Recently played

+

Recently played