readme.md

This commit is contained in:
ReznoRMichael 2020-08-28 22:19:18 +02:00
parent 22cff630ee
commit 3493f0bcc3
4 changed files with 9 additions and 12 deletions

6
.gitignore vendored
View file

@ -2,8 +2,4 @@ fontello-7bf7a0b6/
css/ css/
font/ font/
images/ images/
plain.json save/
reznor88banish.json
reznor112grimm.json
reznor100.json
reznor0.json

View file

@ -239,6 +239,8 @@ function HKCheckCompletion(jsonObject) {
fillHTML(DIV_ID.intro, "Hollow Knight Completion: ", " %"); fillHTML(DIV_ID.intro, "Hollow Knight Completion: ", " %");
} }
// ---------------- Time Played ----------------- //
if (i === "playTime") { if (i === "playTime") {
let seconds = Math.floor(HKPlayerData.playTime); let seconds = Math.floor(HKPlayerData.playTime);
let minutes = Math.floor((seconds / 60) % 60); let minutes = Math.floor((seconds / 60) % 60);
@ -247,7 +249,7 @@ function HKCheckCompletion(jsonObject) {
if (sec <= 10) sec = "0" + sec; if (sec <= 10) sec = "0" + sec;
if (minutes <= 10) minutes = "0" + minutes; if (minutes <= 10) minutes = "0" + minutes;
currentDataTrue(); currentDataTrue();
fillHTML(DIV_ID.intro, "Time Played: " + hours + "h " + minutes + "min " + sec + "sec"); fillHTML(DIV_ID.intro, "Time Played: " + hours + " h " + minutes + " min " + sec + " sec");
} }
// ---------------- Bosses (Base Game) --------------------- // // ---------------- Bosses (Base Game) --------------------- //
@ -395,7 +397,7 @@ function HKReadTextArea() {
let textAreaId = "save-area"; let textAreaId = "save-area";
let contents = document.getElementById(textAreaId).value; let contents = document.getElementById(textAreaId).value;
if(contents.length) { if (contents.length) {
let jsonObject = JSON.parse(contents); let jsonObject = JSON.parse(contents);
HKCheckCompletion(jsonObject); HKCheckCompletion(jsonObject);
// console.log(jsonObject); // console.log(jsonObject);

View file

View file

@ -1,24 +1,23 @@
var jsonObj = ""; var jsonObj = "";
var fileName = ["save/reznor88banish.json", "save/reznor112grimm.json", "save/reznor100.json", "save/reznor0.json"];
/** /**
* Reads the .json file and parses it to a JS object (jsonObj). * Reads the .json file and parses it to a JS object (jsonObj).
* @param callback Asynchronous function. * @param callback Asynchronous function.
*/ */
function loadJSON(callback) { function loadJSON(filename, callback) {
// new Http request object (asynchronous), both the web page and the XML file it tries to load, must be located on the same server. // new Http request object (asynchronous), both the web page and the XML file it tries to load, must be located on the same server.
var xobj = new XMLHttpRequest(); var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json"); xobj.overrideMimeType("application/json");
let fileName = ["reznor88banish.json", "reznor112grimm.json", "reznor100.json", "reznor0.json"];
// Specifies the request // Specifies the request
/* method: the request type GET or POST /* method: the request type GET or POST
url: the file location url: the file location
async: true (asynchronous) or false (synchronous) async: true (asynchronous) or false (synchronous)
user: optional user name user: optional user name
psw: optional password */ psw: optional password */
xobj.open('GET', fileName[1], true); // Path to the file xobj.open('GET', filename, true); // Path to the file
// Defines a function to be called when the readyState property changes // Defines a function to be called when the readyState property changes
xobj.onreadystatechange = function GetResponseText() { xobj.onreadystatechange = function GetResponseText() {
@ -32,7 +31,7 @@ function loadJSON(callback) {
xobj.send(null); xobj.send(null);
} }
loadJSON( loadJSON(fileName[3],
function JSONparse(response) { function JSONparse(response) {
// Parse JSON string into object // Parse JSON string into object
jsonObj = JSON.parse(response); jsonObj = JSON.parse(response);