reorganize code
This commit is contained in:
parent
03df9ae9f9
commit
c975e5c660
4 changed files with 252 additions and 237 deletions
|
|
@ -17,6 +17,11 @@ import {
|
|||
} from "./page-functions.js";
|
||||
|
||||
import {
|
||||
SetIconGreen,
|
||||
SetIconPartial,
|
||||
SetIconPartialJournal,
|
||||
SetIconRed,
|
||||
SetIconNone,
|
||||
ObjectLength,
|
||||
TranslateMapName
|
||||
} from "./hk-functions.js";
|
||||
|
|
@ -292,70 +297,6 @@ function PrepareHTMLString(section, textPrefix = "Unknown Completion Element: ",
|
|||
`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to a "completed" symbol. Adds +1 or +2 to percent property.
|
||||
*/
|
||||
function SetIconGreen(section = {}, entry = "") {
|
||||
|
||||
/* Increase section percentage except the Game Status and Hints sections */
|
||||
switch (section.id) {
|
||||
|
||||
case "hk-intro":
|
||||
case "hk-hints":
|
||||
break;
|
||||
|
||||
case "hk-equipment":
|
||||
|
||||
// double % for equipment
|
||||
section.percent += 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
section.percent++;
|
||||
}
|
||||
|
||||
section.entries[entry].icon = "green";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to a "partially completed" symbol (prevents blurring the textPrefix).
|
||||
*/
|
||||
function SetIconPartial(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "partial";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to a "partially completed" symbol (prevents blurring whole entry).
|
||||
*/
|
||||
function SetIconPartialJournal(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "partialJournal";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to a "not completed" symbol
|
||||
*/
|
||||
function SetIconRed(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "red";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to an "information" symbol
|
||||
*/
|
||||
/* function CurrentDataInfo() {
|
||||
completionSymbol = SYMBOL_INFO;
|
||||
} */
|
||||
|
||||
/**
|
||||
* Switches global variable to no symbol (span with left padding)
|
||||
*/
|
||||
function SetIconNone(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills HTML with the playTime value of the save file
|
||||
* @param {object} section ID of the HTML element for data appending
|
||||
|
|
|
|||
|
|
@ -4,6 +4,70 @@ import MAP from "./hk-dictionary.js";
|
|||
|
||||
/* -------------------------- Functions ----------------------------- */
|
||||
|
||||
/**
|
||||
* Switches global variable to a "completed" symbol. Adds +1 or +2 to percent property.
|
||||
*/
|
||||
function SetIconGreen(section = {}, entry = "") {
|
||||
|
||||
/* Increase section percentage except the Game Status and Hints sections */
|
||||
switch (section.id) {
|
||||
|
||||
case "hk-intro":
|
||||
case "hk-hints":
|
||||
break;
|
||||
|
||||
case "hk-equipment":
|
||||
|
||||
// double % for equipment
|
||||
section.percent += 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
section.percent++;
|
||||
}
|
||||
|
||||
section.entries[entry].icon = "green";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to a "partially completed" symbol (prevents blurring the textPrefix).
|
||||
*/
|
||||
function SetIconPartial(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "partial";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to a "partially completed" symbol (prevents blurring whole entry).
|
||||
*/
|
||||
function SetIconPartialJournal(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "partialJournal";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to a "not completed" symbol
|
||||
*/
|
||||
function SetIconRed(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "red";
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches global variable to an "information" symbol
|
||||
*/
|
||||
/* function CurrentDataInfo() {
|
||||
completionSymbol = SYMBOL_INFO;
|
||||
} */
|
||||
|
||||
/**
|
||||
* Switches global variable to no symbol (span with left padding)
|
||||
*/
|
||||
function SetIconNone(section = {}, entry = "") {
|
||||
|
||||
section.entries[entry].icon = "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the length of a JavaScript Object like Array.length
|
||||
* @param {object} object JavaScript Object
|
||||
|
|
@ -35,6 +99,11 @@ function TranslateMapName(mapCode, dictionary = MAP) {
|
|||
/* ------------------------- Exports ------------------------------- */
|
||||
|
||||
export {
|
||||
SetIconGreen,
|
||||
SetIconPartial,
|
||||
SetIconPartialJournal,
|
||||
SetIconRed,
|
||||
SetIconNone,
|
||||
ObjectLength,
|
||||
TranslateMapName
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue