upskill-event-manager/assets/js/advanced-hooks-list-page.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

81 lines
3.1 KiB
JavaScript

/**
* Custom Layout Enable or Disable actions.
*
* @package Astra Addon
* @since x.x.x
*/
const toggelSwitch = function() {
const self = this;
self.classList.toggle('ast-active');
const enable = self.classList.contains('ast-active') ? 'yes' : 'no'
// Ajax request.
const xhttp = new XMLHttpRequest();
const ajaxUrl = astHooksData.url + '?action=ast_advanced_hook_display_toggle&post_id=' + self.dataset.post_id + '&enable=' + enable + '&nonce=' + astHooksData.nonce;
xhttp.open("GET", ajaxUrl);
xhttp.send();
}
const quickViewPopup = function( event ) {
const self = this;
self.classList.add( "requesting" );
// Ajax request.
const xhttp = new XMLHttpRequest();
const ajaxUrl = astHooksData.url + '?action=ast_advanced_layout_quick_preview&post_id=' + self.dataset.layout_id + '&nonce=' + astHooksData.quick_view_nonce;
xhttp.open( "GET", ajaxUrl );
xhttp.send();
xhttp.onload = function() {
const response = JSON.parse( xhttp.response );
self.classList.remove( "requesting" );
if ( response.success ) {
const template = wp.template( 'ast-modal-view-layout-details' );
document.body.style.overflow = 'hidden';
document.querySelector( ".ast-custom-layout-preview-wrapper" ).innerHTML = DOMPurify.sanitize( template( response.data ) );
}
}
}
const copyShortcodeToClipboard = function() {
const self = this,
toBeCopyInputSelector = self.dataset.linked_span,
copyTextTarget = document.querySelector( '.' + toBeCopyInputSelector ),
hiddenInpput = document.createElement( "input" );
hiddenInpput.setAttribute( "value", copyTextTarget.innerHTML );
document.body.appendChild(hiddenInpput);
hiddenInpput.select();
if ( document.execCommand( 'copy' ) ) {
self.classList.add( 'shortcode-copied' );
setTimeout( function () {
self.classList.remove( 'shortcode-copied' );
}, 1000 );
}
document.body.removeChild(hiddenInpput);
}
document.addEventListener("DOMContentLoaded", function() {
// For Enable/Disable toggle switch.
const switchSelector = document.querySelectorAll('.ast-custom-layout-switch');
for ( let switchSelectorCount = 0; switchSelectorCount < switchSelector.length; switchSelectorCount++ ) {
switchSelector[switchSelectorCount].addEventListener( 'click', toggelSwitch, false );
}
// For Quick View popup setup.
const quickViewSelector = document.querySelectorAll('.advanced_hook_data_trigger');
for ( let quickViewSelectorCount = 0; quickViewSelectorCount < quickViewSelector.length; quickViewSelectorCount++ ) {
quickViewSelector[quickViewSelectorCount].addEventListener( 'click', quickViewPopup, false );
}
// Shortcode copy to clipboard.
const shortcodeCopySelector = document.querySelectorAll('.ast-copy-layout-shortcode');
for ( let shortcodeCopySelectorCount = 0; shortcodeCopySelectorCount < shortcodeCopySelector.length; shortcodeCopySelectorCount++ ) {
shortcodeCopySelector[shortcodeCopySelectorCount].addEventListener( 'click', copyShortcodeToClipboard, false );
}
document.addEventListener( 'click', function(e) {
if( e.target && e.target.id === 'modal-close-link' ) {
document.body.style.overflow = 'auto';
document.querySelector( ".ast-custom-layout-preview-wrapper" ).innerHTML = '';
}
});
});