function render() { const html = `
${data.user.firstname + ' ' + data.user.lastname} Joined ${parseDate(new Date(data.user.date))}
` add(html, 'top') const postsh = `
${data.posts.map(p => parsePost(p)).join('')}
` add(postsh, 'posts') const about = `
About
Name: ${data.user.firstname + ' ' + data.user.lastname} Email: ${data.user.email} Gender: ${data.user.gender} Birthday: ${months[data.user.month] + ' ' + data.user.day + ', ' + data.user.year} User ID: ${data.user.user_id}
` add(about, 'about') } var posts = true async function load() { header(false, false) var params = {}; for (const [key, value] of new URLSearchParams(location.search)) { params[key] = value } const id = params.id !== undefined && !isNaN(params.id) ? parseInt(params.id) : (await loadself()).json.user_id const posts = (await loadusersposts(id)).json data.posts.push(... posts) const batch = [id] for (const post of posts) { for(const comment of post.comments) { if (data.users[comment[0]] !== undefined) continue if (batch.includes(comment[0])) continue batch.push(comment[0]) } if (data.users[post.user_id] !== undefined) continue if (batch.includes(post.user_id)) continue batch.push(post.user_id) } const users = (await loadusers(batch)).json for (const user of users) { data.users[user.user_id] = user } data.user = data.users[id] render() } load()