ErnnyG's picture
App for workflow process in a restaurant. From ordering process to recipe, it’s gonna have everything the restaurant does in one place. It’s gonna have user accounts with levels of access like AD sync user in a network environment. There need to be links to different sections within document for fast transfer of data and efficiency. I’m looking for a bare bones app that can be managed by the user once purchased and maybe a free demo with limited functionality
9076e9b verified
Raw History Blame Contribute Delete
1.56 kB
// Shared JavaScript across all pages
document.addEventListener('DOMContentLoaded', function() {
// Initialize tooltips for all elements with data-tooltip attribute
const tooltipElements = document.querySelectorAll('[data-tooltip]');
tooltipElements.forEach(el => {
const tooltipText = el.getAttribute('data-tooltip');
el.addEventListener('mouseenter', () => {
const tooltip = document.createElement('div');
tooltip.className = 'absolute z-50 bg-gray-800 text-white text-sm px-2 py-1 rounded whitespace-nowrap';
tooltip.textContent = tooltipText;
const rect = el.getBoundingClientRect();
tooltip.style.top = `${rect.top - 30}px`;
tooltip.style.left = `${rect.left + rect.width/2}px`;
tooltip.style.transform = 'translateX(-50%)';
tooltip.id = 'current-tooltip';
document.body.appendChild(tooltip);
});
el.addEventListener('mouseleave', () => {
const tooltip = document.getElementById('current-tooltip');
if (tooltip) {
tooltip.remove();
}
});
});
// Add active class to current page link in navbar
const currentPath = window.location.pathname;
const navLinks = document.querySelectorAll('custom-navbar a');
navLinks.forEach(link => {
if (link.getAttribute('href') === currentPath) {
link.classList.add('font-semibold', 'text-blue-100');
}
});
});