code cleaning
This commit is contained in:
parent
8cd375aeef
commit
9c7b84bae9
3 changed files with 40 additions and 34 deletions
68
build/app.js
68
build/app.js
|
|
@ -11550,54 +11550,60 @@ function TogglePageScrollElement(root, element, ratio) {
|
||||||
* @param {number} hkGameCompletion Total completion percentage in a save file
|
* @param {number} hkGameCompletion Total completion percentage in a save file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* function CompletionHTML(jsObj, hkGameCompletion) {
|
||||||
|
|
||||||
function CompletionHTML(jsObj, hkGameCompletion) {
|
let h2 = "";
|
||||||
var h2 = "";
|
let h2id = "";
|
||||||
var h2id = "";
|
let cl = "";
|
||||||
var cl = "";
|
let clGreen = "box-green";
|
||||||
var clGreen = "box-green";
|
let clRed = "box-red";
|
||||||
var clRed = "box-red";
|
let cp = 0; // current Percent
|
||||||
var cp = 0; // current Percent
|
let mp = 0; // max Percent
|
||||||
|
let fillText = "";
|
||||||
|
|
||||||
var mp = 0; // max Percent
|
for (let i in jsObj) {
|
||||||
|
|
||||||
var fillText = "";
|
|
||||||
|
|
||||||
for (var i in jsObj) {
|
|
||||||
h2 = jsObj[i].h2;
|
h2 = jsObj[i].h2;
|
||||||
h2id = "h2-" + jsObj[i].id;
|
h2id = "h2-" + jsObj[i].id;
|
||||||
jsObj[i].hasOwnProperty("percent") ? cp = jsObj[i].percent : cp = 0;
|
|
||||||
if (i === "intro") cp = hkGameCompletion; // Don't use percent-box for Essentials, Achievements, Statistics
|
|
||||||
|
|
||||||
|
(jsObj[i].hasOwnProperty("percent")) ? cp = jsObj[i].percent: cp = 0;
|
||||||
|
if (i === "intro") cp = hkGameCompletion;
|
||||||
|
|
||||||
|
// Don't use percent-box for Essentials, Achievements, Statistics
|
||||||
if (!jsObj[i].hasOwnProperty("maxPercent")) {
|
if (!jsObj[i].hasOwnProperty("maxPercent")) {
|
||||||
fillText = "";
|
fillText = "";
|
||||||
} // otherwise use percent-box with values cp/mp%
|
}
|
||||||
|
// otherwise use percent-box with values cp/mp%
|
||||||
else {
|
else {
|
||||||
|
|
||||||
mp = jsObj[i].maxPercent;
|
mp = jsObj[i].maxPercent;
|
||||||
|
|
||||||
if (i === "maskShards") {
|
if (i === "maskShards") {
|
||||||
var perc = jsObj[i].percent;
|
let perc = jsObj[i].percent;
|
||||||
perc % 4 ? cp = Math.floor(perc / 4) : cp = perc / 4;
|
(perc % 4) ? cp = Math.floor(perc / 4): cp = perc / 4;
|
||||||
} else if (i === "vesselFragments") {
|
} else if (i === "vesselFragments") {
|
||||||
var _perc = jsObj[i].percent;
|
let perc = jsObj[i].percent;
|
||||||
_perc % 3 ? cp = Math.floor(_perc / 3) : cp = _perc / 3;
|
(perc % 3) ? cp = Math.floor(perc / 3): cp = perc / 3;
|
||||||
} // switches the box to red when a section (h2) is 0
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// switches the box to red when a section (h2) is 0
|
||||||
if (cp === 0) {
|
if (cp === 0) {
|
||||||
cl = " ".concat(clRed);
|
cl = ` ${clRed}`;
|
||||||
} // switches the box to green when a section (h2) is completed
|
}
|
||||||
|
// switches the box to green when a section (h2) is completed
|
||||||
else if (cp === mp) {
|
else if (cp === mp) {
|
||||||
cl = " ".concat(clGreen);
|
cl = ` ${clGreen}`;
|
||||||
} // default is blue (partially completed and starting value)
|
}
|
||||||
else cl = ""; // needed for Game Status to show percentage properly (adds a slash for all boxes except the Game Status one)
|
// default is blue (partially completed and starting value)
|
||||||
|
else cl = "";
|
||||||
|
|
||||||
|
// needed for Game Status to show percentage properly (adds a slash for all boxes except the Game Status one)
|
||||||
if (jsObj[i].id != "hk-intro") cp += "/";
|
if (jsObj[i].id != "hk-intro") cp += "/";
|
||||||
fillText = "<div class='percent-box".concat(cl, "'>").concat(i === "intro" ? cp : cp + jsObj[i].maxPercent, "%</div>");
|
|
||||||
|
fillText = `<div class='percent-box${cl}'>${(i === "intro") ? cp: cp + jsObj[i].maxPercent}%</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
/* ################################### Optimized Functions ########################################################################## */
|
/* ################################### Optimized Functions ########################################################################## */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -12172,8 +12178,8 @@ function CompletionFill(section) {
|
||||||
var perc = section.percent;
|
var perc = section.percent;
|
||||||
perc % 4 ? cp = Math.floor(perc / 4) : cp = perc / 4;
|
perc % 4 ? cp = Math.floor(perc / 4) : cp = perc / 4;
|
||||||
} else if (section.id === "hk-vesselfragments") {
|
} else if (section.id === "hk-vesselfragments") {
|
||||||
var _perc2 = section.percent;
|
var _perc = section.percent;
|
||||||
_perc2 % 3 ? cp = Math.floor(_perc2 / 3) : cp = _perc2 / 3;
|
_perc % 3 ? cp = Math.floor(_perc / 3) : cp = _perc / 3;
|
||||||
} // switches the box to red when a section (h2) is 0
|
} // switches the box to red when a section (h2) is 0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -127,7 +127,7 @@ function TogglePageScrollElement(root, element, ratio) {
|
||||||
* @param {object} jsObj Object with HTML data to fill
|
* @param {object} jsObj Object with HTML data to fill
|
||||||
* @param {number} hkGameCompletion Total completion percentage in a save file
|
* @param {number} hkGameCompletion Total completion percentage in a save file
|
||||||
*/
|
*/
|
||||||
function CompletionHTML(jsObj, hkGameCompletion) {
|
/* function CompletionHTML(jsObj, hkGameCompletion) {
|
||||||
|
|
||||||
let h2 = "";
|
let h2 = "";
|
||||||
let h2id = "";
|
let h2id = "";
|
||||||
|
|
@ -179,7 +179,7 @@ function CompletionHTML(jsObj, hkGameCompletion) {
|
||||||
fillText = `<div class='percent-box${cl}'>${(i === "intro") ? cp: cp + jsObj[i].maxPercent}%</div>`;
|
fillText = `<div class='percent-box${cl}'>${(i === "intro") ? cp: cp + jsObj[i].maxPercent}%</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
/* ################################### Optimized Functions ########################################################################## */
|
/* ################################### Optimized Functions ########################################################################## */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue