FILE / ScuroNeko/scuroneko.dev
js/data.js
Исходный файл и его история в репозитории.
30 lines
622 B
JavaScript
30 lines
622 B
JavaScript
let stackList = [];
|
|
let projectsList = [];
|
|
let linksList = [];
|
|
|
|
const fetchJson = async (path) => {
|
|
const response = await fetch(path);
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`Failed to load ${path}: ${response.status}`);
|
|
}
|
|
|
|
return response.json();
|
|
};
|
|
|
|
const loadIcon = async (key) => {
|
|
const response = await fetch(`./icons/${key}.svg`);
|
|
|
|
if (!response.ok) {
|
|
return key;
|
|
}
|
|
|
|
return response.text();
|
|
};
|
|
|
|
const formatIndex = (index) => String(index + 1).padStart(2, "0");
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
loadStack().then(loadProjects).then(loadLinks).catch(console.error);
|
|
});
|