31 lines
1.2 KiB
JavaScript
Executable File
31 lines
1.2 KiB
JavaScript
Executable File
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] = `<img src="${pfps[i][1]}" height="20"> ` + comments[comment][0]
|
|
}
|
|
}
|
|
if (typeof comments[comment][2] == 'undefined') {
|
|
newPageHTML+=`<b>${comments[comment][0]}</b>: <i>${comments[comment][1]}</i><br/>`
|
|
}
|
|
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}] <b>${comments[comment][0]}</b>: ${comments[comment][1]}<br/>`
|
|
}
|
|
};
|
|
document.getElementById("comments").innerHTML = newPageHTML
|