upskill-event-manager/assets/js/megamenu-options.min.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

1 line
No EOL
4.4 KiB
JavaScript

function menuSettingsEventClick(){let i=document.querySelector(".ast-offcanvas-wrapper");document.addEventListener("click",function(e){var t,a,n;e.target.matches(".astra-megamenu-opts-btn")&&(t=e.target.closest(".menu-item").classList.value).includes("menu-item-depth-")&&(t=t.split("menu-item-depth-")[1].split("")[0],a=e.target.getAttribute("data-menu-title"),e=e.target.getAttribute("data-menu-id"),n=document.querySelector("#nav-menu-meta-object-id").getAttribute("value"),t)&&a&&e&&n&&(document.dispatchEvent(new CustomEvent("astra_mega_menu_event",{detail:{menu_depth:t,menu_name:a,menu_id:e,navId:n}})),i.classList.contains("active")||i.classList.add("active"))})}function onColorReady(){jQuery(document).mouseup(function(e){var t=jQuery(".ast-color"),a=t.find(".astra-color-picker-wrap"),n=t.find(".ast-color-btn-reset-wrap");a.is(e.target)||n.is(e.target)||0!==a.has(e.target).length||0!==n.has(e.target).length||t.find(".components-button.astra-color-icon-indicate.open").click()})}document.addEventListener("DOMContentLoaded",()=>{menuSettingsEventClick()}),(i=>{let t={current:null};function n(){var a=i(this).closest(".widget"),t=a.find(".widget-inner"),n=a.attr("id"),e=(a.toggleClass("menu-item-edit-active"),{action:"ast_edit_widget",widget_id:n,security_nonce:AstraBuilderMegaMenu.nonceWidget});a.hasClass("open")||a.data("loaded")?a.toggleClass("open"):i.post(ajaxurl,e,function(e){DOMPurify.addHook("afterSanitizeAttributes",e=>{"INPUT"===e.nodeName&&e?.hasAttribute("value")&&"ast_save_widget"===e?.getAttribute("value")&&e?.setAttribute("name","action")}),t.html(DOMPurify.sanitize(e.data)),a.data("loaded",!0).toggleClass("open"),a.is("[id*=black-studio-tinymce]")&&bstw(a).deactivate().activate(),setTimeout(function(){i(document).trigger("widget-added",[a])},100),a.find(".delete").on("click",function(e){e.preventDefault();e={action:"ast_delete_widget",widget_id:n,security_nonce:AstraBuilderMegaMenu.nonceWidget};i.post(ajaxurl,e,function(e){a.remove(),i("#mega-menu-submit").removeClass("ast-disabled")})}),a.find(".close").on("click",function(e){e.preventDefault(),a.toggleClass("open")}),a.find(".ast-save-widget").on("click",function(e){e.preventDefault();var e=a.find("form").serialize(),t=i(this);t.attr("disabled","disabled"),a.find(".spinner").css("visibility","visible"),i.post(ajaxurl,e,function(e){a.find(".spinner").css("visibility","hidden"),t.removeAttr("disabled"),i("#mega-menu-submit").removeClass("ast-disabled")})})})}document.addEventListener("astra_mega_menu_loaded",function(e){{e=e.detail.menu_id;let a=i(".astra-mm-options-wrap");t.current&&t.current?.abort(),t.current=new AbortController,e={action:"ast_render_widgets",menu_item_id:e,security_nonce:AstraBuilderMegaMenu.nonceWidget},e=new URLSearchParams(e).toString(),fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e,signal:t.current?.signal}).then(e=>{if(e.ok)return e.json();throw new Error("Network response was not ok!")}).then(e=>{var t=e.data.html;e.data.has_widgets&&i(".ast-widget-list").show(),a.find(".ast-widget-list").html(DOMPurify.sanitize(t)),i("#ast-widget-sortable").sortable({change:function(e,t){i("#mega-menu-submit").removeClass("ast-disabled")}}),i("#ast-widget-sortable").disableSelection(),i(".widget-action").off(),i(".widget-action").on("click",n)}).catch(e=>{e.name})}i(".astra-mm-options-wrap").find(".ast-select2-container").astselect2({placeholder:astMegamenuVars.select2_placeholder,ajax:{url:ajaxurl,dataType:"json",method:"post",delay:250,data:function(e){return{q:e.term,page:e.page,action:"ast_get_posts_list",nonce:astRules.ajax_nonce}},processResults:function(e){return i("#mega-menu-submit").removeClass("ast-disabled"),{results:e}},cache:!0},minimumInputLength:2,language:astRules.ast_lang}),onColorReady()}),document.addEventListener("astra_mega_menu_unmounted",()=>{t.current&&t.current?.abort()}),document.addEventListener("astra_mega_menu_widget_event",function(e){var t,a;e=e.detail.menu_id,t=i(".ast-select-widget").val(),a=i(".astra-mm-options-wrap"),""!=t&&(i(".ast-widget-list").show(),t={action:"ast_add_widget",widget_id:t,menu_item_id:e,title:i(".ast-select-widget").find("option:selected").text(),security_nonce:AstraBuilderMegaMenu.nonceWidget},i.post(ajaxurl,t,function(e){i(e.data)?.each((e,t)=>a.find(".ast-widget-list").append(DOMPurify.sanitize(t))),i(".widget-action").off(),i(".widget-action").on("click",n),i("#mega-menu-submit").removeClass("ast-disabled")}))})})(jQuery);