mirror of
https://github.com/zyqunix/tools.git
synced 2025-07-06 06:20:30 +02:00
Compare commits
No commits in common. "d60f9c2453e33f45505528ee9c362ba8ea1cb1a1" and "b18bd5c94e02bed7c7bbdbcdf15a4cbf8b220d6f" have entirely different histories.
d60f9c2453
...
b18bd5c94e
4 changed files with 16 additions and 121 deletions
|
@ -758,15 +758,3 @@ br {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
color: var(--white) !important;
|
color: var(--white) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.review:hover {
|
|
||||||
background: var(--surface1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#review-person {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#review-person:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
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";
|
|
||||||
const timeElem = document.getElementById('time');
|
const timeElem = document.getElementById('time');
|
||||||
const timezone = 'Europe/Berlin';
|
const timezone = 'Europe/Berlin';
|
||||||
|
|
||||||
|
@ -17,45 +16,6 @@ function getTime(timezone) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export function formatTime(ms) {
|
|
||||||
const totalSecs = Math.floor(ms / 1000);
|
|
||||||
const hours = Math.floor(totalSecs / 3600);
|
|
||||||
const mins = Math.floor((totalSecs % 3600) / 60);
|
|
||||||
const secs = totalSecs % 60;
|
|
||||||
|
|
||||||
return `${String(hours).padStart(1, "0")}:${String(mins).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function formatVerbose(ms) {
|
|
||||||
const totalSecs = Math.floor(ms / 1000);
|
|
||||||
const hours = Math.floor(totalSecs / 3600);
|
|
||||||
const mins = Math.floor((totalSecs % 3600) / 60);
|
|
||||||
const secs = totalSecs % 60;
|
|
||||||
|
|
||||||
return `${hours}h ${mins}m ${secs}s`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function msToTimestamp(ms, seconds=true) {
|
|
||||||
if (seconds) {
|
|
||||||
const timestamp = new Date(ms).toLocaleTimeString('en-GB', {
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
second: "2-digit"
|
|
||||||
});
|
|
||||||
return timestamp;
|
|
||||||
} else {
|
|
||||||
const timestamp = new Date(ms).toLocaleTimeString('en-GB', {
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit"
|
|
||||||
});
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function msToDate(ms) {
|
|
||||||
return new Date(ms).toISOString();
|
|
||||||
}
|
|
||||||
|
|
||||||
timeElem.innerHTML = getTime(timezone);
|
timeElem.innerHTML = getTime(timezone);
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
@ -94,7 +54,6 @@ function lan() {
|
||||||
const activity = document.querySelector('.activity');
|
const activity = document.querySelector('.activity');
|
||||||
const activityNameElem = document.getElementById('activity-name');
|
const activityNameElem = document.getElementById('activity-name');
|
||||||
const activityImageElem = document.getElementById('activity-image');
|
const activityImageElem = document.getElementById('activity-image');
|
||||||
const uname = document.getElementById('username');
|
|
||||||
|
|
||||||
const gameActivity = data.activities.find(activity => activity.type === 0);
|
const gameActivity = data.activities.find(activity => activity.type === 0);
|
||||||
const status = data.activities.find(activity => activity.type === 4);
|
const status = data.activities.find(activity => activity.type === 4);
|
||||||
|
@ -105,27 +64,26 @@ function lan() {
|
||||||
offline: "#80848e"
|
offline: "#80848e"
|
||||||
};
|
};
|
||||||
|
|
||||||
const userName = data.discord_user.display_name
|
|
||||||
|
|
||||||
uname.innerText = userName;
|
|
||||||
uname.href = `https://discord.com/users/${data.discord_user.id}`
|
|
||||||
|
|
||||||
pfpElem.src = `https://cdn.discordapp.com/avatars/${user}/${data.discord_user.avatar}.webp`
|
pfpElem.src = `https://cdn.discordapp.com/avatars/${user}/${data.discord_user.avatar}.webp`
|
||||||
|
|
||||||
const borderColor = statusColors[data.discord_status] || statusColors.offline;
|
const borderColor = statusColors[data.discord_status] || statusColors.offline;
|
||||||
pfpElem.style.borderColor = borderColor;
|
pfpElem.style.borderColor = borderColor;
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
statusElem.innerHTML = `<strong class="quote">"${status.state}"</strong> - ${userName}`;
|
statusElem.innerHTML = `<strong class="quote">"${
|
||||||
|
status.state
|
||||||
|
}"</strong> - zyqunix`;
|
||||||
} else {
|
} else {
|
||||||
statusElem.innerHTML = `<strong class="quote">Empty void. Nothingness.</strong>`;
|
statusElem.innerHTML = `<strong class="quote">Empty void. Nothingness.</strong>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (gameActivity) {
|
if (gameActivity) {
|
||||||
|
|
||||||
const parts = [];
|
const parts = [];
|
||||||
if (gameActivity.name)
|
if (gameActivity.name)
|
||||||
parts.push(`<strong>Playing</strong> ${gameActivity.name}`);
|
parts.push(`<strong>Playing</strong> ${
|
||||||
|
gameActivity.name
|
||||||
|
}`);
|
||||||
|
|
||||||
|
|
||||||
if (gameActivity.details)
|
if (gameActivity.details)
|
||||||
|
@ -135,20 +93,18 @@ function lan() {
|
||||||
if (gameActivity.state)
|
if (gameActivity.state)
|
||||||
parts.push(gameActivity.state);
|
parts.push(gameActivity.state);
|
||||||
|
|
||||||
if (gameActivity.timestamps.start)
|
|
||||||
parts.push(`Since ${new Date(gameActivity.timestamps.start).toLocaleTimeString('en-GB', {
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
second: "2-digit"
|
|
||||||
})}`);
|
|
||||||
|
|
||||||
activityNameElem.innerHTML = parts.join(': ');
|
activityNameElem.innerHTML = parts.join(': ');
|
||||||
|
|
||||||
if (gameActivity.assets && gameActivity.assets.large_image) {
|
if (gameActivity.assets && gameActivity.assets.large_image) {
|
||||||
activityImageElem.src =`https://cdn.discordapp.com/app-assets/${gameActivity.application_id}/${gameActivity.assets.large_image}.png`;
|
const imgId = gameActivity.assets.large_image;
|
||||||
|
const imageUrl = imgId.startsWith("mp:external/") ? `https://media.discordapp.net/${
|
||||||
|
imgId.replace("mp:", "")
|
||||||
|
}` : `https://cdn.discordapp.com/app-assets/${
|
||||||
|
gameActivity.application_id
|
||||||
|
}/${imgId}.png`;
|
||||||
|
activityImageElem.src = imageUrl;
|
||||||
activityImageElem.style.display = "block";
|
activityImageElem.style.display = "block";
|
||||||
activityImageElem.style.width = "64px";
|
|
||||||
activityImageElem.style.height = "64px";
|
|
||||||
} else {
|
} else {
|
||||||
activityImageElem.style.display = "none";
|
activityImageElem.style.display = "none";
|
||||||
}
|
}
|
||||||
|
@ -163,7 +119,7 @@ window.onload = () => {
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
lan();
|
lan();
|
||||||
}, 60000);
|
}, 6000);
|
||||||
|
|
||||||
function generateLanguageCards(languagesData) {
|
function generateLanguageCards(languagesData) {
|
||||||
const container = document.querySelector('.languages');
|
const container = document.querySelector('.languages');
|
||||||
|
@ -288,7 +244,6 @@ function fetchWeather(location) {
|
||||||
|
|
||||||
wakatime.fetchWakatime("#wakapi");
|
wakatime.fetchWakatime("#wakapi");
|
||||||
github.writeGithubStats("#github-full");
|
github.writeGithubStats("#github-full");
|
||||||
reviewdb.writeReviews("#reviews");
|
|
||||||
|
|
||||||
const messages = [
|
const messages = [
|
||||||
"Coding",
|
"Coding",
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
import { msToDate, msToTimestamp } from "./index.js";
|
|
||||||
|
|
||||||
const API_URL = "https://manti.vendicated.dev/api/reviewdb";
|
|
||||||
const user = "1201415921802170388";
|
|
||||||
|
|
||||||
export async function fetchReviews(user) {
|
|
||||||
const response = await fetch(`${API_URL}/users/${user}/reviews`);
|
|
||||||
if (!response.ok) throw new Error(`Error fetching reviews: ${response.status} ${response.statusText}`);
|
|
||||||
const data = await response.json();
|
|
||||||
data.reviews = data.reviews.filter(r => r.id !== 0);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function writeReviews(target) {
|
|
||||||
const element = document.querySelector(target);
|
|
||||||
const data = await fetchReviews(user);
|
|
||||||
|
|
||||||
element.innerHTML = "";
|
|
||||||
|
|
||||||
data.reviews.forEach(review => {
|
|
||||||
const el = document.createElement("div");
|
|
||||||
el.classList.add("shadow", "review");
|
|
||||||
el.style.transition = "background 0.3s";
|
|
||||||
el.style.margin = "10px";
|
|
||||||
el.style.padding = "15px";
|
|
||||||
el.style.border = "2px solid var(--surface1)";
|
|
||||||
el.style.borderRadius = "5px";
|
|
||||||
el.innerHTML = `
|
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
||||||
<div style="display: flex; justify-content: left; align-items: center;">
|
|
||||||
<img src="${review.sender.profilePhoto}" style="height: 48px; border-radius: 50%; margin-right: 10px">
|
|
||||||
<a style="margin:0; color: var(--text);" id="review-person" href="https://discord.com/users/${review.sender.discordID}">${review.sender.username}</a>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; justify-content: left; align-items: center;">
|
|
||||||
<span style="margin-left: 10px; color: var(--overlay1); font-size: 0.8rem">${msToDate(review.timestamp * 1000).split('T')[0].replace(/-/g, '/')} @ ${msToTimestamp(review.timestamp * 1000, false)}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p style="margin: 5px">${review.comment}</p>
|
|
||||||
`;
|
|
||||||
element.appendChild(el);
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -13,7 +13,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="info" id="Info">
|
<div class="info" id="Info">
|
||||||
<img alt="Profile Picture" id="profile-picture"/>
|
<img alt="Profile Picture" id="profile-picture"/>
|
||||||
<h1 class="name"><a target="_blank" id="username">zyqunix</a></h1>
|
<h1 class="name tooltip" data-tooltip="zyqunix / Fabio / fentboiswag / монгол">zyqunix</h1>
|
||||||
<span><div class="time tooltip" id="time"></div><div class="weather" id="weather"></div></span></span>
|
<span><div class="time tooltip" 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">
|
||||||
|
@ -113,12 +113,6 @@
|
||||||
<h4 id="note">Note: I do forget to add new sites there sometimes. So check the <a href="https://github.com/zyqunix/tools">GitHub</a> if you think there are some missing</h4>
|
<h4 id="note">Note: I do forget to add new sites there sometimes. So check the <a href="https://github.com/zyqunix/tools">GitHub</a> if you think there are some missing</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="cards reviews shadow" id="User Reviews">
|
|
||||||
<h2 class="card-header">User Reviews</h2>
|
|
||||||
<div id="reviews"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="music">
|
<div class="music">
|
||||||
<img src="assets/img/dancing-banan.gif" class="banan" id="banan">
|
<img src="assets/img/dancing-banan.gif" class="banan" id="banan">
|
||||||
<div class="popup shadow" id="music-pop">
|
<div class="popup shadow" id="music-pop">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue