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>
This commit is contained in:
agomizi1cmandClaude Opus 5.5 committed 2026-10-23 12:31:32 +09:00
1 parent ed3d1e437e
commit 22ee28ba03
9 files changed
+160 -8

No files matched your search

+39 -1
View File
@@ -28,8 +28,46 @@
}
return t;
},
// テーブルで自分の収支を表示するか(設定画面で切り替える。既定は表示)
get showNet() { return lsGet('poker.showNet') !== '0'; },
set showNet(v) { lsSet('poker.showNet', v ? '1' : '0'); },
// テーブル作成画面の開始スタックの初期値(設定画面で変えられ、テーブルを作るたびに前回値で上書きする)
get defaultStack() {
const n = Number(lsGet('poker.defaultStack'));
return Number.isInteger(n) && n >= 10 && n <= 100000000 ? n : 1000;
},
set defaultStack(v) { lsSet('poker.defaultStack', String(v)); },
// 前回テーブルを作ったときの SB/BB と、そのときの開始スタック { stack, sb, bb }
get lastBlinds() {
try {
const b = JSON.parse(lsGet('poker.lastBlinds'));
return b && [b.stack, b.sb, b.bb].every(Number.isInteger) && b.sb >= 1 && b.bb > b.sb && b.bb <= b.stack ? b : null;
} catch {
return null;
}
},
set lastBlinds(v) { lsSet('poker.lastBlinds', JSON.stringify(v)); },
};
// 数値の入力欄: フォーカスしたら全体を選択して、そのまま打ち替えられるようにする
function selectOnFocus(el) {
let skipMouseUp = false;
el.addEventListener('focus', () => {
el.select();
skipMouseUp = true;
// iOS Safari はタップの処理の後で選択が外れるので、もう一度選ぶ
setTimeout(() => {
if (document.activeElement === el) el.select();
}, 0);
});
// クリックで入ったときは、離した位置にカーソルが置かれて選択が外れるのを防ぐ
el.addEventListener('mouseup', (e) => {
if (skipMouseUp) e.preventDefault();
skipMouseUp = false;
});
el.addEventListener('keydown', () => { skipMouseUp = false; });
}
function esc(s) {
return String(s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
}
@@ -233,5 +271,5 @@
FINISHING: 'FINISHING',
};
window.App = { Store, esc, chips, toast, confirm: confirmDialog, api, copyText, connectSocket, safeNext, PHASE_LABELS };
window.App = { Store, esc, chips, toast, selectOnFocus, confirm: confirmDialog, api, copyText, connectSocket, safeNext, PHASE_LABELS };
})();