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
133 lines
4.2 KiB
JavaScript
133 lines
4.2 KiB
JavaScript
(function () {
|
|
var total = parseInt( astra.shop_infinite_total ) || '',
|
|
count = parseInt( astra.shop_infinite_count ) || '',
|
|
pagination = astra.shop_pagination || '',
|
|
masonryEnabled = false,
|
|
loadStatus = true,
|
|
infinite_event = astra.shop_infinite_scroll_event || '',
|
|
revealEffectEnable = astra.shopRevealEffectEnable || '',
|
|
loader = document.querySelector('.ast-shop-pagination-infinite .ast-loader');
|
|
astShopLoadMore = document.querySelector('.ast-shop-load-more');
|
|
|
|
// Is 'infinite' pagination?
|
|
if ( typeof pagination === 'string' && pagination === 'infinite' ) {
|
|
|
|
var in_customizer = false;
|
|
|
|
// check for wp.customize return boolean
|
|
if ( typeof wp !== 'undefined' ) {
|
|
|
|
in_customizer = typeof wp.customize !== 'undefined' ? true : false;
|
|
|
|
if ( in_customizer ) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
if ( typeof infinite_event === 'string' ) {
|
|
switch( infinite_event ) {
|
|
case 'click':
|
|
document.body.addEventListener('click',function(event) {
|
|
if (event.target && event.target.classList.contains('ast-shop-load-more')) {
|
|
event.preventDefault();
|
|
// Added check if count and total are properly defined.
|
|
if( count != 'undefined' && count != ''&& total != 'undefined' && total != '' ) {
|
|
if ( count > total ) {
|
|
return false;
|
|
}
|
|
NextloadArticles(count);
|
|
count++;
|
|
}
|
|
}
|
|
});
|
|
break;
|
|
|
|
case "scroll":
|
|
const getLastProduct = () => document.querySelector(".product:last-child");
|
|
|
|
window.addEventListener("scroll", function () {
|
|
// Use the cached last product
|
|
const lastProduct = getLastProduct();
|
|
if (!lastProduct) return;
|
|
|
|
const lastProductRect = lastProduct.getBoundingClientRect();
|
|
|
|
const isLastProductVisible = lastProductRect.bottom <= window.innerHeight;
|
|
|
|
// Check if the user is scrolling down and the last product is within view
|
|
if (isLastProductVisible) {
|
|
// Check if there are more products to load
|
|
if (count <= total && loadStatus) {
|
|
NextloadArticles(count);
|
|
count++;
|
|
loadStatus = false;
|
|
}
|
|
}
|
|
});
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Append Posts via AJAX
|
|
*
|
|
* Perform masonry operations.
|
|
*/
|
|
const NextloadArticles = (pageNumber) => {
|
|
if( astShopLoadMore ){
|
|
astShopLoadMore.classList.remove('active');
|
|
}
|
|
var pageUrlSelector = document.querySelector('a.next.page-numbers');
|
|
var nextDestUrl = pageUrlSelector.getAttribute('href');
|
|
loader.style.display = 'block';
|
|
var request = new XMLHttpRequest();
|
|
request.open('GET', nextDestUrl, true);
|
|
request.send();
|
|
request.onload = function() {
|
|
var string = request.response;
|
|
var data = new DOMParser().parseFromString(string, 'text/html');
|
|
// Check if #main exists and use it, otherwise, query from the document
|
|
var mainContainer = data.querySelector('#main') || data;
|
|
var boxes = mainContainer.querySelectorAll('li.product'),
|
|
productContainer = document.querySelector('.ast-woocommerce-container ul.products');
|
|
|
|
if ( ! productContainer ) {
|
|
var productContainer = document.querySelector('.elementor-widget-wc-archive-products ul.products');
|
|
}
|
|
|
|
// Disable loader
|
|
loader.style.display = 'none';
|
|
if( astShopLoadMore ){
|
|
astShopLoadMore.classList.add('active');
|
|
}
|
|
|
|
// Append articles
|
|
|
|
for (var boxCount = 0; boxCount < boxes.length; boxCount++) {
|
|
productContainer.append(boxes[boxCount]);
|
|
}
|
|
|
|
// Add grid classes
|
|
var msg = astra.shop_no_more_post_message || '';
|
|
|
|
// Show no more post message
|
|
if( count > total ) {
|
|
document.querySelector('.ast-shop-pagination-infinite').innerHTML = '<span class="ast-shop-load-more no-more active" style="display: inline-block;">' + msg + "</span>";
|
|
} else {
|
|
var newNextTargetUrl = nextDestUrl.replace(/\/page\/[0-9]+/, '/page/' + (pageNumber + 1));
|
|
pageUrlSelector.setAttribute('href', newNextTargetUrl);
|
|
}
|
|
|
|
// Complete the process 'loadStatus'
|
|
loadStatus = true;
|
|
|
|
document.dispatchEvent( new CustomEvent( "astraInfinitePaginationLoaded", { "detail": {} }) );
|
|
|
|
if( revealEffectEnable ) {
|
|
fadin('.ast-fade-up', { delay: 200 });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})();
|