Add massive collection of CSS, JavaScript and theme assets that were previously excluded: **CSS Files (681 total):** - HVAC plugin-specific styles (hvac-*.css): 34 files including dashboard, certificates, registration, mobile nav, accessibility fixes, animations, and welcome popup - Theme framework files (Astra, builder systems, layouts): 200+ files - Plugin compatibility styles (WooCommerce, WPForms, Elementor, Contact Form 7): 150+ files - WordPress core and editor styles: 50+ files - Responsive and RTL language support: 200+ files **JavaScript Files (400+ total):** - HVAC plugin functionality (hvac-*.js): 27 files including menu systems, dashboard enhancements, profile sharing, mobile responsive features, accessibility, and animations - Framework and library files: jQuery plugins, GSAP, AOS, Swiper, Chart.js, Lottie, Isotope - Plugin compatibility scripts: WPForms, WooCommerce, Elementor, Contact Form 7, LifterLMS - WordPress core functionality: customizer, admin, block editor compatibility - Third-party integrations: Stripe, SMTP, analytics, search functionality **Assets:** - Certificate background images and logos - Comprehensive theme styling infrastructure - Mobile-responsive design systems - Cross-browser compatibility assets - Performance-optimized minified versions **Updated .gitignore:** - Fixed asset directory whitelisting patterns to properly include CSS/JS/images - Added proper directory structure recognition (!/assets/css/, !/assets/js/, etc.) - Maintains security by excluding sensitive files while including essential assets This commit provides the complete frontend infrastructure needed for: - Full theme functionality and styling - Plugin feature implementations - Mobile responsiveness and accessibility - Cross-browser compatibility - Performance optimization - Developer workflow support
139 lines
No EOL
5.9 KiB
JavaScript
139 lines
No EOL
5.9 KiB
JavaScript
/**
|
|
* HVAC Community Events Mobile Navigation
|
|
*
|
|
* This script handles the mobile navigation functionality including:
|
|
* - Creating mobile menu from existing navigation elements
|
|
* - Toggle functionality for mobile menu
|
|
* - Highlighting active menu items
|
|
* - Handling page-specific navigation setups
|
|
*/
|
|
|
|
(function() {
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Mobile navigation setup
|
|
function setupMobileNavigation() {
|
|
// Target pages that need mobile navigation
|
|
const dashboardPage = document.querySelector('.hvac-dashboard');
|
|
const eventSummaryPage = document.querySelector('.hvac-event-summary-wrapper');
|
|
const emailAttendeesPage = document.querySelector('.hvac-email-attendees-wrapper');
|
|
|
|
// Only run on pages with these elements
|
|
if (!dashboardPage && !eventSummaryPage && !emailAttendeesPage) {
|
|
return;
|
|
}
|
|
|
|
// Find the appropriate existing navigation element
|
|
let existingNav = null;
|
|
let headerElement = null;
|
|
let pageType = '';
|
|
|
|
if (dashboardPage) {
|
|
existingNav = document.querySelector('.hvac-dashboard-nav');
|
|
headerElement = document.querySelector('.hvac-dashboard-header');
|
|
pageType = 'dashboard';
|
|
} else if (eventSummaryPage) {
|
|
existingNav = document.querySelector('.hvac-event-summary-actions');
|
|
headerElement = document.querySelector('.hvac-event-summary-header');
|
|
pageType = 'event-summary';
|
|
} else if (emailAttendeesPage) {
|
|
existingNav = document.querySelector('.hvac-email-navigation');
|
|
headerElement = document.querySelector('.hvac-email-header');
|
|
pageType = 'email-attendees';
|
|
}
|
|
|
|
// If no existing navigation found, exit
|
|
if (!existingNav || !headerElement) {
|
|
return;
|
|
}
|
|
|
|
// Create mobile nav container
|
|
const mobileNavContainer = document.createElement('div');
|
|
mobileNavContainer.className = 'hvac-mobile-nav-container';
|
|
|
|
// Create toggle button
|
|
const toggleButton = document.createElement('button');
|
|
toggleButton.className = 'hvac-mobile-nav-toggle';
|
|
toggleButton.setAttribute('aria-label', 'Toggle navigation menu');
|
|
toggleButton.setAttribute('aria-expanded', 'false');
|
|
toggleButton.innerText = 'Menu';
|
|
|
|
// Create mobile nav menu
|
|
const mobileNav = document.createElement('nav');
|
|
mobileNav.className = 'hvac-mobile-nav';
|
|
mobileNav.setAttribute('aria-label', 'Mobile navigation');
|
|
|
|
// Create list of menu items by cloning original nav links
|
|
const navList = document.createElement('ul');
|
|
const links = existingNav.querySelectorAll('a');
|
|
|
|
links.forEach(link => {
|
|
const listItem = document.createElement('li');
|
|
const newLink = link.cloneNode(true);
|
|
|
|
// Highlight active page in mobile nav
|
|
if (newLink.getAttribute('href') === window.location.pathname ||
|
|
newLink.getAttribute('href') === window.location.href) {
|
|
newLink.classList.add('active');
|
|
}
|
|
|
|
listItem.appendChild(newLink);
|
|
navList.appendChild(listItem);
|
|
});
|
|
|
|
mobileNav.appendChild(navList);
|
|
|
|
// Add components to container
|
|
mobileNavContainer.appendChild(toggleButton);
|
|
mobileNavContainer.appendChild(mobileNav);
|
|
|
|
// Insert container after the header
|
|
headerElement.after(mobileNavContainer);
|
|
|
|
// Toggle button functionality
|
|
toggleButton.addEventListener('click', function() {
|
|
const isOpen = mobileNav.classList.contains('open');
|
|
|
|
if (isOpen) {
|
|
mobileNav.classList.remove('open');
|
|
toggleButton.classList.remove('active');
|
|
toggleButton.setAttribute('aria-expanded', 'false');
|
|
} else {
|
|
mobileNav.classList.add('open');
|
|
toggleButton.classList.add('active');
|
|
toggleButton.setAttribute('aria-expanded', 'true');
|
|
}
|
|
});
|
|
|
|
// Close menu when a link is clicked
|
|
mobileNav.querySelectorAll('a').forEach(link => {
|
|
link.addEventListener('click', function() {
|
|
mobileNav.classList.remove('open');
|
|
toggleButton.classList.remove('active');
|
|
toggleButton.setAttribute('aria-expanded', 'false');
|
|
});
|
|
});
|
|
|
|
// Close menu when clicking outside
|
|
document.addEventListener('click', function(event) {
|
|
if (!mobileNavContainer.contains(event.target)) {
|
|
mobileNav.classList.remove('open');
|
|
toggleButton.classList.remove('active');
|
|
toggleButton.setAttribute('aria-expanded', 'false');
|
|
}
|
|
});
|
|
|
|
// Add keyboard navigation
|
|
document.addEventListener('keydown', function(event) {
|
|
if (event.key === 'Escape' && mobileNav.classList.contains('open')) {
|
|
mobileNav.classList.remove('open');
|
|
toggleButton.classList.remove('active');
|
|
toggleButton.setAttribute('aria-expanded', 'false');
|
|
toggleButton.focus();
|
|
}
|
|
});
|
|
}
|
|
|
|
// Run setup
|
|
setupMobileNavigation();
|
|
});
|
|
})(); |