Skip to content

Commit 2e67463

Browse files
Swap influence and rank outputs (#75)
- swap the influence and rank sections in the result display so influence appears before rank - use native title tooltips for formulas ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_693cb19b27f08325bfa18b75e5cedb31)
1 parent 6c7c7ec commit 2e67463

1 file changed

Lines changed: 56 additions & 5 deletions

File tree

erepublik-air-damage-calculator.html

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,34 @@
5555
letter-spacing: 0.01em;
5656
}
5757

58+
.result-with-tooltip {
59+
display: inline-flex;
60+
align-items: center;
61+
gap: 0.4rem;
62+
width: fit-content;
63+
}
64+
65+
.tooltip-target {
66+
cursor: help;
67+
text-decoration: underline;
68+
text-decoration-style: dotted;
69+
text-underline-offset: 0.12em;
70+
}
71+
72+
.tooltip-icon {
73+
inline-size: 1.5rem;
74+
block-size: 1.5rem;
75+
display: grid;
76+
place-items: center;
77+
font-size: 0.85rem;
78+
font-weight: 700;
79+
border-radius: 999px;
80+
border: 1px solid var(--tx-3);
81+
background: var(--ui);
82+
color: var(--foreground);
83+
box-shadow: 0 2px 6px hsl(0 0% 0% / 0.08);
84+
}
85+
5886
form {
5987
display: grid;
6088
gap: var(--gap);
@@ -133,14 +161,23 @@ <h1>eRepublik Air Damage Calculator</h1>
133161
<section class="surface tool-card" aria-live="polite">
134162
<div class="result-display">
135163
<p class="helper-text">Final damage</p>
136-
<div class="result-value" id="final-damage">0</div>
164+
<div class="result-with-tooltip" id="final-damage-wrapper">
165+
<div class="result-value tooltip-target" id="final-damage" tabindex="0">0</div>
166+
<span class="tooltip-icon" aria-hidden="true">?</span>
167+
</div>
137168
<p class="helper-text" id="breakdown"></p>
138-
<p class="helper-text">Rank</p>
139-
<div class="result-value" id="rank-value">0</div>
140-
<p class="helper-text" id="rank-breakdown"></p>
141169
<p class="helper-text">Influence</p>
142-
<div class="result-value" id="influence">0</div>
170+
<div class="result-with-tooltip" id="influence-wrapper">
171+
<div class="result-value tooltip-target" id="influence" tabindex="0">0</div>
172+
<span class="tooltip-icon" aria-hidden="true">?</span>
173+
</div>
143174
<p class="helper-text" id="influence-breakdown"></p>
175+
<p class="helper-text">Rank</p>
176+
<div class="result-with-tooltip" id="rank-wrapper">
177+
<div class="result-value tooltip-target" id="rank-value" tabindex="0">0</div>
178+
<span class="tooltip-icon" aria-hidden="true">?</span>
179+
</div>
180+
<p class="helper-text" id="rank-breakdown"></p>
144181
</div>
145182
</section>
146183

@@ -367,10 +404,13 @@ <h1>eRepublik Air Damage Calculator</h1>
367404
const determinationInput = document.getElementById('determination');
368405
const naturalEnemyCheckbox = document.getElementById('natural-enemy');
369406
const level100Checkbox = document.getElementById('level-100');
407+
const finalDamageWrapper = document.getElementById('final-damage-wrapper');
370408
const finalDamage = document.getElementById('final-damage');
371409
const breakdown = document.getElementById('breakdown');
410+
const rankWrapper = document.getElementById('rank-wrapper');
372411
const rankValueElement = document.getElementById('rank-value');
373412
const rankBreakdown = document.getElementById('rank-breakdown');
413+
const influenceWrapper = document.getElementById('influence-wrapper');
374414
const influenceValue = document.getElementById('influence');
375415
const influenceBreakdown = document.getElementById('influence-breakdown');
376416
const ebInput = document.getElementById('ebs');
@@ -380,6 +420,17 @@ <h1>eRepublik Air Damage Calculator</h1>
380420
const consumablesStatus = document.getElementById('consumables-status');
381421
const consumablesStatusText = document.getElementById('consumables-status-text');
382422

423+
const damageFormulaText = 'Final damage = floor((energy / 10) × base damage × rank multiplier × weapon multiplier × protector multiplier × booster multiplier × natural enemy bonus × level 100 bonus)';
424+
const rankFormulaText = 'Rank points = floor((final damage × 0.1) × rank booster multiplier)';
425+
const influenceFormulaText = 'Influence = floor(final damage × influence booster multiplier × determination bonus × rank influence multiplier)';
426+
427+
finalDamageWrapper.title = damageFormulaText;
428+
finalDamage.setAttribute('aria-label', damageFormulaText);
429+
rankWrapper.title = rankFormulaText;
430+
rankValueElement.setAttribute('aria-label', rankFormulaText);
431+
influenceWrapper.title = influenceFormulaText;
432+
influenceValue.setAttribute('aria-label', influenceFormulaText);
433+
383434
const weaponMultipliers = {
384435
none: 1,
385436
q1: 1.2,

0 commit comments

Comments
 (0)