read JSON file from textarea

This commit is contained in:
ReznoRMichael 2020-08-26 00:40:26 +02:00
parent 10b22b521e
commit 80a4f10e70
2 changed files with 20 additions and 3 deletions

View file

@ -40,7 +40,6 @@
- Single Mask Shards locations - Single Mask Shards locations
- Single Vessel Fragments locations - Single Vessel Fragments locations
- Single Pale Ore locations? - Single Pale Ore locations?
- Read JSON file from text input
--> -->
<div id="content"> <div id="content">
@ -62,7 +61,7 @@
<div style="margin-bottom: 20px;"></div> <div style="margin-bottom: 20px;"></div>
<div> <div>
<button id="startbutton" onclick="HKCheckCompletion( jsonObj );">Run Script</button> <button id="startbutton" onclick="HKCheckCompletion(jsonObj);">Run Script</button>
</div> </div>
<div style="margin-bottom: 20px;"></div> <div style="margin-bottom: 20px;"></div>

View file

@ -38,4 +38,22 @@ loadJSON(
jsonObj = JSON.parse(response); jsonObj = JSON.parse(response);
// console.log(jsonObj); // console.log(jsonObj);
} }
); );
function HKReadTextArea() {
let textAreaId = "save-area";
let contents = document.getElementById(textAreaId).value;
if(contents.length > 0) {
jsonObj = contents;
loadJSON(
function JSONparse(response) {
// Parse JSON string into object
jsonObj = JSON.parse(response);
HKCheckCompletion(jsonObj);
// console.log(jsonObj);
}
);
}
}