Files
Poker/public/assets/settings.js
T
agomizi1cmandClaude Opus 5.5 22ee28ba03 Add a settings page for profit display and default stack
- Per-device toggle to hide your own net and the net ranking at tables
- Default starting stack set in settings; creating a table saves the
  stack, SB and BB used as the next defaults
- Number fields on create and settings select all on focus

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:31:32 +09:00

35 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 設定: この端末だけに保存する(localStorage)
(function () {
'use strict';
const { Store, selectOnFocus } = App;
const $ = (id) => document.getElementById(id);
Fluid.navBar($('nav'), $('large-title'));
const showNet = $('show-net');
showNet.checked = Store.showNet;
showNet.addEventListener('change', () => {
Store.showNet = showNet.checked;
Fluid.haptic(6);
});
const stack = $('default-stack');
stack.value = Store.defaultStack;
selectOnFocus(stack);
// 正しい値のときだけ保存する。外したときに不正なら保存済みの値に戻す
stack.addEventListener('input', () => {
const n = Number(stack.value);
const ok = Number.isInteger(n) && n >= 10 && n <= 100000000;
stack.classList.toggle('invalid', stack.value !== '' && !ok);
if (ok) Store.defaultStack = n;
});
stack.addEventListener('blur', () => {
stack.classList.remove('invalid');
stack.value = Store.defaultStack;
});
stack.addEventListener('keydown', (e) => {
if (e.key === 'Enter') stack.blur();
});
})();