such a yes
This commit is contained in:
parent
2ee0adf095
commit
2a4ac40ee2
4 changed files with 185 additions and 0 deletions
51
js/app.js
Normal file
51
js/app.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
let area = document.querySelector('#area-main');
|
||||
let entries = [];
|
||||
let users = {};
|
||||
|
||||
let fetchData;
|
||||
|
||||
async function genTree(treeId) {
|
||||
fetchData = await fetch(`https://scratch.mit.edu/projects/${treeId}/remixtree/bare`)
|
||||
.then(x => x.json());
|
||||
|
||||
entries.push(treeId)
|
||||
let entry = fetchData[treeId];
|
||||
|
||||
while (entry) {
|
||||
entry = entry.parent_id;
|
||||
entries.push(entry);
|
||||
entry = fetchData[entry];
|
||||
if (entry) users[entry.username] = true;
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await genTree("945978970"); // latest project
|
||||
await genTree("654605857"); // tree bug here, unavoidable without jank
|
||||
console.log(entries)
|
||||
document.querySelector('.contributors').textContent = Object.keys(users).join(', ');
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
let i = 0;
|
||||
|
||||
function sanitize(content) {
|
||||
const decoder = document.createElement('div');
|
||||
decoder.textContent = content;
|
||||
return decoder.innerHTML;
|
||||
}
|
||||
|
||||
setInterval(function() {
|
||||
if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
|
||||
let h = '';
|
||||
for (let j = 0; j < 35; j++) {
|
||||
let entry = entries[i];
|
||||
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'>${fetchData[entry].title}</a></div>`;
|
||||
i++;
|
||||
}
|
||||
area.innerHTML += h;
|
||||
}
|
||||
},500);
|
Loading…
Add table
Add a link
Reference in a new issue