fix incorrect playtime

This commit is contained in:
ReznoRMichael 2020-09-11 17:43:51 +02:00
parent 050660146d
commit 87d78cf70b
2 changed files with 5 additions and 4 deletions

View file

@ -386,12 +386,13 @@ function HKCheckCompletion(jsonObject) {
if (i === "playTime") {
let icon = "<i class='icon-clock'></i>";
let seconds = Math.floor(HKPlayerData.playTime);
let minutes = Math.round((seconds / 60) % 60);
let hours = Math.round(seconds / 3600);
let sec = Math.round(seconds % 60);
let minutes = Math.floor((seconds / 60) % 60);
let hours = Math.floor(seconds / 3600);
let sec = Math.floor(seconds % 60);
if (sec <= 10) sec = "0" + sec;
if (minutes <= 10) minutes = "0" + minutes;
let textFill = "Time Played: <b>" + hours + " h " + minutes + " min " + sec + " sec</b>";
document.getElementById(DIV_ID.intro.id).innerHTML += divStart + icon + textFill + divEnd;

View file

@ -42,7 +42,7 @@ function loadJSON(filename, callback) {
xobj.send(null);
}
loadJSON("save/" + fileName[5],
loadJSON("save/" + fileName[1],
function JSONparse(response) {
// Parse JSON string into object
jsonObj = JSON.parse(response);