Guard lt.* calls when base.js unavailable to prevent crash

Wraps all lt.keys.initDefaults() calls in `if (window.lt)` guards across
6 view files. Adds `if (!window.lt) return` bail-out in keyboard-shortcuts.js
and `if (window.lt)` guard in settings.js DOMContentLoaded handler.

This prevents TypeError crashes when /web_template/base.js returns 404,
which was causing the admin menu click delegation to never register.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 23:34:59 -04:00
parent 92544d60ce
commit 8bb43c14db
8 changed files with 11 additions and 7 deletions

View File

@@ -78,6 +78,8 @@ function showKeyboardHelp() {
}
document.addEventListener('DOMContentLoaded', function() {
if (!window.lt) return;
// Ctrl+E: Toggle edit mode (ticket pages)
lt.keys.on('ctrl+e', function() {
const editButton = document.getElementById('editButton');

View File

@@ -131,4 +131,6 @@ document.addEventListener('keydown', (e) => {
});
// Initialize on page load
document.addEventListener('DOMContentLoaded', loadUserPreferences);
document.addEventListener('DOMContentLoaded', function() {
if (window.lt) loadUserPreferences();
});