mirror of
https://github.com/zyqunix/tools.git
synced 2025-07-05 14:00:31 +02:00
badge api
This commit is contained in:
parent
11ef9ce07e
commit
f193f1e86c
4 changed files with 51 additions and 3 deletions
|
@ -770,3 +770,19 @@ br {
|
||||||
#review-person:hover {
|
#review-person:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#badges {
|
||||||
|
display: flex;
|
||||||
|
padding: 3px;
|
||||||
|
background-color: var(--surface0);
|
||||||
|
border: 2px solid var(--surface1);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 3px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#badges > img {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
29
assets/js/badgesapi.js
Normal file
29
assets/js/badgesapi.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import { user } from "./index.js";
|
||||||
|
const apiUrl = "https://badges.atums.world";
|
||||||
|
|
||||||
|
|
||||||
|
export async function getBadges(user) {
|
||||||
|
const response = await fetch(`${apiUrl}/${user}`);
|
||||||
|
if (!response.ok) throw new Error(`Error fetching reviews: ${response.status} ${response.statusText}`);
|
||||||
|
const data = await response.json();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function populateBadges(element) {
|
||||||
|
const target = document.querySelector(element);
|
||||||
|
const data = await getBadges(user);
|
||||||
|
|
||||||
|
target.innerHTML = "";
|
||||||
|
|
||||||
|
data.badges.forEach(badge => {
|
||||||
|
const badgeEl = document.createElement("div");
|
||||||
|
const badgeImg = document.createElement("img");
|
||||||
|
badgeImg.src = badge.badge;
|
||||||
|
badgeEl.classList.add("tooltip");
|
||||||
|
badgeEl.setAttribute("data-tooltip", badge.tooltip);
|
||||||
|
badgeImg.style.width = "32px";
|
||||||
|
|
||||||
|
badgeEl.appendChild(badgeImg);
|
||||||
|
target.appendChild(badgeEl);
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
import * as wakatime from "./wakatime.js";
|
import * as wakatime from "./wakatime.js";
|
||||||
import * as github from "./github.js";
|
import * as github from "./github.js";
|
||||||
import * as reviewdb from "./reviewdb.js";
|
import * as reviewdb from "./reviewdb.js";
|
||||||
|
import * as badgeapi from "./badgesapi.js";
|
||||||
|
|
||||||
const timeElem = document.getElementById('time');
|
const timeElem = document.getElementById('time');
|
||||||
const timezone = 'Europe/Berlin';
|
const timezone = 'Europe/Berlin';
|
||||||
|
|
||||||
timeElem.setAttribute('data-tooltip', timezone);
|
export const user = "1201415921802170388";
|
||||||
|
|
||||||
function getTime(timezone) {
|
function getTime(timezone) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
@ -85,7 +87,6 @@ setInterval(() => {
|
||||||
ageElem.setAttribute("data-tooltip", updateAge(null, 10, "years old"));
|
ageElem.setAttribute("data-tooltip", updateAge(null, 10, "years old"));
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
const user = "1201415921802170388";
|
|
||||||
|
|
||||||
function lan() {
|
function lan() {
|
||||||
lanyard({userId: user}).then(data => {
|
lanyard({userId: user}).then(data => {
|
||||||
|
@ -289,6 +290,7 @@ function fetchWeather(location) {
|
||||||
wakatime.fetchWakatime("#wakapi");
|
wakatime.fetchWakatime("#wakapi");
|
||||||
github.writeGithubStats("#github-full");
|
github.writeGithubStats("#github-full");
|
||||||
reviewdb.writeReviews("#reviews");
|
reviewdb.writeReviews("#reviews");
|
||||||
|
badgeapi.populateBadges("#badges");
|
||||||
|
|
||||||
const messages = [
|
const messages = [
|
||||||
"Coding",
|
"Coding",
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
<div class="info" id="Info">
|
<div class="info" id="Info">
|
||||||
<img alt="Profile Picture" id="profile-picture" src="https://cdn.discordapp.com/embed/avatars/0.png"/>
|
<img alt="Profile Picture" id="profile-picture" src="https://cdn.discordapp.com/embed/avatars/0.png"/>
|
||||||
<h1 class="name"><a target="_blank" id="username">zyqunix</a></h1>
|
<h1 class="name"><a target="_blank" id="username">zyqunix</a></h1>
|
||||||
<span><div class="time tooltip" id="time"></div><div class="weather" id="weather"></div></span></span>
|
<div id="badges">Badges</div>
|
||||||
|
<span><div class="time" id="time"></div><div class="weather" id="weather"></div></span></span>
|
||||||
<div class="age tooltip" id="age"></div>
|
<div class="age tooltip" id="age"></div>
|
||||||
<span class="hobbies" id="hobbies">
|
<span class="hobbies" id="hobbies">
|
||||||
Coding, Listening to Music, Reverse Engineering, Playing Counter-Strike
|
Coding, Listening to Music, Reverse Engineering, Playing Counter-Strike
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue