feat: docking log management, sim_time DB-only, modal helpers
- Add docking_log_list and docking_log_delete routes with dedicated page - _append_docking_log: detect existing state interval before creating new entry - _append_undocking_log: find entry by node title+at_time, accept docked_at param - Fix _entry_state_label and _entry_location to return time-correct values - Add api_set_sim_time POST endpoint; remove sim_time from all url_for() calls - _resolve_simulation_time simplified to DB-only (no URL param) - app.js: add openModal/closeModal/toggleTheme helpers - base.html: add 对接日志管理 nav item, remove Today button Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,20 @@ function initSidebar() {
|
||||
}
|
||||
initSidebar();
|
||||
|
||||
// ─── Modal Helpers ───
|
||||
function openModal(id) {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.classList.add('open');
|
||||
}
|
||||
function closeModal(id) {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.classList.remove('open');
|
||||
}
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key !== 'Escape') return;
|
||||
document.querySelectorAll('.modal-bg.open').forEach(el => el.classList.remove('open'));
|
||||
});
|
||||
|
||||
// ─── Global Time Control ───
|
||||
function openTimeModal() {
|
||||
const display = document.getElementById('sim-time-display');
|
||||
@@ -42,6 +56,15 @@ async function shiftTime(days) {
|
||||
async function resetTime() {
|
||||
await setSimTimeAndReload('2060-03-12 09:00');
|
||||
}
|
||||
function toggleTheme() {
|
||||
const root = document.documentElement;
|
||||
const current = root.dataset.theme || 'dark';
|
||||
const next = current === 'dark' ? 'light' : 'dark';
|
||||
root.dataset.theme = next;
|
||||
root.style.colorScheme = next;
|
||||
try { localStorage.setItem('ksp-theme', next); } catch(e) {}
|
||||
}
|
||||
|
||||
async function setSimTimeAndReload(timeStr) {
|
||||
try {
|
||||
await fetch('/api/v1/sim-time', {
|
||||
|
||||
Reference in New Issue
Block a user