function daysIntoYear(date){ return (Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) - Date.UTC(date.getFullYear(), 0, 0)) / 24 / 60 / 60 / 1000; } function secondsIntoDay(time) { let hour = time.getUTCHours(); let minute = time.getUTCMinutes(); let second = time.getUTCSeconds(); return ((hour * 3600) + (minute * 60) + second) } let pfps = [["deadvey","/images/pfp6.png"]] let divText = document.getElementById("comments").innerHTML; newPageHTML=""; for (let comment = 0; comment < comments.length; comment++) { for (let i = 0; i < pfps.length; i++) { if (pfps[i][0] == comments[comment][0]) { comments[comment][0] = ` ` + comments[comment][0] } } if (typeof comments[comment][2] == 'undefined') { newPageHTML+=`${comments[comment][0]}: ${comments[comment][1]}
` } else { let time = new Date(comments[comment][2]) let second = Math.round((secondsIntoDay(time) / (86400/65536))).toString(16); let day = daysIntoYear(time).toString(16); let year = time.getUTCFullYear().toString(16); newPageHTML+=`[${second} ${day}/${year}] ${comments[comment][0]}: ${comments[comment][1]}
` } }; document.getElementById("comments").innerHTML = newPageHTML