This commit is contained in:
biglyderv 2024-09-13 19:02:19 -04:00
parent 212fce1dcf
commit fc0dbc4555
No known key found for this signature in database
GPG key ID: 33AC87E9ACE66954
2 changed files with 27 additions and 8 deletions

View file

@ -18,7 +18,7 @@ async function genTree(treeId) {
let us = users[entryDat.username]; let us = users[entryDat.username];
let s = 1 / ((new Date() - new Date(entryDat.datetime_created.$date)) + 1000*60*60); let s = 1 / ((new Date() - new Date(entryDat.datetime_created.$date)) + 1000 * 60 * 60);
sum += s; sum += s;
users[entryDat.username] = (us ? us : 0) + s; users[entryDat.username] = (us ? us : 0) + s;
entry = entryDat.parent_id; entry = entryDat.parent_id;
@ -28,11 +28,18 @@ async function genTree(treeId) {
} }
async function main() { async function main() {
fetchData = await fetch(`https://scratch.mit.edu/projects/${treeID}/remixtree/bare/`).then(x => x.json()); // fetchData = await fetch(`https://scratch.mit.edu/projects/${treeID}/remixtree/bare/`).then(x => x.json());
fetchData = await fetch(`https://hf.zenoverse.net/tree/`).then(x => x.json());
let latestData = await fetch(`https://hf.zenoverse.net/api/`).then(x => x.json()); let latestData = await fetch(`https://hf.zenoverse.net/api/`).then(x => x.json());
let lid = latestData[0].id; let lid = latestData[0].id;
let i = 0;
while (!fetchData[lid]) {
i++;
lid = latestData[i].id;
}
while (fetchData[lid].children.length > 0) { while (fetchData[lid].children.length > 0) {
let ch = fetchData[lid].children; let ch = fetchData[lid].children;
let ch2 = ch.filter(x => fetchData[x].children.length > 0); let ch2 = ch.filter(x => fetchData[x].children.length > 0);
@ -45,13 +52,15 @@ async function main() {
let params = new URL(window.location).searchParams; let params = new URL(window.location).searchParams;
entries.forEach((x,i) => x && fetchData[x] ? (fetchData[x].id = entries.length - i - 2) : null); entries.forEach((x, i) => x && fetchData[x] ? (fetchData[x].id = entries.length - i - 2) : null);
let start = params.get('start') * 1; let start = params.get('start') * 1;
let end = params.get('end') * 1; let end = params.get('end') * 1;
end = Math.min(end,entries.length-2);
if (start && end) { if (start && end) {
entries = entries.splice(entries.length - end - 2,end - start + 1); entries = entries.splice(entries.length - end - 2, end - start + 1);
} }
doThings = true; doThings = true;
@ -60,7 +69,7 @@ async function main() {
.map(x => `<a href='https://scratch.mit.edu/users/${x}'>${x}</a> <sub>${Math.trunc(users[x] / sum * 100000) / 1000}%</sub>`) .map(x => `<a href='https://scratch.mit.edu/users/${x}'>${x}</a> <sub>${Math.trunc(users[x] / sum * 100000) / 1000}%</sub>`)
.join(', '); // Doesn't need to be sanitized (hopefully) .join(', '); // Doesn't need to be sanitized (hopefully)
let newEras = importedEras.split('\n').map(x => x.split('-')).map(x => ({start: x[0] * 1, end: x[1] * 1, name: x[2].slice(1)})); let newEras = importedEras.split('\n').map(x => x.split('-')).map(x => ({ start: x[0] * 1, end: x[1] * 1, name: x[2].slice(1) }));
eras = [...eras, ...newEras]; eras = [...eras, ...newEras];

View file

@ -435,7 +435,17 @@ let eras = [
{ {
'name': 'Welded Eon', 'name': 'Welded Eon',
'start': 7647, 'start': 7647,
'end': 8218 'end': 8276
}, },
{
'name': 'Unstroyed Eon',
'start': 8277,
'end': 8467
},
{
'name': 'Post-Dzje Eon',
'start': 8468,
'end': 9000
},
]; ];