|
@@ -441,7 +441,7 @@ function addResults(resultProperties: ResultProperties): void { |
|
|
* Card with status and hide-show all control |
|
|
* Card with status and hide-show all control |
|
|
*/ |
|
|
*/ |
|
|
function resultsControlCard(): string { |
|
|
function resultsControlCard(): string { |
|
|
let resultsControl = `<div id="resultsControl" class="card my-3 mx-2 border border-2 border-info">`; |
|
|
|
|
|
|
|
|
let resultsControl = `<div id="resultsControl" class="card my-2 mx-2 border border-2 border-info">`; |
|
|
resultsControl += `<h2 class="card-title mx-3 my-2">Results</h5>`; |
|
|
resultsControl += `<h2 class="card-title mx-3 my-2">Results</h5>`; |
|
|
|
|
|
|
|
|
resultsControl += `<div class="progress mx-3"> |
|
|
resultsControl += `<div class="progress mx-3"> |
|
@@ -519,17 +519,13 @@ async function getResults():Promise<string>{ |
|
|
|
|
|
|
|
|
// Add tab navigation container (<ul>) -- id: #resultTabs |
|
|
// Add tab navigation container (<ul>) -- id: #resultTabs |
|
|
let navId = "resultTabs"; |
|
|
let navId = "resultTabs"; |
|
|
$("#results").append(`<ul class="nav nav-tabs" id="${navId}" role="tablist"></ul>`); |
|
|
|
|
|
|
|
|
$("#results").append(`<ul class="nav nav-tabs my-3" id="${navId}" role="tablist"></ul>`); |
|
|
|
|
|
|
|
|
// Add tab content container (<div>) -- id: #resultTabContent |
|
|
// Add tab content container (<div>) -- id: #resultTabContent |
|
|
let tabContentId = "resultTabContent" |
|
|
let tabContentId = "resultTabContent" |
|
|
$("#results").append(`<div class="tab-content" id="${tabContentId}">`) |
|
|
$("#results").append(`<div class="tab-content" id="${tabContentId}">`) |
|
|
|
|
|
|
|
|
for (let cutoff = cutoffStart; cutoff <= cutoffMax; cutoff++) { |
|
|
for (let cutoff = cutoffStart; cutoff <= cutoffMax; cutoff++) { |
|
|
let variantControlAdded = false; |
|
|
|
|
|
// Start of cutoff, add navigation anchor for variant |
|
|
|
|
|
$("#results").append(variantNavAnchor(cutoff)); |
|
|
|
|
|
|
|
|
|
|
|
// Add navigation for this variant (<li>) |
|
|
// Add navigation for this variant (<li>) |
|
|
// NB: first one gets 'active', otherwise it doesn't |
|
|
// NB: first one gets 'active', otherwise it doesn't |
|
|
let buttonClass = (cutoff === cutoffStart) ? "nav-link active" : "nav-link"; |
|
|
let buttonClass = (cutoff === cutoffStart) ? "nav-link active" : "nav-link"; |
|
@@ -557,17 +553,10 @@ async function getResults():Promise<string>{ |
|
|
}); |
|
|
}); |
|
|
rollstats.doRolls(); |
|
|
rollstats.doRolls(); |
|
|
addResults(resultProperties); |
|
|
addResults(resultProperties); |
|
|
// Add control for variant if it doesn't exist |
|
|
|
|
|
if (!variantControlAdded) { |
|
|
|
|
|
addVariantControl(controlCardBody, resultProperties); |
|
|
|
|
|
variantControlAdded = true; |
|
|
|
|
|
|
|
|
|
|
|
// also add navigation to that anchor on the control card navigation section |
|
|
|
|
|
controlCardNav.append(` <a class="btn btn-primary" href="#variant-c${String(cutoff)}">Jump to ${resultProperties.diceVariant}</a> `); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Update progress |
|
|
numDone++; |
|
|
numDone++; |
|
|
let progress = ((numDone) / ( maxDice * cutoffMax ) * 100).toFixed(2); |
|
|
|
|
|
|
|
|
let progress = ((numDone) / ( (maxDice+2) * (cutoffMax-cutoffStart) ) * 100).toFixed(2); |
|
|
$("#resultsProgress").width(`${progress}%`); |
|
|
$("#resultsProgress").width(`${progress}%`); |
|
|
$("#resultsProgress").text(`${progress}%`); |
|
|
$("#resultsProgress").text(`${progress}%`); |
|
|
await(sleep(50)); |
|
|
await(sleep(50)); |
|
@@ -576,6 +565,11 @@ async function getResults():Promise<string>{ |
|
|
console.log("Results done!"); |
|
|
console.log("Results done!"); |
|
|
$("#resultsProgress").width("100%"); |
|
|
$("#resultsProgress").width("100%"); |
|
|
$("#resultsProgress").text("100%"); |
|
|
$("#resultsProgress").text("100%"); |
|
|
|
|
|
|
|
|
|
|
|
await(sleep(3000)) |
|
|
|
|
|
$("#resultsControl").hide(500); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return "Done"; |
|
|
return "Done"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|