Correct missing funcs

This commit is contained in:
2025-12-19 08:40:06 -05:00
parent ac29b6e929
commit dc6b551325
2 changed files with 47 additions and 2 deletions

View File

@@ -1129,6 +1129,14 @@
let currentUserId = null;
let currentChangePasswordUserId = null;
// ==================== GENERIC MODAL HELPER ====================
function closeModal(modalId, additionalCleanup = null) {
document.getElementById(modalId).style.display = 'none';
if (additionalCleanup) {
additionalCleanup();
}
}
// Load UI configuration from API
async function loadUIConfig() {
try {
@@ -4769,13 +4777,50 @@
if (lookup) lookup.clear();
}
// Position tooltip near mouse cursor
function positionTooltip(event) {
const tooltip = event.currentTarget.querySelector('.tooltip-text');
if (tooltip) {
const rect = tooltip.getBoundingClientRect();
const tooltipWidth = 300; // matches CSS width
const tooltipHeight = rect.height || 100; // estimate if not yet rendered
let left = event.pageX + 10;
let top = event.pageY + 10;
// Adjust if tooltip would go off screen
if (left + tooltipWidth > window.innerWidth) {
left = event.pageX - tooltipWidth - 10;
}
if (top + tooltipHeight > window.innerHeight) {
top = event.pageY - tooltipHeight - 10;
}
tooltip.style.left = left + 'px';
tooltip.style.top = top + 'px';
tooltip.style.visibility = 'visible';
tooltip.style.opacity = '1';
}
}
// Add hover listeners to all notes tooltips
function setupTooltips() {
document.querySelectorAll('.notes-tooltip').forEach(tooltip => {
tooltip.addEventListener('mouseenter', positionTooltip);
tooltip.addEventListener('mouseleave', hideTooltip);
});
}
// Hide tooltip when mouse leaves
function hideTooltip(event) {
const tooltip = event.currentTarget.querySelector('.tooltip-text');
if (tooltip) {
tooltip.style.visibility = 'hidden';
tooltip.style.opacity = '0';
}
}
// Initialize the page when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
loadUIConfig(); // Load UI configuration first