upskill-event-manager/assets/js/license-form-popup.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

151 lines
No EOL
4 KiB
JavaScript

(function($){
BSFCoreLicenseForm = {
/**
* Init
*/
init: function()
{
this._showFormOnLoad();
this._bind();
},
/**
* Binds events
*/
_bind: function()
{
$( document ).on('click', '.bsf-core-license-form-btn', BSFCoreLicenseForm._showFormOnClick);
$( document ).on('click', '.bsf-core-license-form-close-btn', BSFCoreLicenseForm._closeForm);
$( document ).on('click', '.bsf-core-license-form .bsf-core-license-form-overlay', BSFCoreLicenseForm._closeForm);
},
_changeURL: function( url )
{
History.pushState(null, null, url);
},
/**
* Show form on Load
*/
_showFormOnLoad: function( e )
{
if( BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var slug = BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form');
BSFCoreLicenseForm._showForm( slug );
}
},
/**
* Show form on Click
*/
_showFormOnClick: function( e )
{
// don't override click action if the link is not from the popup form.
var licenseFormURl = $( this ).attr('href') || '';
if ( null !== BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form', licenseFormURl) ||
true === $( this ).hasClass('bsf-core-plugin-link') ) {
e.preventDefault();
var slug = $( this ).attr('plugin-slug') || '';
var url_params = {'bsf-inline-license-form':slug};
BSFCoreLicenseForm._showForm( slug );
// Change URL.
if( ! BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var current_url = window.location.href;
var current_url_separator = ( window.location.href.indexOf( "?" ) === -1 ) ? "?" : "&";
var new_url = current_url + current_url_separator + decodeURIComponent( $.param( url_params ) );
BSFCoreLicenseForm._changeURL( new_url );
}
}
},
/**
* Show form by slug
*/
_showForm: function( slug )
{
if( $(".bsf-core-license-form[plugin-slug='"+slug+"']").length ) {
$(".bsf-core-license-form[plugin-slug='"+slug+"']").show();
$('body').addClass('bsf-core-license-form-open');
}
},
/**
* Close form.
*/
_closeForm: function( e )
{
e.preventDefault();
$('.bsf-core-license-form').hide();
$('body').removeClass('bsf-core-license-form-open');
if( BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var url_params = BSFCoreLicenseForm._getQueryStrings();
delete url_params['bsf-inline-license-form'];
delete url_params['bsf-inline-license-form'];
delete url_params['license_action'];
delete url_params['token'];
delete url_params['product_id'];
delete url_params['purchase_key'];
delete url_params['success'];
delete url_params['status'];
delete url_params['message'];
delete url_params['debug'];
delete url_params['activation_method'];
var current_url = window.location.href;
var root_url = current_url.substr(0, current_url.indexOf('?'));
if( jQuery.isEmptyObject( url_params ) ) {
var new_url = root_url + decodeURIComponent( $.param( url_params ) );
} else {
var current_url_separator = ( root_url.indexOf( "?" ) === -1 ) ? "?" : "&";
var new_url = root_url + current_url_separator + decodeURIComponent( $.param( url_params ) );
}
// Change URL.
BSFCoreLicenseForm._changeURL( new_url );
}
},
/**
* Get URL param.
*/
_getParamFromURL: function(name, url)
{
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
},
/**
* Get query strings.
*/
_getQueryStrings( str )
{
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
}
};
/**
* Initialization
*/
$(function(){
BSFCoreLicenseForm.init();
});
})(jQuery);