From 0faebb93212de37a072d3bc08ff6b5cb080883d8 Mon Sep 17 00:00:00 2001 From: coolesding <71647195+coolesding@users.noreply.github.com> Date: Wed, 20 Sep 2023 19:30:23 +0100 Subject: [PATCH] Badge rewrite to check for ID plus script change; constant username>bid (badge ID) --- .github/scripts/convert/index.mjs | 6 +++--- .github/scripts/generate/index.mjs | 6 +++--- db/data.json | 26 ++++++++++++-------------- db/template.css | 16 ++++++++-------- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/.github/scripts/convert/index.mjs b/.github/scripts/convert/index.mjs index 137b4b02..a9f6dc71 100644 --- a/.github/scripts/convert/index.mjs +++ b/.github/scripts/convert/index.mjs @@ -23,8 +23,8 @@ for (let i = 0; i < avis.length; i++) { const badges = {}; for (let i = 0; i < avis.length; i++) { const l = avis[i]; - const username = l.match(badgeMatcher)?.[1]; - if (username) badges[username] = avis[i + 10].match(imageMatcher)[1]; + const bid = l.match(badgeMatcher)?.[1]; + if (bid) badges[bid] = avis[i + 10].match(imageMatcher)[1]; } await writeFile( @@ -38,4 +38,4 @@ await writeFile( parser: "json", } ) -); +); \ No newline at end of file diff --git a/.github/scripts/generate/index.mjs b/.github/scripts/generate/index.mjs index c7e65829..e7b3af16 100644 --- a/.github/scripts/generate/index.mjs +++ b/.github/scripts/generate/index.mjs @@ -41,9 +41,9 @@ const dist = []; for (const [id, img] of Object.entries(data.avatars)) { dist.push(templates.avatar.replace(/{id}/g, id).replace(/{img}/g, img)); } -for (const [username, img] of Object.entries(data.badges)) { +for (const [bid, img] of Object.entries(data.badges)) { dist.push( - templates.badge.replace(/{username}/g, username).replace(/{img}/g, img) + templates.badge.replace(/{bid}/g, bid).replace(/{img}/g, img) ); } @@ -52,4 +52,4 @@ await writeFile( uglify ? UglifyCSS.processString(dist.join("\n")) : dist.join("\n\n") ); -console.timeEnd("Done"); +console.timeEnd("Done"); \ No newline at end of file diff --git a/db/data.json b/db/data.json index ecb8972a..65aebd81 100644 --- a/db/data.json +++ b/db/data.json @@ -47,7 +47,6 @@ "1035628178972082276": "https://i.ibb.co/VQR4mSf/doctor-david-livesey-david-livesey.gif", "582170007505731594": "https://i.ibb.co/N6KnNW1/gravityrush-kat-1.gif", "451379187031343104": "https://i.ibb.co/ZVLP8yb/a-b9b48c873a0db791573ce2fede294a95-size-128.gif", - "984488632733802537": "https://i.ibb.co/r6RZNJQ/demon-slayer-yoriichi-demon-slayer.gif", "839778012529426443": "https://i.ibb.co/NVBL75g/ezgif-2-9f15c0e235.gif", "1136739474408226948": "https://i.ibb.co/9NBB489/bread-sharing1.gif", "898801511193251861": "https://i.imgur.com/BjK3qFu.gif", @@ -112,7 +111,6 @@ "472524164729929749": "https://i.imgur.com/gYdmT87.gif", "879594641043894302": "https://i.imgur.com/h2TsPel.gif", "467315682397126657": "https://i.ibb.co/0G6t6YY/one-piece-ryuma.gif", - "1110164612642508840": "https://i.imgur.com/xInY2UA.gif", "371663410800361472": "https://i.imgur.com/T2tQKjW.gif", "771925597848862750": "https://i.imgur.com/TlKYjs7.gif", "435122754245754900": "https://i.imgur.com/Hqh6YIY.gif", @@ -134,24 +132,24 @@ }, "badges": { "clyde": "https://i.ibb.co/MSL3fPs/ezgif-1-327a983479.gif", - "real4mmar": "https://i.ibb.co/cxpYKq3/3cbcbebc-6ec6-44e9-9e30-7904ef2493ea.jpg", - "mat.rix.": "https://i.ibb.co/hZWmFTc/ezgif-4-480f60dec1.gif", + "613725399263739926": "https://i.ibb.co/cxpYKq3/3cbcbebc-6ec6-44e9-9e30-7904ef2493ea.jpg", + "863402791144521738": "https://i.ibb.co/hZWmFTc/ezgif-4-480f60dec1.gif", "AniMod": "https://i.ibb.co/rkPXN6t/ezgif-2-f387cc7c43.gif", - "alexlovesateez01": "https://i.ibb.co/fMzK7dW/IMG-2067-removebg-preview.png", + "419276039932346369": "https://i.ibb.co/fMzK7dW/IMG-2067-removebg-preview.png", "Midori": "https://i.imgur.com/S49qWoV.png", - "seph_the_lover": "https://i.ibb.co/KrnjRMH/ezgif-3-12f340fde9.gif", + "965411195819528293": "https://i.ibb.co/KrnjRMH/ezgif-3-12f340fde9.gif", ".huwedwards": "https://i.imgur.com/aSuFZiv.png", "dragonclaw08mm": "https://i.ibb.co/S3yzF3b/88387ea8-43b1-47fa-999c-5c57a61a6661.gif", "wx78main": "https://i.ibb.co/rtnLGHG/ezgif-2-f0f0477890.gif", "Blip": "https://i.ibb.co/4gcmPvb/output-onlinegiftools-1.gif", - "Carl-bot": "https://i.ibb.co/hcKhhS2/output-onlinegiftools.gif", - "Dyno": "https://i.ibb.co/CMFFdZs/output-onlinegiftools-2.gif", - "coolesding": "https://i.ibb.co/7Svq2NJ/1024751291504791654.gif", - "nexpid": "https://i.ibb.co/Kzr787W/poggers-fish-lol.gif", - "astremia": "https://i.imgur.io/S49qWoV.png", - "foxstorm1": "https://i.ibb.co/rwWMQVh/21b82740-be87-45ff-8ec6-8991e3b07495.png", - "ayoxys.": "https://i.ibb.co/5MVwhhZ/586222155897896960.gif", + "235148962103951360": "https://i.ibb.co/hcKhhS2/output-onlinegiftools.gif", + "161660517914509312": "https://i.ibb.co/CMFFdZs/output-onlinegiftools-2.gif", + "406084422308331522": "https://i.ibb.co/7Svq2NJ/1024751291504791654.gif", + "853550207039832084": "https://i.ibb.co/Kzr787W/poggers-fish-lol.gif", + "1052863317942730802": "https://i.imgur.io/S49qWoV.png", + "789872551731527690": "https://i.ibb.co/rwWMQVh/21b82740-be87-45ff-8ec6-8991e3b07495.png", + "500212086765518858": "https://i.ibb.co/5MVwhhZ/586222155897896960.gif", "thkarma": "https://i.ibb.co/PZ2PS46/output-onlinegiftools-1.gif", - "xd_nots4r4ng": "https://i.ibb.co/M7V5HsR/audi-automobile-manufacturer-1.gif" + "1010519447225765908": "https://i.ibb.co/M7V5HsR/audi-automobile-manufacturer-1.gif" } } diff --git a/db/template.css b/db/template.css index 9804e5d9..895334cb 100644 --- a/db/template.css +++ b/db/template.css @@ -1,21 +1,21 @@ /* AVATAR-TEMPLATE-BEGIN */ /* Custom avatar for {id} */ -[style*="avatars/{id}"], -[src*="avatars/{id}"]{ +[style^="https://cdn.discordapp.com/avatars/{id}"], +[src^="https://cdn.discordapp.com/avatars/{id}"]{ content: url({img}); background-image: url({img})!important; } /* AVATAR-TEMPLATE-END */ /* BADGE-TEMPLATE-BEGIN */ -/* Custom badge for {username} */ -.header-S26rhB:has([aria-label*="{username}"])>.headerTop-1PNKck>.badgeList-2aoHPw::before, -[aria-label="{username}"]>:first-child>:first-child>.profileBadges-2pItdR::before, -.userInfo-regn9W:has([aria-label*="{username}"])>:nth-child(2)>[role="group"]:before, -.baseLayout-1_9QRm:has([placeholder*="{username}"])>:last-child>:last-child>:last-child>[role="group"]:before{ +/* Custom badge for {bid} (bid = badge ID) */ +.userPopoutInner-nv9Y92:has(.avatar-31d8He:is([src^="https://cdn.discordapp.com/avatars/{bid}"]))>.topSection-13QKHs>header>.header-S26rhB>.headerTop-1PNKck>.container-1gYwHN:before, +.userPopoutInner-nv9Y92:has(.avatar-31d8He:is([src^="https://cdn.discordapp.com/avatars/{bid}"]))>.container-1gYwHN:before, +.userInfo-regn9W:has([src^="https://cdn.discordapp.com/avatars/{bid}"])>.wrapper-3Un6-K+div>.container-1gYwHN:before, +.userPopoutInner-nv9Y92:has(.imageUploaderInner-IIRaFr:is([style*="{bid}"]))>.container-1gYwHN:before{ content: ""; width: 22px; height: 22px; background: url({img}) center / 100% 100%; } -/* BADGE-TEMPLATE-END */ +/* BADGE-TEMPLATE-END */ \ No newline at end of file