From 71b943151f7d4f40b64ee9d60420dc800473b993 Mon Sep 17 00:00:00 2001 From: ReznoRMichael Date: Mon, 21 Jun 2021 15:41:07 +0200 Subject: [PATCH] organize code --- src/js/page-functions.js | 65 +++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/src/js/page-functions.js b/src/js/page-functions.js index 1906215..500431f 100644 --- a/src/js/page-functions.js +++ b/src/js/page-functions.js @@ -134,6 +134,41 @@ function CompletionHTML(jsObj, hkGameCompletion) { } } + +/* ################################### Optimized Functions ###################################### */ + + +function GenerateInnerHTML(hkdb) { + + console.log(hkdb); + + let finalHTMLFill = ""; + let textFill = ""; + let sections = hkdb.DIV_ID; + + for (let section in sections) { + + /* creates a h2 tag for the current section and fills with current%/max% */ + textFill = CompletionFill(sections[section]); + + switch (section) { + + case "intro": + + + + break; + default: + } + + finalHTMLFill += textFill; + + } + + console.log(finalHTMLFill); + +} + /** * Replaces the h2 titles with a current percent/max percent values as read from the save file * @param {object} jsObj Object with HTML data to fill @@ -190,36 +225,6 @@ function CompletionHTML(jsObj, hkGameCompletion) { } -function GenerateInnerHTML(hkdb) { - - console.log(hkdb); - - let finalHTMLFill = ""; - let textFill = ""; - let sections = hkdb.DIV_ID; - - for (let section in sections) { - - textFill = CompletionFill(sections[section]); - - switch (section) { - - case "intro": - - - - break; - default: - } - - finalHTMLFill += textFill; - - } - - console.log(finalHTMLFill); - -} - /** * Adds HTML string to an element with a given ID. * @param {object} divId object containing div ID of the HTML element to append to