cool
This commit is contained in:
parent
8b00520d73
commit
7cfbba237c
1 changed files with 7 additions and 4 deletions
11
js/app.js
11
js/app.js
|
@ -5,7 +5,7 @@ let users = {};
|
||||||
let fetchData;
|
let fetchData;
|
||||||
|
|
||||||
async function genTree(treeId) {
|
async function genTree(treeId) {
|
||||||
fetchData = await fetch(`https://scratch.mit.edu/projects/${treeId}/remixtree/bare`)
|
fetchData = fetchData || await fetch(`https://scratch.mit.edu/projects/${treeId}/remixtree/bare/`)
|
||||||
.then(x => x.json());
|
.then(x => x.json());
|
||||||
|
|
||||||
entries.push(treeId)
|
entries.push(treeId)
|
||||||
|
@ -21,10 +21,12 @@ async function genTree(treeId) {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let doThings = false;
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await genTree("946114669"); // latest project
|
await genTree("946309808"); // latest project
|
||||||
await genTree("654605857"); // tree bug here, unavoidable without jank
|
await genTree("654605857"); // tree bug here, unavoidable without jank
|
||||||
console.log(entries)
|
doThings = true;
|
||||||
document.querySelector('.contributors').textContent = Object.keys(users).join(', ');
|
document.querySelector('.contributors').textContent = Object.keys(users).join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,10 +41,11 @@ function sanitize(content) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
|
if (doThings && (window.innerHeight + window.scrollY) >= document.body.scrollHeight - 25) {
|
||||||
let h = '';
|
let h = '';
|
||||||
for (let j = 0; j < 35; j++) {
|
for (let j = 0; j < 35; j++) {
|
||||||
let entry = entries[i];
|
let entry = entries[i];
|
||||||
|
if (!entry || !(entry in fetchData)) break;
|
||||||
h += `<div class='proj'><a href="https://scratch.mit.edu/projects/${entry}"><img src='https://uploads.scratch.mit.edu/get_image/project/${entry}_1920x1080.png'>${sanitize(fetchData[entry].title)} [${entries.length - i }]</a></div>`;
|
h += `<div class='proj'><a href="https://scratch.mit.edu/projects/${entry}"><img src='https://uploads.scratch.mit.edu/get_image/project/${entry}_1920x1080.png'>${sanitize(fetchData[entry].title)} [${entries.length - i }]</a></div>`;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue