Show Sum and Possible on dice rolls

Dice output now always shows "Sum: X of Possible: Y" where Y is
sides * count, on both the main page and standalone /tools page.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leopere 2026-02-08 16:56:21 -05:00
parent cde28f7069
commit 8f06c6c381
Signed by: colin
SSH Key Fingerprint: SHA256:nRPCQTeMFLdGytxRQmPVK9VXY3/ePKQ5lGRyJhT5DY8
2 changed files with 2 additions and 2 deletions

View File

@ -698,7 +698,7 @@
const r = await fetch(origin + '/dice?d=' + d + '&count=' + c); const r = await fetch(origin + '/dice?d=' + d + '&count=' + c);
if (!r.ok) throw new Error(await r.text()); if (!r.ok) throw new Error(await r.text());
const j = await r.json(); const j = await r.json();
toolsOutput.textContent = 'Rolls: ' + j.rolls.join(', ') + (j.count > 1 ? ' Sum: ' + j.sum : ''); toolsOutput.textContent = 'Rolls: ' + j.rolls.join(', ') + ' Sum: ' + j.sum + ' of Possible: ' + (j.sides * j.count);
} catch (e) { toolsOutput.className = 'output error'; toolsOutput.textContent = 'Error: ' + e.message; } } catch (e) { toolsOutput.className = 'output error'; toolsOutput.textContent = 'Error: ' + e.message; }
setToolsLoading(false); setToolsLoading(false);
}); });

View File

@ -283,7 +283,7 @@
if (!r.ok) throw new Error(await r.text()); if (!r.ok) throw new Error(await r.text());
const j = await r.json(); const j = await r.json();
outDice.className = 'output copyable'; outDice.className = 'output copyable';
outDice.textContent = 'Rolls: ' + j.rolls.join(', ') + (j.count > 1 ? ' Sum: ' + j.sum : ''); outDice.textContent = 'Rolls: ' + j.rolls.join(', ') + ' Sum: ' + j.sum + ' of Possible: ' + (j.sides * j.count);
} catch (e) { outDice.className = 'output copyable error'; outDice.textContent = 'Error: ' + e.message; } } catch (e) { outDice.className = 'output copyable error'; outDice.textContent = 'Error: ' + e.message; }
disableAll(false); disableAll(false);
}); });