function parseDate(date) {
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
return months[date.getUTCMonth()] + ' ' + date.getUTCDate() + ', ' + date.getUTCFullYear() + ' ' + date.toLocaleTimeString();
}
function parseUser(user) {
const html = `
${user.first + ' ' + user.last}
Joined ${parseDate(new Date(user.date))}
Gender: ${user.gender}
Birthday: ${user.month + ' ' + user.day + ', ' + user.year}
User ID: ${user.id}
`
return html
}
function render() {
const html = `
${data.users.map(u => parseUser(u)).join('')}
`
add(html, 'users')
const load = `
`
if (page !== -1) {
add(load, 'load')
} else {
remove('load')
}
}
var page = 0
var data = {
users: []
}
async function load() {
const users = (await loaduserspage(page)).json
if (users.length === 0) {
page = -1
} else {
page++
}
data.users.push(... users)
render()
}
header(false, true)
load()