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:
parent
cde28f7069
commit
8f06c6c381
|
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue