AppendHTML move

This commit is contained in:
ReznoRMichael 2021-02-17 01:31:11 +01:00
parent 217a041460
commit 1365ab3429
2 changed files with 11 additions and 9 deletions

View file

@ -9,6 +9,7 @@ import HK from "./hk-database.js";
import {
PrefillHTML,
CompletionHTML,
AppendHTML,
CheckboxHintsToggle,
CheckboxSpoilersToggle,
StorageAvailable
@ -268,15 +269,6 @@ function FillHTML(divId, textPrefix = "Unknown Completion Element: ", textSuffix
document.getElementById(divId.id).innerHTML += divStart + icon + b[0] + textPrefix + b[1] + span[0] + pSpan + spoilerSpan[0] + dash + textSuffix + spoilerSpan[1] + span[1] + divEnd;
}
/**
* Adds HTML string to an element with a given ID.
* @param {object} divId object containing div ID of the HTML element to append to
* @param {string} content HTML contents to append
*/
function AppendHTML(divId, content) {
document.getElementById(divId.id).innerHTML += "\n" + content;
}
/**
* Switches global variable to a "completed" symbol. Adds +1 or +2 to percent property.
*/

View file

@ -134,6 +134,15 @@ function CompletionHTML(jsObj, hkGameCompletion) {
}
}
/**
* Adds HTML string to an element with a given ID.
* @param {object} divId object containing div ID of the HTML element to append to
* @param {string} content HTML contents to append
*/
function AppendHTML(divId, content) {
document.getElementById(divId.id).innerHTML += "\n" + content;
}
/**
* Toggles display of "hk-hints". On click with no parameters or on demand when called with a parameter
* @param {string} param "hide", "show" or none (optional)
@ -304,6 +313,7 @@ document.getElementById("checkbox-spoilers").addEventListener("click", CheckboxS
export {
PrefillHTML,
CompletionHTML,
AppendHTML,
CheckboxHintsToggle,
CheckboxSpoilersToggle,
StorageAvailable