upskill-event-manager/assets/js/customizer-controls.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

134 lines
3.1 KiB
JavaScript

/**
* Customizer controls
*
* @package Astra
*/
( function( $ ) {
/* Internal shorthand */
var api = wp.customize;
/**
* Helper class for the main Customizer interface.
*
* @since 1.0.0
* @class ASTCustomizer
*/
ASTCustomizer = {
controls : {},
/**
* Initializes our custom logic for the Customizer.
*
* @since 1.0.0
* @method init
*/
init: function()
{
ASTCustomizer._initToggles();
ASTCustomizer._initSubControlsToggle();
},
/**
* Initializes the logic for showing and hiding controls
* when a setting changes.
*
* @since 1.0.0
* @method _initToggles
*/
_initToggles: function()
{
// Trigger the Adv Tab Click trigger.
ASTControlTrigger.triggerHook( 'astra-toggle-control', api );
// Loop through each setting.
$.each( ASTCustomizerToggles, function( settingId, toggles ) {
// Get the setting object.
api( settingId, function( setting ) {
// Loop though the toggles for the setting.
$.each( toggles, function( i, toggle ) {
// Loop through the controls for the toggle.
$.each( toggle.controls, function( k, controlId ) {
// Get the control object.
api.control( controlId, function( control ) {
// Define the visibility callback.
var visibility = function( to ) {
control.container.toggle( toggle.callback( to ) );
};
// Init visibility.
visibility( setting.get() );
// Bind the visibility callback to the setting.
setting.bind( visibility );
});
});
});
});
});
},
/**
* Toggle sub control visibility CSS.
*
* @since x.x.x
*/
subControlsToggleCSS( controlValue, dependents ) {
$.each( dependents, function( controlOption, dependentSubControls ) {
$.each( dependentSubControls, function( dependentIndex, subControl ) {
// Remove old.
jQuery( 'style#ast-sub-control-' + subControl ).remove();
// Add new.
if ( controlValue !== controlOption ) {
// Concat and append new <style>.
jQuery( 'head' ).append(
'<style id="ast-sub-control-' + subControl + '">' +
'#customize-control-' + subControl + ' { display: none; }' +
'</style>'
);
}
});
});
},
/**
* Initializes the logic for showing and hiding sub controls
* when a setting changes.
*
* @since x.x.x
* @method _initSubControlsToggle
* @return void
*/
_initSubControlsToggle: function()
{
document.addEventListener('AstraToggleSubControls', function (e) {
let subControlData = e.detail;
ASTCustomizer.subControlsToggleCSS( subControlData.controlValue, subControlData.dependents );
});
}
};
$( function() { ASTCustomizer.init(); } );
})( jQuery );
( function( api ) {
// Extends our custom astra-pro section.
api.sectionConstructor['astra-pro'] = api.Section.extend( {
// No events for this type of section.
attachEvents: function () {},
// Always make the section active.
isContextuallyActive: function () {
return true;
}
} );
} )( wp.customize );