From e06cd4103f6190b855b223dee576eb42b84720f4 Mon Sep 17 00:00:00 2001 From: b Date: Mon, 18 Jan 2021 19:57:26 -0600 Subject: [PATCH] Sticky spell damage --- display.js | 33 +++++++++++++++++---------------- index.html | 36 +++++++++++++++++++----------------- styles.css | 3 +++ wide.css | 4 ++++ 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/display.js b/display.js index f411080..b664e54 100644 --- a/display.js +++ b/display.js @@ -914,7 +914,7 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){ overallaverageDamage.appendChild(overallaverageDamageSecond); overallparent_elem.append(overallaverageDamage); - overallparent_elem.append(document.createElement("br")); + //overallparent_elem.append(document.createElement("br")); //attack speed let atkSpd = document.createElement("p"); @@ -936,7 +936,7 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){ overallatkSpd.appendChild(overallatkSpdFirst); overallatkSpd.appendChild(overallatkSpdSecond); overallparent_elem.append(overallatkSpd); - overallparent_elem.append(document.createElement("br")); + //overallparent_elem.append(document.createElement("br")); //Non-Crit: n->elem, total dmg, DPS let nonCritStats = document.createElement("p"); @@ -1374,24 +1374,20 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell let save_damages = []; + let part_divavg = document.createElement("p"); + part_divavg.classList.add("nomargin"); + overallparent_elem.append(part_divavg); + for (const part of spell.parts) { parent_elem.append(document.createElement("br")); let part_div = document.createElement("p"); parent_elem.append(part_div); - let part_divavg = document.createElement("p"); - //part_divavg.classList.add("Normal"); - overallparent_elem.append(part_divavg); - let subtitle_elem = document.createElement("p"); subtitle_elem.textContent = part.subtitle; + subtitle_elem.classList.add("nomargin"); part_div.append(subtitle_elem); - if (part.summary == true) { - let subtitle_elemavg = document.createElement("p"); - subtitle_elemavg.textContent = part.subtitle; - part_divavg.append(subtitle_elemavg); - } if (part.type === "damage") { //console.log(build.expandedStats); let _results = calculateSpellDamage(stats, part.conversion, @@ -1418,12 +1414,12 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell let overallaverageLabel = document.createElement("p"); let first = document.createElement("b"); let second = document.createElement("b"); - first.textContent = "Average: "; + first.textContent = part.subtitle + " Average: "; second.textContent = averageDamage.toFixed(2); overallaverageLabel.appendChild(first); overallaverageLabel.appendChild(second); second.classList.add("Damage"); - overallaverageLabel.classList.add("damageSubtitle"); + overallaverageLabel.classList.add("overallp"); part_divavg.append(overallaverageLabel); } @@ -1466,9 +1462,14 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell part_div.append(healLabel); if (part.summary == true) { let overallhealLabel = document.createElement("p"); - overallhealLabel.textContent = heal_amount; - overallhealLabel.classList.add("damagep"); - overallhealLabel.classList.add("Set"); + let first = document.createElement("b"); + let second = document.createElement("b"); + first.textContent = part.subtitle + ":"; + second.textContent = heal_amount; + overallhealLabel.appendChild(first); + second.classList.add("Set"); + overallhealLabel.appendChild(second); + overallhealLabel.classList.add("overallp"); part_divavg.append(overallhealLabel); } } diff --git a/index.html b/index.html index 623258e..ee7eb33 100644 --- a/index.html +++ b/index.html @@ -418,23 +418,25 @@ diff --git a/styles.css b/styles.css index 16e8934..28dc9a7 100644 --- a/styles.css +++ b/styles.css @@ -14,6 +14,7 @@ th, td { .nomargin { padding: 0px; + margin: 0px; } div { @@ -72,6 +73,8 @@ a.link{ .smalltitle{ text-align: center; font-size: 125%; + margin-top: 10px; + margin-bottom: 4px; } .center { text-align: center; diff --git a/wide.css b/wide.css index baeaf2f..84dcd62 100644 --- a/wide.css +++ b/wide.css @@ -4,6 +4,10 @@ .spell-info-container { grid-column:4; } +.sticky-box { + position: sticky; + top: 0; +} .summary { padding: 2% 4% 4%; display: grid;