global variables
This commit is contained in:
parent
e854f85962
commit
b7f4e90139
5 changed files with 23 additions and 28 deletions
File diff suppressed because one or more lines are too long
|
|
@ -49,7 +49,7 @@
|
||||||
<div class="buttons centered">
|
<div class="buttons centered">
|
||||||
|
|
||||||
<div class="input-buttons">
|
<div class="input-buttons">
|
||||||
<input id="save-area-file" class="" type="file" name="file" accept=".dat,.bak*" onchange="LoadSaveFile(this)">
|
<input id="save-area-file" class="" type="file" name="file" accept=".dat,.bak*" onchange="LoadSaveFile(this);">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
<div class="buttons centered">
|
<div class="buttons centered">
|
||||||
|
|
||||||
<div class="input-buttons">
|
<div class="input-buttons">
|
||||||
<input id="save-area-file" class="" type="file" name="file" accept=".dat,.bak*" onchange="LoadSaveFile(this)">
|
<input id="save-area-file" class="" type="file" name="file" accept=".dat,.bak*" onchange="LoadSaveFile(this);">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* global bench */
|
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
/* eslint-disable no-prototype-builtins */
|
/* eslint-disable no-prototype-builtins */
|
||||||
|
|
||||||
|
|
@ -35,6 +34,8 @@ let divEnd = [
|
||||||
|
|
||||||
let pSpan = "<span class='p-left-small'></span>";
|
let pSpan = "<span class='p-left-small'></span>";
|
||||||
|
|
||||||
|
let benchHKCCBegin, benchHKCCEnd;
|
||||||
|
|
||||||
// ---------------- Hollow Knight Data Constant Objects ----------------- //
|
// ---------------- Hollow Knight Data Constant Objects ----------------- //
|
||||||
|
|
||||||
const DIV_ID = {
|
const DIV_ID = {
|
||||||
|
|
@ -469,7 +470,7 @@ const HK_STATISTICS = {
|
||||||
function HKCheckCompletion(jsonObject) {
|
function HKCheckCompletion(jsonObject) {
|
||||||
|
|
||||||
// start benchmark
|
// start benchmark
|
||||||
bench.begin.HKCC = new Date();
|
benchHKCCBegin = new Date();
|
||||||
|
|
||||||
let HKPlayerData;
|
let HKPlayerData;
|
||||||
let HKWorldItems;
|
let HKWorldItems;
|
||||||
|
|
@ -659,8 +660,8 @@ function HKCheckCompletion(jsonObject) {
|
||||||
CompletionHTML(DIV_ID);
|
CompletionHTML(DIV_ID);
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
bench.end.HKCC = new Date();
|
benchHKCCEnd = new Date();
|
||||||
console.info("HKCheckCompletion() time (ms) =", bench.end.HKCC - bench.begin.HKCC);
|
console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1200,7 +1201,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
|
||||||
/**
|
/**
|
||||||
* Pre-Cleans HTML. Reads contents inside text area and parses it to a JavaScript object. If not empty, runs HKCheckCompletion() to check data.
|
* Pre-Cleans HTML. Reads contents inside text area and parses it to a JavaScript object. If not empty, runs HKCheckCompletion() to check data.
|
||||||
*/
|
*/
|
||||||
function HKReadTextArea() {
|
window.HKReadTextArea = function HKReadTextArea() {
|
||||||
InitialHTMLPopulate(DIV_ID);
|
InitialHTMLPopulate(DIV_ID);
|
||||||
|
|
||||||
let textAreaId = "save-area";
|
let textAreaId = "save-area";
|
||||||
|
|
@ -1378,4 +1379,6 @@ function ResetCompletion(jsObj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", InitialHTMLPopulate(DIV_ID));
|
document.addEventListener("DOMContentLoaded", InitialHTMLPopulate(DIV_ID));
|
||||||
|
|
||||||
|
// document.getElementById("save-area-read").addEventListener("onclick", HKReadTextArea());
|
||||||
|
|
@ -19,17 +19,7 @@ const ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a ne
|
||||||
|
|
||||||
// ---------------- Variables ----------------- //
|
// ---------------- Variables ----------------- //
|
||||||
|
|
||||||
let bench = {
|
let benchLSFBegin, benchLSFEnd, benchTotal;
|
||||||
begin: {
|
|
||||||
LSF: 0,
|
|
||||||
HKCC: 0,
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
LSF: 0,
|
|
||||||
HKCC: 0,
|
|
||||||
total: 0,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------- Functions ----------------- //
|
// ---------------- Functions ----------------- //
|
||||||
|
|
||||||
|
|
@ -39,14 +29,14 @@ let bench = {
|
||||||
* @param {FileList} input FileList object containing a list of File objects. The FileList behaves like an array, so you can check its length property to get the number of selected files.
|
* @param {FileList} input FileList object containing a list of File objects. The FileList behaves like an array, so you can check its length property to get the number of selected files.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function LoadSaveFile(input, startTime = new Date()) {
|
window.LoadSaveFile = function LoadSaveFile(input, startTime = new Date()) {
|
||||||
|
|
||||||
// console.info("Input length: " + input.files.length)
|
// console.info("Input length: " + input.files.length)
|
||||||
// Cease further processing if user canceled the file input dialog
|
// Cease further processing if user canceled the file input dialog
|
||||||
if (input.files.length < 1) return false;
|
if (input.files.length < 1) return false;
|
||||||
|
|
||||||
// start benchmark
|
// start benchmark
|
||||||
bench.begin.LSF = startTime;
|
benchLSFBegin = startTime;
|
||||||
|
|
||||||
// Prepares a File object from the first file of the input files for reading as an Array Buffer
|
// Prepares a File object from the first file of the input files for reading as an Array Buffer
|
||||||
let inputFileObject = input.files[0];
|
let inputFileObject = input.files[0];
|
||||||
|
|
@ -102,15 +92,15 @@ function ProcessFileObject() {
|
||||||
document.getElementById("save-area").value = decodedString;
|
document.getElementById("save-area").value = decodedString;
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
bench.end.LSF = new Date();
|
benchLSFEnd = new Date();
|
||||||
console.info("LoadSaveFile() time (ms) =", bench.end.LSF - bench.begin.LSF);
|
console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin);
|
||||||
|
|
||||||
// after pasting the decoded string, launch the main analyzing function immediately
|
// after pasting the decoded string, launch the main analyzing function immediately
|
||||||
HKReadTextArea();
|
HKReadTextArea();
|
||||||
|
|
||||||
// finish total and show benchmark
|
// finish total and show benchmark
|
||||||
bench.end.total = new Date();
|
benchTotal = new Date();
|
||||||
console.info("Total time (ms) =", bench.end.total - bench.begin.LSF);
|
console.info("Total time (ms) =", benchTotal - benchLSFBegin);
|
||||||
|
|
||||||
// alert(`Decoded String: ${decodedString}`);
|
// alert(`Decoded String: ${decodedString}`);
|
||||||
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
||||||
|
|
@ -191,4 +181,6 @@ function Base64Decode(buffer) {
|
||||||
function AESDecryption(buffer, cipherObject = ECB_STREAM_CIPHER) {
|
function AESDecryption(buffer, cipherObject = ECB_STREAM_CIPHER) {
|
||||||
let output = cipherObject.decrypt(buffer);
|
let output = cipherObject.decrypt(buffer);
|
||||||
return output.subarray(0, -output[output.length - 1]);
|
return output.subarray(0, -output[output.length - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// document.getElementById("save-area-file").addEventListener("onchange", LoadSaveFile(this));
|
||||||
Loading…
Reference in a new issue