This commit is contained in:
4DBug
2026-08-26 18:28:49 -05:00
parent 9e93df5961
commit 145851a32e
15 changed files with 1215 additions and 272 deletions
+2 -40
View File
@@ -1,49 +1,11 @@
/*
APP — shared chrome for every page: settings dialog, footer API label,
toast notifications.
APP — shared chrome for every page: footer API label, toast notifications.
(Settings moved to its own page: settings.html)
*/
(function () {
'use strict';
function initChrome() {
const modal = document.getElementById('settingsModal');
const openBtn = document.getElementById('settingsBtn');
const input = document.getElementById('apiBaseInput');
if (openBtn && modal && input) {
const close = () => {
modal.hidden = true;
};
openBtn.addEventListener('click', () => {
input.value = SR.config.getBase();
modal.hidden = false;
input.focus();
input.select();
});
const closeBtn = document.getElementById('settingsClose');
if (closeBtn) closeBtn.addEventListener('click', close);
modal.addEventListener('click', (e) => {
if (e.target === modal) close();
});
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && !modal.hidden) close();
});
const saveBtn = document.getElementById('apiBaseSave');
if (saveBtn) {
saveBtn.addEventListener('click', () => {
SR.config.setBase(input.value);
location.reload();
});
}
const resetBtn = document.getElementById('apiBaseReset');
if (resetBtn) {
resetBtn.addEventListener('click', () => {
SR.config.clearBase();
location.reload();
});
}
}
const label = document.getElementById('apiBaseLabel');
if (label) {
const base = SR.config.getBase();