upskill-event-manager/assets/js/frontend-pro.js
Ben Reed cdc5ea85f4 feat: Add comprehensive CSS, JavaScript and theme asset infrastructure
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
2025-08-11 16:20:31 -03:00

160 lines
6.7 KiB
JavaScript

/**
* File fronend-pro.js
*
* Handles toggling the navigation menu for Addon widget
*
* @package Astra
*/
astraToggleSetupPro = function( mobileHeaderType, body, menu_click_listeners ) {
var flag = false;
var menuToggleAllLength;
if ( 'off-canvas' === mobileHeaderType || 'full-width' === mobileHeaderType ) {
// comma separated selector added, if menu is outside of Off-Canvas then submenu is not clickable, it work only for Off-Canvas area with dropdown style.
var __main_header_all = document.querySelectorAll( '#ast-mobile-popup, #ast-mobile-header' );
if ( body.classList.contains('ast-header-break-point') ) {
var menu_toggle_all = document.querySelectorAll('#ast-mobile-header .main-header-menu-toggle');
} else {
menu_toggle_all = document.querySelectorAll('#ast-desktop-header .main-header-menu-toggle');
}
menuToggleAllLength = menu_toggle_all.length;
} else {
if ( body.classList.contains('ast-header-break-point') ) {
var __main_header_all = document.querySelectorAll( '#ast-mobile-header' ),
menu_toggle_all = document.querySelectorAll( '#ast-mobile-header .main-header-menu-toggle' );
} else {
var __main_header_all = document.querySelectorAll( '#ast-desktop-header' ),
menu_toggle_all = document.querySelectorAll( '#ast-desktop-header .main-header-menu-toggle' );
}
menuToggleAllLength = menu_toggle_all.length;
flag = menuToggleAllLength > 0 ? false : true;
menuToggleAllLength = flag ? 1 : menuToggleAllLength;
}
if ( menuToggleAllLength > 0 || flag ) {
for (var i = 0; i < menuToggleAllLength; i++) {
if ( !flag ) {
menu_toggle_all[i].setAttribute('data-index', i);
if (!menu_click_listeners[i]) {
menu_click_listeners[i] = menu_toggle_all[i];
menu_toggle_all[i].removeEventListener('click', astraNavMenuToggle);
menu_toggle_all[i].addEventListener('click', astraNavMenuToggle, false);
}
}
if ('undefined' !== typeof __main_header_all[i]) {
// To handle the comma seprated selector added above we need this loop.
for( var mainHeaderCount =0; mainHeaderCount < __main_header_all.length; mainHeaderCount++ ){
if (document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-link')) {
var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .menu-item-has-children > .menu-link, ul.main-header-menu .ast-menu-toggle');
} else {
var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .ast-menu-toggle');
}
// Add Eventlisteners for Submenu.
if (astra_menu_toggle.length > 0) {
for (var j = 0; j < astra_menu_toggle.length; j++) {
astra_menu_toggle[j].removeEventListener('click', AstraToggleSubMenu);
astra_menu_toggle[j].addEventListener('click', AstraToggleSubMenu, false);
}
}
}
}
}
}
}
astraNavMenuTogglePro = function ( event, body, mobileHeaderType, thisObj ) {
event.preventDefault();
var desktop_header = event.target.closest('#ast-desktop-header');
var desktop_header_content = document.querySelector('#masthead > #ast-desktop-header .ast-desktop-header-content');
if ( null !== desktop_header && undefined !== desktop_header && '' !== desktop_header ) {
var desktop_toggle = desktop_header.querySelector( '.main-header-menu-toggle' );
} else {
var desktop_toggle = document.querySelector('#masthead > #ast-desktop-header .main-header-menu-toggle');
}
var desktop_menu = document.querySelector('#masthead > #ast-desktop-header .ast-desktop-header-content .main-header-bar-navigation');
if ( 'desktop' === event.currentTarget.trigger_type ) {
if ( null !== desktop_menu && '' !== desktop_menu && undefined !== desktop_menu ) {
astraToggleClass(desktop_menu, 'toggle-on');
if (desktop_menu.classList.contains('toggle-on')) {
desktop_menu.style.display = 'block';
} else {
desktop_menu.style.display = '';
}
}
astraToggleClass(desktop_toggle, 'toggled');
if ( desktop_toggle.classList.contains( 'toggled' ) ) {
body.classList.add("ast-main-header-nav-open");
if ( 'dropdown' === mobileHeaderType ) {
desktop_header_content.style.display = 'block';
}
} else {
body.classList.remove("ast-main-header-nav-open");
desktop_header_content.style.display = 'none';
}
return;
}
var __main_header_all = document.querySelectorAll('#masthead > #ast-mobile-header .main-header-bar-navigation');
menu_toggle_all = document.querySelectorAll( '#masthead > #ast-mobile-header .main-header-menu-toggle' )
var event_index = '0';
var sticky_header = false;
if ( null !== thisObj.closest( '#ast-fixed-header' ) ) {
__main_header_all = document.querySelectorAll('#ast-fixed-header > #ast-mobile-header .main-header-bar-navigation');
menu_toggle_all = document.querySelectorAll( '#ast-fixed-header .main-header-menu-toggle' )
event_index = '0';
sticky_header = true;
}
if ('undefined' === typeof __main_header_all[event_index]) {
return false;
}
var menuHasChildren = __main_header_all[event_index].querySelectorAll('.menu-item-has-children');
for (var i = 0; i < menuHasChildren.length; i++) {
menuHasChildren[i].classList.remove('ast-submenu-expanded');
var menuHasChildrenSubMenu = menuHasChildren[i].querySelectorAll('.sub-menu');
for (var j = 0; j < menuHasChildrenSubMenu.length; j++) {
menuHasChildrenSubMenu[j].style.display = 'none';
}
}
var menu_class = thisObj.getAttribute('class') || '';
if ( menu_class.indexOf('main-header-menu-toggle') !== -1 ) {
astraToggleClass(__main_header_all[event_index], 'toggle-on');
astraToggleClass(menu_toggle_all[event_index], 'toggled');
if ( sticky_header && 1 < menu_toggle_all.length ) {
astraToggleClass(menu_toggle_all['1'], 'toggled');
}
if (__main_header_all[event_index].classList.contains('toggle-on')) {
__main_header_all[event_index].style.display = 'block';
body.classList.add("ast-main-header-nav-open");
} else {
__main_header_all[event_index].style.display = '';
body.classList.remove("ast-main-header-nav-open");
}
}
}