Add seconds in ally attacks page

This commit is contained in:
2025-11-16 01:53:27 +01:00
parent f841780ed9
commit 6e1bcf85f9

View File

@@ -201,6 +201,25 @@ function main() {
} }
}); });
} }
/* Improve attacks display */
if (section === "ally" && module === "attacks") {
let contentPane = document.getElementsByClassName("contentpane")[1]
let table = contentPane.getElementsByClassName("borderlist")[0];
let rows = table.getElementsByTagName("tr");
for (let i = 1; i < rows.length; i ++) {
let cells = rows[i].getElementsByTagName("td");
let arrivalDateCell = cells[3]
let arrivalTimeCell = cells[4];
let interval = arrivalTimeCell.textContent.split(":");
let seconds = parseInt(interval[0]) * 3600 + parseInt(interval[1]) * 60 + parseInt(interval[2]);
let arrival = new Date(Date.now() + seconds * 1000);
let hour = arrival.toLocaleTimeString("fr-FR");
arrivalDateCell.textContent = arrivalDateCell.textContent.replace(/(.*)\d\d:\d\d(.*)/, "$1" + hour + "$2");
}
}
} }
main(); main();