Ivaldonetto's picture
quero melhorar minha wiki do projeto do dw pindorama, consegue melhorar isso ? : <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>Home – Wiki do Projeto</title><style>
103f893 verified
// Main script file for common functionality
// Initialize tooltips
document.addEventListener('DOMContentLoaded', function() {
// Initialize any tooltips if needed
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
// Add active class to current page in navbar
const currentPage = window.location.pathname.split('/').pop() || 'index.html';
const navLinks = document.querySelectorAll('nav a');
navLinks.forEach(link => {
const linkPage = link.getAttribute('href').split('/').pop();
if (currentPage === linkPage) {
link.classList.add('active');
}
});
});
// Search functionality
function initSearch() {
const searchInput = document.getElementById('search-input');
const searchResults = document.getElementById('search-results');
if (searchInput && searchResults) {
searchInput.addEventListener('input', function(e) {
const query = e.target.value.toLowerCase();
if (query.length > 2) {
// In a real implementation, you would fetch results here
// For demo, we'll use mock data
searchResults.innerHTML = '<div class="p-4">Search functionality would display results here</div>';
searchResults.classList.remove('hidden');
} else {
searchResults.classList.add('hidden');
}
});
// Close search when clicking outside
document.addEventListener('click', function(e) {
if (!searchInput.contains(e.target) && !searchResults.contains(e.target)) {
searchResults.classList.add('hidden');
}
});
}
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Initialize when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
initSearch();
});