window global functions

This commit is contained in:
ReznoRMichael 2021-01-25 04:10:45 +01:00
parent b7f4e90139
commit 4df75b0f45
4 changed files with 15 additions and 20 deletions

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,7 @@ import geoImage from "../img/geo.png";
// ---------------- Constants ----------------- //
const DATA_UNKNOWN = "Data unknown";
// const DATA_UNKNOWN = "Data unknown";
const SYMBOL_FALSE = "<i class='icon-cancel'></i>"; // "❌ "
const SYMBOL_TRUE = "<i class='icon-ok-squared'></i>"; // "✅ "
const SYMBOL_INFO = "<i class='icon-info-circled'></i>"; // " "
@ -17,7 +17,7 @@ const FLEUR_DIVIDE = "<div class='horizontal-line'></div>";
// ---------------- Variables ----------------- //
let currentData = DATA_UNKNOWN;
// let currentData = DATA_UNKNOWN;
let completionSymbol = SYMBOL_FALSE;
let divStart = [
@ -1201,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.
*/
window.HKReadTextArea = function HKReadTextArea() {
function HKReadTextArea() {
InitialHTMLPopulate(DIV_ID);
let textAreaId = "save-area";
@ -1379,6 +1379,11 @@ function ResetCompletion(jsObj) {
}
}
// Populate HTML at load (before img and css)
document.addEventListener("DOMContentLoaded", InitialHTMLPopulate(DIV_ID));
// document.getElementById("save-area-read").addEventListener("onclick", HKReadTextArea());
// Make functions global so they can be used on click and change events (for Webpack)
window.HKReadTextArea = HKReadTextArea;
window.InitialHTMLPopulate = InitialHTMLPopulate;
window.CheckboxLocationsToggle = CheckboxLocationsToggle;
window.CheckboxHintsToggle = CheckboxHintsToggle;

View file

@ -29,7 +29,7 @@ let benchLSFBegin, benchLSFEnd, benchTotal;
* @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
window.LoadSaveFile = function LoadSaveFile(input, startTime = new Date()) {
function LoadSaveFile(input, startTime = new Date()) {
// console.info("Input length: " + input.files.length)
// Cease further processing if user canceled the file input dialog
@ -183,4 +183,4 @@ function AESDecryption(buffer, cipherObject = ECB_STREAM_CIPHER) {
return output.subarray(0, -output[output.length - 1]);
}
// document.getElementById("save-area-file").addEventListener("onchange", LoadSaveFile(this));
window.LoadSaveFile = LoadSaveFile;

View file

@ -3,7 +3,7 @@ require("../css/fontello.css");
require("../css/style.css");
// Instantly load test file (Debugging script)
require("./LoadJson.js");
// require("./LoadJson.js");
// Load Save File for opening files, decoding, decryption
require("./LoadSaveFile.js");
// Main script for analyzing the decoded save file