add cleanHTML()
This commit is contained in:
parent
80a4f10e70
commit
e5fc0fa864
2 changed files with 16 additions and 14 deletions
|
|
@ -203,9 +203,7 @@ function HKCheckCompletion(jsonObject) {
|
||||||
let countBegin = new Date();
|
let countBegin = new Date();
|
||||||
|
|
||||||
// Pre-Cleaning all divs for safety
|
// Pre-Cleaning all divs for safety
|
||||||
for (i in DIV_ID) {
|
cleanHTML(DIV_ID);
|
||||||
document.getElementById(DIV_ID[i]).innerHTML = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shallow Clone const objects (used for destructive functions)
|
// Shallow Clone const objects (used for destructive functions)
|
||||||
let HK_BOSSES_temp = Object.assign({}, HK_BOSSES);
|
let HK_BOSSES_temp = Object.assign({}, HK_BOSSES);
|
||||||
|
|
@ -328,6 +326,12 @@ function HKCheckCompletion(jsonObject) {
|
||||||
console.info("HKCheckCompletion() time (ms) =", countEnd - countBegin);
|
console.info("HKCheckCompletion() time (ms) =", countEnd - countBegin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanHTML(jsObj) {
|
||||||
|
for (i in jsObj) {
|
||||||
|
document.getElementById(jsObj[i]).innerHTML = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function fillHTML(divId = "", textPrefix = "Unknown Completion Element: ", textSuffix = "") {
|
function fillHTML(divId = "", textPrefix = "Unknown Completion Element: ", textSuffix = "") {
|
||||||
document.getElementById(divId).innerHTML += divStart + completionSymbol + strongStart + textPrefix + "" + strongEnd + currentData + textSuffix + divEnd;
|
document.getElementById(divId).innerHTML += divStart + completionSymbol + strongStart + textPrefix + "" + strongEnd + currentData + textSuffix + divEnd;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
loadJson.js
20
loadJson.js
|
|
@ -1,10 +1,11 @@
|
||||||
var jsonObj;
|
var jsonObj = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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(callback) {
|
||||||
|
jsonObj = "";
|
||||||
// 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();
|
||||||
|
|
||||||
|
|
@ -41,19 +42,16 @@ loadJSON(
|
||||||
);
|
);
|
||||||
|
|
||||||
function HKReadTextArea() {
|
function HKReadTextArea() {
|
||||||
|
jsonObj = "";
|
||||||
|
|
||||||
|
cleanHTML(DIV_ID);
|
||||||
|
|
||||||
let textAreaId = "save-area";
|
let textAreaId = "save-area";
|
||||||
let contents = document.getElementById(textAreaId).value;
|
let contents = document.getElementById(textAreaId).value;
|
||||||
|
|
||||||
if(contents.length > 0) {
|
if(contents.length > 0) {
|
||||||
jsonObj = contents;
|
jsonObj = JSON.parse(contents);
|
||||||
|
HKCheckCompletion(jsonObj);
|
||||||
loadJSON(
|
// console.log(jsonObj);
|
||||||
function JSONparse(response) {
|
|
||||||
// Parse JSON string into object
|
|
||||||
jsonObj = JSON.parse(response);
|
|
||||||
HKCheckCompletion(jsonObj);
|
|
||||||
// console.log(jsonObj);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue