ZDDC/mdedit/js/main.js
ZDDC ea385b5366 Initial commit
ZDDC — Zero Day Document Control. A file-naming convention plus five
single-file HTML tools (archive, transmittal, classifier, mdedit,
landing) and an optional Go HTTP server (zddc-server) with ACL and a
virtual archive index. Self-contained, offline-capable, dependency-free.

See README.md for an overview, AGENTS.md and ARCHITECTURE.md for the
build/release/architecture detail, bootstrap/README.md for the
two-level deployment install pattern, and zddc/README.md for the
HTTP server.
2026-04-27 11:05:47 -05:00

40 lines
1.3 KiB
JavaScript

/**
* Application initialization
*/
// Initialize when DOM is loaded
document.addEventListener('DOMContentLoaded', function () {
// Check File System API availability and update UI
initializeApiAvailability();
setupEventListeners();
initializeFileNavResizer();
setupTocDepthSelector();
startFileChangeMonitoring();
// Show scratchpad in file tree on startup
renderFileTree();
});
/**
* Initialize UI based on File System API availability
*/
function initializeApiAvailability() {
const selectDirectoryBtn = document.getElementById('select-directory');
const welcomeHint = document.getElementById('welcome-hint');
const welcomeFirefox = document.getElementById('welcome-firefox');
if (!hasFileSystemAccess) {
// Disable file system buttons in Firefox and other unsupported browsers
if (selectDirectoryBtn) {
selectDirectoryBtn.disabled = true;
selectDirectoryBtn.title = 'File System API not supported in this browser';
}
// Show Firefox warning, hide normal hint
if (welcomeHint) welcomeHint.classList.add('hidden');
if (welcomeFirefox) welcomeFirefox.classList.remove('hidden');
}
}