File manager - Edit - /home/premiey/www/wp-includes/images/media/unminified.tar
Back
style.js 0000666 00000057043 15165371455 0006273 0 ustar 00 /** * File navigation.js * * Handles toggling the navigation menu for small screens and enables tab * support for dropdown menus. * * @package Astra */ /** * Get all of an element's parent elements up the DOM tree * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var astraGetParents = function ( elem, selector ) { // Element.matches() polyfill. if ( ! Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll( s ), i = matches.length; while (--i >= 0 && matches.item( i ) !== this) {} return i > -1; }; } // Setup parents array. var parents = []; // Get matching parent elements. for ( ; elem && elem !== document; elem = elem.parentNode ) { // Add matching parents to array. if ( selector ) { if ( elem.matches( selector ) ) { parents.push( elem ); } } else { parents.push( elem ); } } return parents; }; /** * Deprecated: Get all of an element's parent elements up the DOM tree * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var getParents = function ( elem, selector ) { console.warn( 'getParents() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraGetParents() instead.' ); astraGetParents( elem, selector ); } /** * Toggle Class funtion * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var astraToggleClass = function ( el, className ) { if ( el.classList.contains( className ) ) { el.classList.remove( className ); } else { el.classList.add( className ); } }; /** * Deprecated: Toggle Class funtion * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var toggleClass = function ( el, className ) { console.warn( 'toggleClass() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraToggleClass() instead.' ); astraToggleClass( el, className ); }; // CustomEvent() constructor functionality in Internet Explorer 9 and higher. (function () { if (typeof window.CustomEvent === "function") return false; function CustomEvent(event, params) { params = params || { bubbles: false, cancelable: false, detail: undefined }; var evt = document.createEvent('CustomEvent'); evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); return evt; } CustomEvent.prototype = window.Event.prototype; window.CustomEvent = CustomEvent; })(); /** * Trigget custom JS Event. * * @since 1.4.6 * * @link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent * @param {Node} el Dom Node element on which the event is to be triggered. * @param {Node} typeArg A DOMString representing the name of the event. * @param {String} A CustomEventInit dictionary, having the following fields: * "detail", optional and defaulting to null, of type any, that is an event-dependent value associated with the event. */ var astraTriggerEvent = function astraTriggerEvent( el, typeArg ) { var customEventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var event = new CustomEvent(typeArg, customEventInit); el.dispatchEvent(event); }; /** * Scroll to ID/Top with smooth scroll behavior. * * @since x.x.x * * @param {Event} e Event which is been fired. * @param {String} top offset from top. */ astraSmoothScroll = function astraSmoothScroll( e, top ) { e.preventDefault(); window.scrollTo({ top: top, left: 0, behavior: 'smooth' }); }; /** * Scroll to Top trigger visibility adjustments. * * @since x.x.x * * @param {Node} masthead Page header. * @param {Node} astScrollTop Scroll to Top selector. */ astScrollToTopHandler = function ( masthead, astScrollTop ) { var content = getComputedStyle(astScrollTop).content, device = astScrollTop.dataset.onDevices; content = content.replace( /[^0-9]/g, '' ); if( 'both' == device || ( 'desktop' == device && '769' == content ) || ( 'mobile' == device && '' == content ) ) { // Get current window / document scroll. var scrollTop = window.pageYOffset || document.body.scrollTop; // If masthead found. if( masthead && masthead.length ) { if (scrollTop > masthead.offsetHeight + 100) { astScrollTop.style.display = "block"; } else { astScrollTop.style.display = "none"; } } else { // If there is no masthead set default start scroll if ( window.pageYOffset > 300 ) { astScrollTop.style.display = "block"; } else { astScrollTop.style.display = "none"; } } } else { astScrollTop.style.display = "none"; } }; ( function() { var menu_toggle_all = document.querySelectorAll( '.main-header-menu-toggle' ); var menu_click_listeners_nav = {}; /* Add break point Class and related trigger */ var updateHeaderBreakPoint = function () { // Content overrflowing out of screen can give incorrect window.innerWidth. // Adding overflow hidden and then calculating the window.innerWidth fixes the problem. var originalOverflow = document.querySelector('body').style.overflow; document.querySelector('body').style.overflow = 'hidden'; var ww = window.innerWidth; document.querySelector('body').style.overflow = originalOverflow; var break_point = astra.break_point, headerWrap = document.querySelectorAll('.main-header-bar-wrap'); if (headerWrap.length > 0) { for (var i = 0; i < headerWrap.length; i++) { if (headerWrap[i].tagName == 'DIV' && headerWrap[i].classList.contains('main-header-bar-wrap')) { if (ww > break_point) { //remove menu toggled class. if (null != menu_toggle_all[i]) { menu_toggle_all[i].classList.remove('toggled'); } document.body.classList.remove("ast-header-break-point"); document.body.classList.add("ast-desktop"); astraTriggerEvent(document.body, "astra-header-responsive-enabled"); } else { document.body.classList.add("ast-header-break-point"); document.body.classList.remove("ast-desktop"); astraTriggerEvent(document.body, "astra-header-responsive-disabled") } } } } } updateHeaderBreakPoint(); AstraToggleSubMenu = function() { var parent_li = this.parentNode; if (parent_li.classList.contains('ast-submenu-expanded') && document.querySelector("header.site-header").classList.contains("ast-menu-toggle-link")) { if (!this.classList.contains('ast-menu-toggle')) { var link = parent_li.querySelector('a').getAttribute('href'); if ('' !== link || '#' !== link) { window.location = link; } } } var parent_li_child = parent_li.querySelectorAll('.menu-item-has-children'); for (var j = 0; j < parent_li_child.length; j++) { parent_li_child[j].classList.remove('ast-submenu-expanded'); var parent_li_child_sub_menu = parent_li_child[j].querySelector('.sub-menu, .children'); if( null !== parent_li_child_sub_menu ) { parent_li_child_sub_menu.style.display = 'none'; } } var parent_li_sibling = parent_li.parentNode.querySelectorAll('.menu-item-has-children'); for (var j = 0; j < parent_li_sibling.length; j++) { if (parent_li_sibling[j] != parent_li) { parent_li_sibling[j].classList.remove('ast-submenu-expanded'); var all_sub_menu = parent_li_sibling[j].querySelectorAll('.sub-menu'); for (var k = 0; k < all_sub_menu.length; k++) { all_sub_menu[k].style.display = 'none'; } } } if (parent_li.classList.contains('menu-item-has-children') ) { astraToggleClass(parent_li, 'ast-submenu-expanded'); if (parent_li.classList.contains('ast-submenu-expanded')) { parent_li.querySelector('.sub-menu').style.display = 'block'; } else { parent_li.querySelector('.sub-menu').style.display = 'none'; } } }; AstraNavigationMenu = function( parentList ) { console.warn( 'AstraNavigationMenu() function has been deprecated since version 1.6.5 or above of Astra Theme and will be removed in the future.' ); }; AstraToggleMenu = function( astra_menu_toggle ) { console.warn('AstraToggleMenu() function has been deprecated since version 1.6.5 or above of Astra Theme and will be removed in the future. Use AstraToggleSubMenu() instead.'); // Add Eventlisteners for Submenu. if (astra_menu_toggle.length > 0) { for (var i = 0; i < astra_menu_toggle.length; i++) { astra_menu_toggle[i].addEventListener('click', AstraToggleSubMenu, false); } } }; AstraToggleSetup = function () { var __main_header_all = document.querySelectorAll('.main-header-bar-navigation'); if (menu_toggle_all.length > 0) { for (var i = 0; i < menu_toggle_all.length; i++) { menu_toggle_all[i].setAttribute('data-index', i); if ( ! menu_click_listeners_nav[i] ) { menu_click_listeners_nav[i] = menu_toggle_all[i]; menu_toggle_all[i].addEventListener('click', astraNavMenuToggle, false); } if ('undefined' !== typeof __main_header_all[i]) { if (document.querySelector("header.site-header").classList.contains("ast-menu-toggle-link")) { var astra_menu_toggle = __main_header_all[i].querySelectorAll('.ast-header-break-point .main-header-menu .menu-item-has-children > .menu-link, .ast-header-break-point ul.main-header-menu .ast-menu-toggle'); } else { var astra_menu_toggle = __main_header_all[i].querySelectorAll('ul.main-header-menu .ast-menu-toggle'); } // Add Eventlisteners for Submenu. if (astra_menu_toggle.length > 0) { for (var j = 0; j < astra_menu_toggle.length; j++) { astra_menu_toggle[j].addEventListener('click', AstraToggleSubMenu, false); } } } } } }; astraNavMenuToggle = function ( event ) { event.preventDefault(); var __main_header_all = document.querySelectorAll('.main-header-bar-navigation'); var event_index = this.getAttribute('data-index'); if ('undefined' === typeof __main_header_all[event_index]) { return false; } var menuHasChildren = __main_header_all[event_index].querySelectorAll('.menu-item-has-children'); for (var i = 0; i < menuHasChildren.length; i++) { menuHasChildren[i].classList.remove('ast-submenu-expanded'); var menuHasChildrenSubMenu = menuHasChildren[i].querySelectorAll('.sub-menu'); for (var j = 0; j < menuHasChildrenSubMenu.length; j++) { menuHasChildrenSubMenu[j].style.display = 'none'; } } var menu_class = this.getAttribute('class') || ''; if ( menu_class.indexOf('main-header-menu-toggle') !== -1 ) { astraToggleClass(__main_header_all[event_index], 'toggle-on'); astraToggleClass(menu_toggle_all[event_index], 'toggled'); if (__main_header_all[event_index].classList.contains('toggle-on')) { __main_header_all[event_index].style.display = 'block'; document.body.classList.add("ast-main-header-nav-open"); } else { __main_header_all[event_index].style.display = ''; document.body.classList.remove("ast-main-header-nav-open"); } } }; document.body.addEventListener("astra-header-responsive-enabled", function () { var __main_header_all = document.querySelectorAll('.main-header-bar-navigation'); if (__main_header_all.length > 0) { for (var i = 0; i < __main_header_all.length; i++) { if (null != __main_header_all[i]) { __main_header_all[i].classList.remove('toggle-on'); __main_header_all[i].style.display = ''; } var sub_menu = __main_header_all[i].getElementsByClassName('sub-menu'); for (var j = 0; j < sub_menu.length; j++) { sub_menu[j].style.display = ''; } var child_menu = __main_header_all[i].getElementsByClassName('children'); for (var k = 0; k < child_menu.length; k++) { child_menu[k].style.display = ''; } var searchIcons = __main_header_all[i].getElementsByClassName('ast-search-menu-icon'); for (var l = 0; l < searchIcons.length; l++) { searchIcons[l].classList.remove('ast-dropdown-active'); searchIcons[l].style.display = ''; } } } }, false); window.addEventListener('resize', function () { // Skip resize event when keyboard display event triggers on devices. if( 'INPUT' !== document.activeElement.tagName ) { updateHeaderBreakPoint(); AstraToggleSetup(); } }); document.addEventListener('DOMContentLoaded', function () { AstraToggleSetup(); /** * Navigation Keyboard Navigation. */ var container, count; container = document.querySelectorAll( '.navigation-accessibility' ); for ( count = 0; count <= container.length - 1; count++ ) { if ( container[count] ) { navigation_accessibility( container[count] ); } } }); var get_browser = function () { var ua = navigator.userAgent,tem,M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; if(/trident/i.test(M[1])) { tem = /\brv[ :]+(\d+)/g.exec(ua) || []; return; } if( 'Chrome' === M[1] ) { tem = ua.match(/\bOPR|Edge\/(\d+)/) if(tem != null) { return; } } M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; if((tem = ua.match(/version\/(\d+)/i)) != null) { M.splice(1,1,tem[1]); } var bodyElement = document.body; if( 'Safari' === M[0] && M[1] < 11 ) { bodyElement.classList.add( "ast-safari-browser-less-than-11" ); } } get_browser(); /* Search Script */ var SearchIcons = document.getElementsByClassName( 'astra-search-icon' ); for (var i = 0; i < SearchIcons.length; i++) { SearchIcons[i].onclick = function(event) { if ( this.classList.contains( 'slide-search' ) ) { event.preventDefault(); var sibling = this.parentNode.parentNode.parentNode.querySelector( '.ast-search-menu-icon' ); if ( ! sibling.classList.contains( 'ast-dropdown-active' ) ) { sibling.classList.add( 'ast-dropdown-active' ); sibling.querySelector( '.search-field' ).setAttribute('autocomplete','off'); setTimeout(function() { sibling.querySelector( '.search-field' ).focus(); },200); } else { var searchTerm = sibling.querySelector( '.search-field' ).value || ''; if( '' !== searchTerm ) { sibling.querySelector( '.search-form' ).submit(); } sibling.classList.remove( 'ast-dropdown-active' ); } } } } /* Hide Dropdown on body click*/ document.body.onclick = function( event ) { if ( typeof event.target.classList !== 'undefined' ) { if ( ! event.target.classList.contains( 'ast-search-menu-icon' ) && astraGetParents( event.target, '.ast-search-menu-icon' ).length === 0 && astraGetParents( event.target, '.ast-search-icon' ).length === 0 ) { var dropdownSearchWrap = document.getElementsByClassName( 'ast-search-menu-icon' ); for (var i = 0; i < dropdownSearchWrap.length; i++) { dropdownSearchWrap[i].classList.remove( 'ast-dropdown-active' ); } } } } /** * Navigation Keyboard Navigation. */ function navigation_accessibility( container ) { if ( ! container ) { return; } var button = container.getElementsByTagName( 'button' )[0]; if ( 'undefined' === typeof button ) { button = container.getElementsByTagName( 'a' )[0]; if ( 'undefined' === typeof button ) { return; } } var menu = container.getElementsByTagName( 'ul' )[0]; // Hide menu toggle button if menu is empty and return early. if ( 'undefined' === typeof menu ) { button.style.display = 'none'; return; } menu.setAttribute( 'aria-expanded', 'false' ); if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { menu.className += ' nav-menu'; } button.onclick = function() { if ( -1 !== container.className.indexOf( 'toggled' ) ) { container.className = container.className.replace( ' toggled', '' ); button.setAttribute( 'aria-expanded', 'false' ); menu.setAttribute( 'aria-expanded', 'false' ); } else { container.className += ' toggled'; button.setAttribute( 'aria-expanded', 'true' ); menu.setAttribute( 'aria-expanded', 'true' ); } }; // Get all the link elements within the menu. var links = menu.getElementsByTagName( 'a' ); var subMenus = menu.getElementsByTagName( 'ul' ); // Set menu items with submenus to aria-haspopup="true". for ( var i = 0, len = subMenus.length; i < len; i++ ) { subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); } // Each time a menu link is focused or blurred, toggle focus. for ( i = 0, len = links.length; i < len; i++ ) { links[i].addEventListener( 'focus', toggleFocus, true ); links[i].addEventListener( 'blur', toggleBlurFocus, true ); links[i].addEventListener( 'click', toggleClose, true ); } } /** * Close the Toggle Menu on Click on hash (#) link. * * @since 1.3.2 * @return void */ function toggleClose( ) { var self = this || '', hash = '#'; if( self && ! self.classList.contains('astra-search-icon') ) { var link = new String( self ); if( link.indexOf( hash ) !== -1 ) { var link_parent = self.parentNode; if ( document.body.classList.contains('ast-header-break-point') && ! ( document.querySelector("header.site-header").classList.contains("ast-menu-toggle-link") && link_parent.classList.contains("menu-item-has-children") ) ) { /* Close Main Header Menu */ var main_header_menu_toggle = document.querySelector( '.main-header-menu-toggle' ); main_header_menu_toggle.classList.remove( 'toggled' ); var main_header_bar_navigation = document.querySelector( '.main-header-bar-navigation' ); main_header_bar_navigation.classList.remove( 'toggle-on' ); main_header_bar_navigation.style.display = 'none'; /* Close Below Header Menu */ var before_header_menu_toggle = document.querySelector( '.menu-below-header-toggle' ); var before_header_bar_navigation = document.querySelector( '.ast-below-header' ); var before_header_bar = document.querySelector( '.ast-below-header-actual-nav' ); if ( before_header_menu_toggle && before_header_bar_navigation && before_header_bar ) { before_header_menu_toggle.classList.remove( 'toggled' ); before_header_bar_navigation.classList.remove( 'toggle-on' ); before_header_bar.style.display = 'none'; } /* Close After Header Menu */ var after_header_menu_toggle = document.querySelector( '.menu-above-header-toggle' ); var after_header_bar_navigation = document.querySelector( '.ast-above-header' ); var after_header_bar = document.querySelector( '.ast-above-header-navigation' ); if ( after_header_menu_toggle && after_header_bar_navigation && after_header_bar ) { after_header_menu_toggle.classList.remove( 'toggled' ); after_header_bar_navigation.classList.remove( 'toggle-on' ); after_header_bar.style.display = 'none'; } astraTriggerEvent( document.querySelector('body'), 'astraMenuHashLinkClicked' ); } else { while ( -1 === self.className.indexOf( 'nav-menu' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { if ( -1 !== self.className.indexOf( 'focus' ) ) { self.className = self.className.replace( ' focus', '' ); } } self = self.parentElement; } } } } } /** * Sets or removes .focus class on an element and its ancestors until a specific class is found. * @param {Element} element - The element to apply the .focus class and traverse its ancestors. * @param {string} targetClass - The class name to search for in the ancestors. */ function toggleFocusAndAncestors(element, targetClass) { while (-1 === element.className.indexOf(targetClass)) { if ('li' === element.tagName.toLowerCase()) { if (element.classList.contains('focus')) { element.classList.remove('focus'); } else { element.classList.add('focus'); } } element = element.parentElement; } } /** * Sets or removes .focus class on an element on focus. */ function toggleFocus() { var self = this; toggleFocusAndAncestors(self, 'nav-menu'); } /** * Sets or removes .focus class on an element on blur. */ function toggleBlurFocus() { var self = this || '', hash = '#'; var link = String(self); if (link.includes(hash) && document.body.classList.contains('ast-mouse-clicked')) { return; } toggleFocusAndAncestors(self, 'nav-menu'); } /* Add class if mouse clicked and remove if tab pressed */ if ( 'querySelector' in document && 'addEventListener' in window ) { var body = document.body; body.addEventListener( 'mousedown', function() { body.classList.add( 'ast-mouse-clicked' ); } ); body.addEventListener( 'keydown', function() { body.classList.remove( 'ast-mouse-clicked' ); } ); } /** * Scroll to specific hash link. * * @since x.x.x */ if ( astra.is_scroll_to_id ) { const links = document.querySelectorAll('a[href*="#"]:not([href="#"]):not([href="#0"]):not([href*="uagb-tab"])'); if (links) { for (const link of links) { if (link.hash !== "") { link.addEventListener("click", scrollToIDHandler); } } } function scrollToIDHandler(e) { let offset = 0; const siteHeader = document.querySelector('.site-header'); if (siteHeader) { //Check and add offset to scroll top if header is sticky. const headerHeight = siteHeader.querySelectorAll('div[data-stick-support]'); if (headerHeight) { headerHeight.forEach(single => { offset += single.clientHeight; }); } const href = this.hash; if (href) { const scrollId = document.querySelector(href); if (scrollId) { const scrollOffsetTop = scrollId.offsetTop - offset; if( scrollOffsetTop ) { astraSmoothScroll( e, scrollOffsetTop ); } } } } } } /** * Scroll to top. * * @since x.x.x */ if ( astra.is_scroll_to_top ) { var masthead = document.querySelector( '#page header' ); var astScrollTop = document.getElementById( 'ast-scroll-top' ); astScrollToTopHandler(masthead, astScrollTop); window.addEventListener('scroll', function () { astScrollToTopHandler(masthead, astScrollTop); }); astScrollTop.onclick = function(e){ astraSmoothScroll( e, 0 ); }; } } )(); customizer-preview.js 0000666 00000301117 15165371455 0011010 0 ustar 00 /** * This file adds some LIVE to the Theme Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra */ /** * Generate font size in PX & REM */ function astra_font_size_rem( size, with_rem, device ) { var css = ''; if( size != '' ) { var device = ( typeof device != undefined ) ? device : 'desktop'; // font size with 'px'. css = 'font-size: ' + size + 'px;'; // font size with 'rem'. if ( with_rem ) { var body_font_size = wp.customize( 'astra-settings[font-size-body]' ).get(); body_font_size['desktop'] = ( body_font_size['desktop'] != '' ) ? body_font_size['desktop'] : 15; body_font_size['tablet'] = ( body_font_size['tablet'] != '' ) ? body_font_size['tablet'] : body_font_size['desktop']; body_font_size['mobile'] = ( body_font_size['mobile'] != '' ) ? body_font_size['mobile'] : body_font_size['tablet']; css += 'font-size: ' + ( size / body_font_size[device] ) + 'rem;'; } } return css; } /** * Apply CSS for the element */ function astra_color_responsive_css( addon, control, css_property, selector ) { wp.customize( control, function( value ) { value.bind( function( value ) { if ( value.desktop || value.mobile || value.tablet ) { // Remove <style> first! control = control.replace( '[', '-' ); control = control.replace( ']', '' ); jQuery( 'style#' + control + '-' + addon ).remove(); var DeskVal = '', TabletFontVal = '', MobileVal = ''; if ( '' != value.desktop ) { DeskVal = css_property + ': ' + value.desktop; } if ( '' != value.tablet ) { TabletFontVal = css_property + ': ' + value.tablet; } if ( '' != value.mobile ) { MobileVal = css_property + ': ' + value.mobile; } // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '-' + addon + '">' + selector + ' { ' + DeskVal + ' }' + '@media (max-width: 768px) {' + selector + ' { ' + TabletFontVal + ' } }' + '@media (max-width: 544px) {' + selector + ' { ' + MobileVal + ' } }' + '</style>' ); } else { jQuery( 'style#' + control + '-' + addon ).remove(); } } ); } ); } /** * Responsive Font Size CSS */ function astra_responsive_font_size( control, selector ) { wp.customize( control, function( value ) { value.bind( function( value ) { if ( value.desktop || value.mobile || value.tablet ) { // Remove <style> first! control = control.replace( '[', '-' ); control = control.replace( ']', '' ); var fontSize = '', tabletFontSize = '', mobileFontSize = '', css_property = 'font-size'; jQuery( 'style#' + control + '-' + css_property ).remove(); if ( '' != value.desktop ) { fontSize = 'font-size: ' + value.desktop + ( undefined == value['desktop-unit'] ? 'px' : value['desktop-unit'] ); } if ( '' != value.tablet ) { tabletFontSize = 'font-size: ' + value.tablet + ( undefined == value['tablet-unit'] ? 'px' : value['tablet-unit'] ); } if ( '' != value.mobile ) { mobileFontSize = 'font-size: ' + value.mobile + ( undefined == value['mobile-unit'] ? 'px' : value['mobile-unit'] ); } if( value['desktop-unit'] == 'px' ) { fontSize = astra_font_size_rem( value.desktop, true, 'desktop' ); } // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '-' + css_property + '">' + selector + ' { ' + fontSize + ' }' + '@media (max-width: 768px) {' + selector + ' { ' + tabletFontSize + ' } }' + '@media (max-width: 544px) {' + selector + ' { ' + mobileFontSize + ' } }' + '</style>' ); } else { jQuery( 'style#' + control + '-font-size' ).remove(); } } ); } ); } /** * Font extras control dynamic CSS. * * @since x.x.x */ function astra_font_extras_css( control, selector ) { wp.customize( 'astra-settings[' + control + ']', function( value ) { value.bind( function( data ) { if ( data ) { // Remove <style> first! jQuery( 'style#' + control ).remove(); let dynamicStyle = selector + ' { line-height : ' + data['line-height'] + data['line-height-unit'] + ";"; dynamicStyle += 'letter-spacing : ' + data['letter-spacing'] + data['letter-spacing-unit'] + ";" ; dynamicStyle += 'text-decoration : ' + data['text-decoration'] + ";"; dynamicStyle += 'text-transform : ' + data['text-transform'] + ';}' ; // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '">' + dynamicStyle + '</style>' ); } else { jQuery( 'style#' + control ).remove(); } } ); } ); } /** * Responsive Spacing CSS */ function astra_responsive_spacing( control, selector, type, side ) { wp.customize( control, function( value ) { value.bind( function( value ) { var sidesString = ""; var spacingType = "padding"; if ( value.desktop.top || value.desktop.right || value.desktop.bottom || value.desktop.left || value.tablet.top || value.tablet.right || value.tablet.bottom || value.tablet.left || value.mobile.top || value.mobile.right || value.mobile.bottom || value.mobile.left ) { if ( typeof side != undefined ) { sidesString = side + ""; // Replace comma character with dash, necessary to separate out spacing dimensions. sidesString = sidesString.replace(/,/g , "-"); } if ( typeof type != undefined ) { spacingType = type + ""; } // Remove <style> first! control = control.replace( '[', '-' ); control = control.replace( ']', '' ); jQuery( 'style#' + control + '-' + spacingType + '-' + sidesString ).remove(); var desktopPadding = '', tabletPadding = '', mobilePadding = ''; var paddingSide = ( typeof side != undefined ) ? side : [ 'top','bottom','right','left' ]; jQuery.each(paddingSide, function( index, sideValue ){ if ( '' != value['desktop'][sideValue] ) { desktopPadding += spacingType + '-' + sideValue +': ' + value['desktop'][sideValue] + value['desktop-unit'] +';'; } }); jQuery.each(paddingSide, function( index, sideValue ){ if ( '' != value['tablet'][sideValue] ) { tabletPadding += spacingType + '-' + sideValue +': ' + value['tablet'][sideValue] + value['tablet-unit'] +';'; } }); jQuery.each(paddingSide, function( index, sideValue ){ if ( '' != value['mobile'][sideValue] ) { mobilePadding += spacingType + '-' + sideValue +': ' + value['mobile'][sideValue] + value['mobile-unit'] +';'; } }); // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '-' + spacingType + '-' + sidesString + '">' + selector + ' { ' + desktopPadding +' }' + '@media (max-width: 768px) {' + selector + ' { ' + tabletPadding + ' } }' + '@media (max-width: 544px) {' + selector + ' { ' + mobilePadding + ' } }' + '</style>' ); } else { wp.customize.preview.send( 'refresh' ); jQuery( 'style#' + control + '-' + spacingType + '-' + sidesString ).remove(); } } ); } ); } /** * CSS */ function astra_css_font_size( control, selector ) { wp.customize( control, function( value ) { value.bind( function( size ) { if ( size ) { // Remove <style> first! control = control.replace( '[', '-' ); control = control.replace( ']', '' ); jQuery( 'style#' + control ).remove(); var fontSize = 'font-size: ' + size; if ( ! isNaN( size ) || size.indexOf( 'px' ) >= 0 ) { size = size.replace( 'px', '' ); fontSize = astra_font_size_rem( size, true ); } // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '">' + selector + ' { ' + fontSize + ' }' + '</style>' ); } else { jQuery( 'style#' + control ).remove(); } } ); } ); } /** * Return get_hexdec() */ function get_hexdec( hex ) { var hexString = hex.toString( 16 ); return parseInt( hexString, 16 ); } /** * Apply CSS for the element */ function astra_css( control, css_property, selector, unit, important = false ) { wp.customize( control, function( value ) { value.bind( function( new_value ) { // Remove <style> first! control = control.replace( '[', '-' ); control = control.replace( ']', '' ); if ( new_value || 0 === new_value ) { /** * If ( unit == 'url' ) then = url('{VALUE}') * If ( unit == 'px' ) then = {VALUE}px * If ( unit == 'em' ) then = {VALUE}em * If ( unit == 'rem' ) then = {VALUE}rem. */ if ( 'undefined' != typeof unit) { if ( 'url' === unit ) { new_value = 'url(' + new_value + ')'; } else { new_value = new_value + unit; } } const imp_css_prop = important ? ' !important' : ''; // Remove old. jQuery( 'style#' + control + '-' + css_property ).remove(); // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '-' + css_property + '">' + selector + ' { ' + css_property + ': ' + new_value + imp_css_prop + ' }' + '</style>' ); if( 'unset' === new_value ){ jQuery( 'style#' + control + '-' + css_property ).remove(); } } else { // Remove old. jQuery( 'style#' + control + '-' + css_property ).remove(); } } ); } ); } /** * Dynamic Internal/Embedded Style for a Control */ function astra_add_dynamic_css( control, style ) { control = control.replace( '[', '-' ); control = control.replace( ']', '' ); jQuery( 'style#' + control ).remove(); jQuery( 'head' ).append( '<style id="' + control + '">' + style + '</style>' ); } /** * Generate background_obj CSS */ function astra_background_obj_css( wp_customize, bg_obj, ctrl_name, style ) { var gen_bg_css = ''; var bg_img = bg_obj['background-image']; var bg_color = bg_obj['background-color']; if( '' === bg_color && '' === bg_img ) { jQuery( 'style#' + ctrl_name ).remove(); }else{ if( undefined !== bg_obj['background-type'] && '' !== bg_obj['background-type'] ) { if ( ( 'color' === bg_obj['background-type'] ) ) { if ( '' !== bg_img && '' !== bg_color && undefined !== bg_color && 'unset' !== bg_color ) { gen_bg_css = 'background-image: linear-gradient(to right, ' + bg_color + ', ' + bg_color + '), url(' + bg_img + ');'; } else if ( undefined === bg_img || '' === bg_img || 'unset' === bg_img ) { gen_bg_css = 'background-color: ' + bg_color + ';'; } } else if ( 'image' === bg_obj['background-type'] ) { if ( '' !== bg_img ) { if ( 'overlay-type' in bg_obj && 'none' !== bg_obj['overlay-type'] ) { let overlay_color = 'overlay-color' in bg_obj ? bg_obj['overlay-color'] : ''; let overlay_gradient = 'overlay-gradient' in bg_obj ? bg_obj['overlay-gradient'] : ''; if ( 'classic' === bg_obj['overlay-type'] && '' !== overlay_color ) { gen_bg_css = 'background-image: linear-gradient(to right, ' + bg_obj['overlay-color'] + ', ' + bg_obj['overlay-color'] + '), url(' + bg_img + ');'; } else if ( 'gradient' === bg_obj['overlay-type'] && '' !== overlay_gradient ) { gen_bg_css = 'background-image: ' + overlay_gradient + ', url(' + bg_img + ');'; } else { gen_bg_css = 'background-image: url(' + bg_img + ');'; } } else { gen_bg_css = 'background-image: url(' + bg_img + ');'; } } } else if ( 'gradient' === bg_obj['background-type'] ) { if ( '' !== bg_color && 'unset' !== bg_color ) { gen_bg_css = 'background-image: ' + bg_color + ';'; } } } if ( '' !== bg_img ) { gen_bg_css += 'background-repeat: ' + bg_obj['background-repeat'] + ';'; gen_bg_css += 'background-position: ' + bg_obj['background-position'] + ';'; gen_bg_css += 'background-size: ' + bg_obj['background-size'] + ';'; gen_bg_css += 'background-attachment: ' + bg_obj['background-attachment'] + ';'; } var dynamicStyle = style.replace( "{{css}}", gen_bg_css ); astra_add_dynamic_css( ctrl_name, dynamicStyle ); } } /* * Generate Font Family CSS */ function astra_generate_outside_font_family_css( control, selector ) { wp.customize( control, function (value) { value.bind( function ( value, oldValue ) { var cssProperty = 'font-family'; var link = ''; var fontName = value.split(",")[0]; // Replace ' character with space, necessary to separate out font prop value. fontName = fontName.replace(/'/g, ''); // Remove <style> first! control = control.replace( '[', '-' ); control = control.replace( ']', '' ); jQuery('style#' + control + '-' + cssProperty ).remove(); if ( fontName in astraCustomizer.googleFonts ) { // Remove old. var fontName = fontName.split(' ').join('+'); jQuery('link#' + control).remove(); link = '<link id="' + control + '" href="https://fonts.googleapis.com/css?family=' + fontName + '" rel="stylesheet">'; } // Concat and append new <style> and <link>. jQuery('head').append( '<style id="' + control + '-' + cssProperty + '">' + selector + ' { ' + cssProperty + ': ' + value + ' }' + '</style>' + link ); }); }); } /* * Generate Font Weight CSS */ function astra_generate_font_weight_css( font_control, control, css_property, selector ) { wp.customize( control, function( value ) { value.bind( function( new_value ) { control = control.replace( '[', '-' ); control = control.replace( ']', '' ); var link = ''; if ( new_value ) { /** * If ( unit == 'url' ) then = url('{VALUE}') * If ( unit == 'px' ) then = {VALUE}px * If ( unit == 'em' ) then = {VALUE}em * If ( unit == 'rem' ) then = {VALUE}rem. */ if ( 'undefined' != typeof unit) { if ( 'url' === unit ) { new_value = 'url(' + new_value + ')'; } else { new_value = new_value + unit; } } var fontName = wp.customize._value[font_control]._value; fontName = fontName.split(','); fontName = fontName[0].replace( /'/g, '' ); // Remove old. jQuery( 'style#' + control + '-' + css_property ).remove(); if ( fontName in astraCustomizer.googleFonts ) { // Remove old. jQuery('#' + font_control).remove(); if( new_value === "inherit" ) { link = '<link id="' + font_control + '" href="https://fonts.googleapis.com/css?family=' + fontName + '" rel="stylesheet">'; } else { link = '<link id="' + font_control + '" href="https://fonts.googleapis.com/css?family=' + fontName + '%3A' + new_value + '" rel="stylesheet">'; } } // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '-' + css_property + '">' + selector + ' { ' + css_property + ': ' + new_value + ' }' + '</style>' + link ); } else { // Remove old. jQuery( 'style#' + control ).remove(); } } ); }); } /** * Apply CSS for the element */ function astra_apply_responsive_background_css( control, selector, device, singleColorSelector, addon ) { wp.customize( control, function( value ) { value.bind( function( bg_obj ) { addon = addon || ''; singleColorSelector = singleColorSelector || ''; addon = ( addon ) ? addon : 'header'; control = control.replace( '[', '-' ); control = control.replace( ']', '' ); if( '' === bg_obj[device] || undefined === bg_obj[device] ){ return; } var gen_bg_css = ''; var bg_img = bg_obj[device]['background-image']; var bg_tab_img = bg_obj['tablet']['background-image']; var bg_desk_img = bg_obj['desktop']['background-image']; var bg_color = bg_obj[device]['background-color']; var tablet_css = ( bg_obj['tablet']['background-image'] ) ? true : false; var desktop_css = ( bg_obj['desktop']['background-image'] ) ? true : false; if( undefined !== bg_obj[device]['background-type'] && '' !== bg_obj[device]['background-type'] ) { if ( ( 'color' === bg_obj[device]['background-type'] ) ) { if ( '' !== bg_img && '' !== bg_color && undefined !== bg_color && 'unset' !== bg_color ) { gen_bg_css = 'background-image: linear-gradient(to right, ' + bg_color + ', ' + bg_color + '), url(' + bg_img + ');'; } else if ( 'mobile' === device ) { if ( desktop_css ) { gen_bg_css = 'background-image: linear-gradient(to right, ' + bg_color + ', ' + bg_color + '), url(' + bg_desk_img + ');'; } else if ( tablet_css ) { gen_bg_css = 'background-image: linear-gradient(to right, ' + bg_color + ', ' + bg_color + '), url(' + bg_tab_img + ');'; } else { gen_bg_css = 'background-color: ' + bg_color + ';'; gen_bg_css += 'background-image: none;'; } } else if ( 'tablet' === device ) { if ( desktop_css ) { gen_bg_css = 'background-image: linear-gradient(to right, ' + bg_color + ', ' + bg_color + '), url(' + bg_desk_img + ');'; } else { gen_bg_css = 'background-color: ' + bg_color + ';'; gen_bg_css += 'background-image: none;'; } } else if ( undefined === bg_img || '' === bg_img ) { gen_bg_css = 'background-color: ' + bg_color + ';'; gen_bg_css += 'background-image: none;'; } } else if ( 'image' === bg_obj[device]['background-type'] ) { if ( '' !== bg_img ) { if ( undefined !== bg_obj[device]['overlay-type'] && 'none' !== bg_obj[device]['overlay-type'] ) { let overlay_color = undefined !== bg_obj[device]['overlay-color'] ? bg_obj[device]['overlay-color'] : ''; let overlay_gradient = undefined !== bg_obj[device]['overlay-gradient'] ? bg_obj[device]['overlay-gradient'] : ''; if ( 'classic' === bg_obj[device]['overlay-type'] && '' !== overlay_color ) { gen_bg_css = 'background-image: linear-gradient(to right, ' + overlay_color + ', ' + overlay_color + '), url(' + bg_img + ');'; } else if ( 'gradient' === bg_obj[device]['overlay-type'] && '' !== overlay_gradient ) { gen_bg_css = 'background-image: ' + overlay_gradient + ', url(' + bg_img + ');'; } else { gen_bg_css = 'background-image: url(' + bg_img + ');'; } } else { gen_bg_css = 'background-image: url(' + bg_img + ');'; } } } else if ( 'gradient' === bg_obj[device]['background-type'] ) { if ( '' !== bg_color && 'unset' !== bg_color ) { gen_bg_css = 'background-image: ' + bg_color + ';'; } } } if ( '' !== bg_img ) { gen_bg_css += 'background-repeat: ' + bg_obj[device]['background-repeat'] + ';'; gen_bg_css += 'background-position: ' + bg_obj[device]['background-position'] + ';'; gen_bg_css += 'background-size: ' + bg_obj[device]['background-size'] + ';'; gen_bg_css += 'background-attachment: ' + bg_obj[device]['background-attachment'] + ';'; } // Remove old. jQuery( 'style#' + control + '-' + device + '-' + addon ).remove(); if ( 'desktop' == device ) { var dynamicStyle = '<style id="' + control + '-' + device + '-' + addon + '">' + selector + ' { ' + gen_bg_css + ' }' + '</style>' } if ( 'tablet' == device ) { var dynamicStyle = '<style id="' + control + '-' + device + '-' + addon + '">' + '@media (max-width: 768px) {' + selector + ' { ' + gen_bg_css + ' } }' + '</style>' } if ( 'mobile' == device ) { var dynamicStyle = '<style id="' + control + '-' + device + '-' + addon + '">' + '@media (max-width: 544px) {' + selector + ' { ' + gen_bg_css + ' } }' + '</style>' } // Concat and append new <style>. jQuery( 'head' ).append( dynamicStyle ); }); }); } function getChangedKey( value, other ) { value = isJsonString(value) ? JSON.parse(value) : value; other = isJsonString(other) ? JSON.parse(other) : other; // Compare two items var compare = function ( item1, item2 ) { // Get the object type var itemType = Object.prototype.toString.call(item1); // If an object or array, compare recursively if (['[object Array]', '[object Object]'].indexOf(itemType) >= 0) { if ('string' == typeof getChangedKey(item1, item2)) { return false; } } // Otherwise, do a simple comparison else { // If the two items are not the same type, return false if (itemType !== Object.prototype.toString.call(item2)) return false; // Else if it's a function, convert to a string and compare // Otherwise, just compare if (itemType === '[object Function]') { if (item1.toString() !== item2.toString()) return false; } else { if (item1 !== item2) return false; } } }; for ( var key in value ) { if ( other.hasOwnProperty(key) && value.hasOwnProperty(key) ) { if ( compare( value[key], other[key] ) === false ) return key; } else { return key; } } // If nothing failed, return true return true; } function isJsonString( str ) { try { JSON.parse(str); } catch (e) { return false; } return true; } function hasWordPressWidgetBlockEditor() { return astraCustomizer.has_block_editor_support || false; } ( function( $ ) { /* * Site Identity Logo Width */ wp.customize( 'astra-settings[ast-header-responsive-logo-width]', function( setting ) { setting.bind( function( logo_width ) { if ( logo_width['desktop'] != '' || logo_width['tablet'] != '' || logo_width['mobile'] != '' ) { var dynamicStyle = '#masthead .site-logo-img .custom-logo-link img { max-width: ' + logo_width['desktop'] + 'px; } @media( max-width: 768px ) { #masthead .site-logo-img .custom-logo-link img { max-width: ' + logo_width['tablet'] + 'px; } #masthead .site-logo-img img { max-height: ' + logo_width['tablet'] + 'px; } } @media( max-width: 544px ) { .ast-header-break-point .site-branding img, .ast-header-break-point #masthead .site-logo-img .custom-logo-link img { max-width: ' + logo_width['mobile'] + 'px; }' + '#masthead .site-logo-img img { max-height: ' + logo_width['mobile'] + 'px; } .astra-logo-svg{width: ' + logo_width['mobile'] + 'px !important; } }'; astra_add_dynamic_css( 'ast-header-responsive-logo-width', dynamicStyle ); var mobileLogoStyle = '.ast-header-break-point #masthead .site-logo-img .custom-mobile-logo-link img { max-width: ' + logo_width['tablet'] + 'px; } @media( max-width: 768px ) { .ast-header-break-point #masthead .site-logo-img .custom-mobile-logo-link img { max-width: ' + logo_width['tablet'] + 'px; } @media( max-width: 544px ) { .ast-header-break-point #masthead .site-logo-img .custom-mobile-logo-link img { max-width: ' + logo_width['mobile'] + 'px; }'; astra_add_dynamic_css( 'mobile-header-logo-width', mobileLogoStyle ); } else{ wp.customize.preview.send( 'refresh' ); } } ); } ); /* * Responsive Logo Visibility */ wp.customize( 'astra-settings[display-site-title-responsive]', function( setting ) { setting.bind( function( logo_visibility ) { var desktopTitleVisibility = ( logo_visibility['desktop'] ) ? 'block' : 'none'; var tabletTitleVisibility = ( logo_visibility['tablet'] ) ? 'block' : 'none'; var mobileTitleVisibility = ( logo_visibility['mobile'] ) ? 'block' : 'none'; var tabletBreakPoint = astraBuilderPreview.tablet_break_point || 768, mobileBreakPoint = astraBuilderPreview.mobile_break_point || 544; var dynamicStyle = '.ast-site-title-wrap .site-title { display: ' + desktopTitleVisibility + ';} @media( max-width: ' + tabletBreakPoint + 'px) { .ast-site-title-wrap .site-title { display: ' + tabletTitleVisibility + ';} } @media( max-width: ' + mobileBreakPoint + 'px) { .ast-site-title-wrap .site-title { display: ' + mobileTitleVisibility + ';} }'; astra_add_dynamic_css( 'display-site-title-responsive', dynamicStyle ); } ); } ); /* * Responsive Tagline Visibility */ wp.customize( 'astra-settings[display-site-tagline-responsive]', function( setting ) { setting.bind( function( tagline_visibility ) { var desktopTaglineVisibility = ( tagline_visibility['desktop'] ) ? 'block' : 'none'; var tabletTaglineVisibility = ( tagline_visibility['tablet'] ) ? 'block' : 'none'; var mobileTaglineVisibility = ( tagline_visibility['mobile'] ) ? 'block' : 'none'; var tabletBreakPoint = astraBuilderPreview.tablet_break_point || 768, mobileBreakPoint = astraBuilderPreview.mobile_break_point || 544; var dynamicStyle = '.ast-site-title-wrap .site-description { display: ' + desktopTaglineVisibility + ';} @media( max-width: ' + tabletBreakPoint + 'px) { .ast-site-title-wrap .site-description { display: ' + tabletTaglineVisibility + ';} } @media( max-width: ' + mobileBreakPoint + 'px) { .ast-site-title-wrap .site-description { display: ' + mobileTaglineVisibility + ';} }'; astra_add_dynamic_css( 'display-site-tagline-responsive', dynamicStyle ); } ); } ); /* * Full width layout */ wp.customize( 'astra-settings[site-content-width]', function( setting ) { setting.bind( function( width ) { var dynamicStyle = '@media (min-width: 554px) {'; dynamicStyle += '.ast-container, .fl-builder #content .entry-header { max-width: ' + ( 40 + parseInt( width ) ) + 'px } '; dynamicStyle += '}'; if ( jQuery( 'body' ).hasClass( 'ast-page-builder-template' ) ) { dynamicStyle += '@media (min-width: 554px) {'; dynamicStyle += '.ast-page-builder-template .comments-area { max-width: ' + ( 40 + parseInt( width ) ) + 'px } '; dynamicStyle += '}'; } astra_add_dynamic_css( 'site-content-width', dynamicStyle ); } ); } ); /* * Full width layout */ wp.customize( 'astra-settings[header-main-menu-label]', function( setting ) { setting.bind( function( label ) { if( $('button.main-header-menu-toggle .mobile-menu-wrap .mobile-menu').length > 0 ) { if ( label != '' ) { $('button.main-header-menu-toggle .mobile-menu-wrap .mobile-menu').text(label); } else { $('button.main-header-menu-toggle .mobile-menu-wrap').remove(); } } else { var html = $('button.main-header-menu-toggle').html(); if( '' != label ) { html += '<div class="mobile-menu-wrap"><span class="mobile-menu">'+ label +'</span> </div>'; } $('button.main-header-menu-toggle').html( html ) } } ); } ); /** * Apply content bg responsive css with specified selector. * @param {string} selector * @returns {void} */ const apply_content_bg = ( selector ) => { astra_apply_responsive_background_css( 'astra-settings[content-bg-obj-responsive]', selector, 'desktop' ); astra_apply_responsive_background_css( 'astra-settings[content-bg-obj-responsive]', selector, 'tablet' ); astra_apply_responsive_background_css( 'astra-settings[content-bg-obj-responsive]', selector, 'mobile' ); } /* * Layout Body Background */ astra_apply_responsive_background_css( 'astra-settings[site-layout-outside-bg-obj-responsive]', 'body, .ast-separate-container', 'desktop' ); astra_apply_responsive_background_css( 'astra-settings[site-layout-outside-bg-obj-responsive]', 'body, .ast-separate-container', 'tablet' ); astra_apply_responsive_background_css( 'astra-settings[site-layout-outside-bg-obj-responsive]', 'body, .ast-separate-container', 'mobile' ); if( astraCustomizer.is_content_bg_option_to_load ) { var content_layout = astraCustomizer.content_layout; var site_layout = astraCustomizer.site_layout; var blog_grid = (typeof ( wp.customize._value['astra-settings[blog-grid]'] ) != 'undefined') ? wp.customize._value['astra-settings[blog-grid]']._value : 1; var blog_layout = (typeof ( wp.customize._value['astra-settings[blog-layout]'] ) != 'undefined') ? wp.customize._value['astra-settings[blog-layout]']._value : 'blog-layout-1'; var dynamicSelector = '.ast-separate-container .ast-article-single:not(.ast-related-post), .ast-separate-container .comments-area .comment-respond,.ast-separate-container .comments-area .ast-comment-list li, .ast-separate-container .ast-woocommerce-container, .ast-separate-container .error-404, .ast-separate-container .no-results, .single.ast-separate-container .site-main .ast-author-meta, .ast-separate-container .related-posts, .ast-separate-container .comments-count-wrapper, .ast-separate-container .comments-area .comments-title, .ast-single-related-posts-container, .ast-plain-container, .ast-narrow-container .site-content'; if( 'blog-layout-1' == blog_layout && 1 != blog_grid ) { dynamicSelector += ', .ast-separate-container .blog-layout-1, .ast-separate-container .blog-layout-2, .ast-separate-container .blog-layout-3'; } else { dynamicSelector += ', .ast-separate-container .ast-article-post'; } /** * Content background color */ if( 'boxed-container' == content_layout ) { // Case: Container -> Boxed, Site-Layout -> Any. dynamicSelector += ', .ast-separate-container.ast-two-container #secondary .widget'; apply_content_bg(dynamicSelector); } else if ( 'content-boxed-container' == content_layout ) { // Case: Container -> Content-Boxed, Site-Layout -> Any. apply_content_bg(dynamicSelector); } else if ( astraCustomizer.apply_content_bg_fullwidth_layouts && ( 'ast-box-layout' === site_layout || 'ast-padded-layout' === site_layout ) && ( 'plain-container' === content_layout ) ) { // Case: Container -> FW Contained, Site-Layout -> Max, Padded. var fullWidthLayoutSelector = '.ast-box-layout.ast-plain-container .site-content, .ast-padded-layout.ast-plain-container .site-content'; apply_content_bg(fullWidthLayoutSelector); } else if ( astraCustomizer.apply_content_bg_fullwidth_layouts && ('plain-container' === content_layout ) ) { // Case: Container -> FW Contained, Site-Layout -> Full-Width, Theme default. dynamicSelector += ', .ast-plain-container .site-content'; apply_content_bg(dynamicSelector); } else if ( astraCustomizer.apply_content_bg_fullwidth_layouts && ( 'page-builder' == content_layout ) && ( 'ast-box-layout' !== site_layout && 'ast-padded-layout' !== site_layout ) ) { // Case: Container -> FW Stretched, Site-Layout -> Full-Width, Theme default. dynamicSelector += ', .ast-page-builder-template .site-content'; apply_content_bg(dynamicSelector); } else if ( 'narrow-container' == content_layout ) { // Case: Container -> Narrow, Site-Layout -> Any. dynamicSelector += ', .ast-narrow-container .site-content'; apply_content_bg(dynamicSelector); } } /* * Blog Custom Width */ wp.customize( 'astra-settings[blog-max-width]', function( setting ) { setting.bind( function( width ) { var dynamicStyle = '@media all and ( min-width: 921px ) {'; if ( ! jQuery( 'body' ).hasClass( 'ast-woo-shop-archive' ) ) { dynamicStyle += '.blog .site-content > .ast-container,.archive .site-content > .ast-container{ max-width: ' + ( parseInt( width ) ) + 'px } '; } if ( jQuery( 'body' ).hasClass( 'ast-fluid-width-layout' ) ) { dynamicStyle += '.blog .site-content > .ast-container,.archive .site-content > .ast-container{ padding-left:20px; padding-right:20px; } '; } dynamicStyle += '}'; astra_add_dynamic_css( 'blog-max-width', dynamicStyle ); } ); } ); /* * Single Blog Custom Width */ wp.customize( 'astra-settings[blog-single-max-width]', function( setting ) { setting.bind( function( width ) { var dynamicStyle = '@media all and ( min-width: 921px ) {'; dynamicStyle += '.single-post .site-content > .ast-container{ max-width: ' + ( 40 + parseInt( width ) ) + 'px } '; if ( jQuery( 'body' ).hasClass( 'ast-fluid-width-layout' ) ) { dynamicStyle += '.single-post .site-content > .ast-container{ padding-left:20px; padding-right:20px; } '; } dynamicStyle += '}'; astra_add_dynamic_css( 'blog-single-max-width', dynamicStyle ); } ); } ); /* * EDD Archive Custom Width */ wp.customize( 'astra-settings[edd-archive-max-width]', function( setting ) { setting.bind( function( width ) { var dynamicStyle = '.ast-edd-archive-page .site-content > .ast-container { max-width: ' + parseInt( width ) + 'px } '; astra_add_dynamic_css( 'edd-archive-max-width', dynamicStyle ); } ); } ); /** * Primary Width Option */ wp.customize( 'astra-settings[site-sidebar-width]', function( setting ) { setting.bind( function( width ) { if ( ! jQuery( 'body' ).hasClass( 'ast-no-sidebar' ) && width >= 15 && width <= 50 ) { var dynamicStyle = '@media (min-width: 769px) {'; dynamicStyle += '#primary { width: ' + ( 100 - parseInt( width ) ) + '% } '; dynamicStyle += '#secondary { width: ' + width + '% } '; dynamicStyle += '}'; astra_add_dynamic_css( 'site-sidebar-width', dynamicStyle ); } } ); } ); /** * Header Bottom Border */ wp.customize( 'astra-settings[header-main-sep]', function( setting ) { setting.bind( function( border ) { var dynamicStyle = 'body.ast-header-break-point .main-header-bar { border-bottom-width: ' + border + 'px }'; dynamicStyle += '.ast-desktop .main-header-bar {'; dynamicStyle += 'border-bottom-width: ' + border + 'px'; dynamicStyle += '}'; astra_add_dynamic_css( 'header-main-sep', dynamicStyle ); } ); } ); /** * Small Footer Top Border */ wp.customize( 'astra-settings[footer-sml-divider]', function( value ) { value.bind( function( border_width ) { jQuery( '.ast-small-footer' ).css( 'border-top-width', border_width + 'px' ); } ); } ); /** * Footer Widget Top Border */ wp.customize( 'astra-settings[footer-adv-border-width]', function( value ) { value.bind( function( border_width ) { jQuery( '.footer-adv .footer-adv-overlay' ).css( 'border-top-width', border_width + 'px' ); } ); } ); wp.customize( 'astra-settings[footer-adv-border-color]', function( value ) { value.bind( function( border_color ) { jQuery( '.footer-adv .footer-adv-overlay' ).css( 'border-top-color', border_color ); } ); } ); /** * Small Footer Top Border Color */ wp.customize( 'astra-settings[footer-sml-divider-color]', function( value ) { value.bind( function( border_color ) { jQuery( '.ast-small-footer' ).css( 'border-top-color', border_color ); } ); } ); // WooCommerce global button compatibility for new users only. const woo_btn_normal_sector = astraCustomizer.astra_woo_btn_global_compatibility ? ', .woocommerce a.button, .woocommerce .widget_price_filter .button, .woocommerce button.button, [CLASS*="wc-block"] button' : ''; const woo_btn_hover_sector = astraCustomizer.astra_woo_btn_global_compatibility ? ', .woocommerce a.button:hover, .woocommerce .widget_price_filter .button:hover, .woocommerce button.button:hover, [CLASS*="wc-block"] button:hover' : ''; /** * Button Border Radius Fields */ wp.customize( 'astra-settings[button-radius-fields]', function( setting ) { setting.bind( function( border ) { let tabletBreakPoint = astraBuilderPreview.tablet_break_point || 768, mobileBreakPoint = astraBuilderPreview.mobile_break_point || 544; let search_button_selector = hasWordPressWidgetBlockEditor() ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '' ; let lmsButtonSelectors = ', body #ld_course_list .btn, body a.btn-blue, body a.btn-blue:visited, body a#quiz_continue_link, body .btn-join, body .learndash_checkout_buttons input.btn-join[type="button"], body #btn-join, body .learndash_checkout_buttons input.btn-join[type="submit"], body .wpProQuiz_content .wpProQuiz_button2, a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large'; let globalSelector = '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button .wp-block-button__link' + lmsButtonSelectors + search_button_selector + woo_btn_normal_sector; if ( document.body.classList.contains('edd-page' ) ) { globalSelector += ', .ast-edd-site-header-cart .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a '; } let dynamicStyle = globalSelector + '{ border-top-left-radius :' + border['desktop']['top'] + border['desktop-unit'] + '; border-bottom-right-radius :' + border['desktop']['bottom'] + border['desktop-unit'] + '; border-bottom-left-radius :' + border['desktop']['left'] + border['desktop-unit'] + '; border-top-right-radius :' + border['desktop']['right'] + border['desktop-unit'] + '; } '; dynamicStyle += '@media (max-width: ' + tabletBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border['tablet']['top'] + border['tablet-unit'] + '; border-bottom-right-radius :' + border['tablet']['bottom'] + border['tablet-unit'] + '; border-bottom-left-radius :' + border['tablet']['left'] + border['tablet-unit'] + '; border-top-right-radius :' + border['tablet']['right'] + border['tablet-unit'] + '; } } '; dynamicStyle += '@media (max-width: ' + mobileBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border['mobile']['top'] + border['mobile-unit'] + '; border-bottom-right-radius :' + border['mobile']['bottom'] + border['mobile-unit'] + '; border-bottom-left-radius :' + border['mobile']['left'] + border['mobile-unit'] + '; border-top-right-radius :' + border['mobile']['right'] + border['mobile-unit'] + '; } } '; astra_add_dynamic_css( 'button-radius', dynamicStyle ); } ); } ); /** * Header Bottom Border width */ wp.customize( 'astra-settings[header-main-sep]', function( value ) { value.bind( function( border ) { var dynamicStyle = ' body.ast-header-break-point .main-header-bar { border-bottom-width: ' + border + 'px } '; dynamicStyle += '.ast-desktop .main-header-bar {'; dynamicStyle += 'border-bottom-width: ' + border + 'px'; dynamicStyle += '}'; astra_add_dynamic_css( 'header-main-sep', dynamicStyle ); } ); } ); /** * Header Bottom Border color */ wp.customize( 'astra-settings[header-main-sep-color]', function( value ) { value.bind( function( color ) { if (color == '') { wp.customize.preview.send( 'refresh' ); } if ( color ) { var dynamicStyle = ' .ast-desktop .main-header-bar { border-bottom-color: ' + color + '; } '; dynamicStyle += ' body.ast-header-break-point .main-header-bar { border-bottom-color: ' + color + '; } '; astra_add_dynamic_css( 'header-main-sep-color', dynamicStyle ); } } ); } ); /** * Primary Toggle Button Color */ wp.customize( 'astra-settings[mobile-header-toggle-btn-style-color]', function( setting ) { setting.bind( function( toggle_button_color ) { if ( toggle_button_color != '' ) { if( jQuery( '.menu-toggle' ).hasClass( 'ast-mobile-menu-buttons-fill' ) ) { var dynamicStyle = '.ast-header-break-point .ast-mobile-menu-buttons-fill.menu-toggle { background: ' + toggle_button_color + '}'; } else if( jQuery( '.menu-toggle' ).hasClass( 'ast-mobile-menu-buttons-outline' ) ) { var dynamicStyle = '.ast-header-break-point .ast-mobile-menu-buttons-outline.menu-toggle { border: 1px solid ' + toggle_button_color + '; color: ' + toggle_button_color + '}'; } else { var dynamicStyle = '.ast-header-break-point .ast-mobile-menu-buttons-minimal.menu-toggle { color: ' + toggle_button_color + '}'; } astra_add_dynamic_css( 'primary-toggle-button-color', dynamicStyle ); } else{ wp.customize.preview.send( 'refresh' ); } }); }); astra_responsive_font_size( 'astra-settings[font-size-site-tagline]', '.site-header .site-description' ); astra_responsive_font_size( 'astra-settings[font-size-site-title]', '.site-title' ); /** * Single Post Container Outside Spacing */ astra_responsive_spacing( 'astra-settings[single-post-outside-spacing]','.ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary .ast-article-single, .ast-plain-container.ast-single-post #primary, .ast-narrow-container.ast-single #primary', 'margin', ['top', 'bottom' ] ); astra_responsive_spacing( 'astra-settings[single-post-outside-spacing]','.ast-left-sidebar.ast-single-post #primary, .ast-right-sidebar.ast-single-post #primary, .ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary .ast-article-single, .ast-narrow-container.ast-single-post #primary', 'padding', ['left', 'right' ] ); // Remove padding top to container if padding top is given to Container Outer Spacing. wp.customize( 'astra-settings[single-post-outside-spacing]', function( value ) { value.bind( function( padding ) { var dynamicStyle = ''; if( padding.desktop.top != '' || padding.tablet.top != '' || padding.mobile.top != '' ) { dynamicStyle += '.ast-separate-container.ast-single-post #primary { padding-top: 0px;} '; dynamicStyle += '.ast-narrow-container.ast-single-post #primary { padding-top: 0px;} '; } if( padding.desktop.bottom != '' || padding.tablet.bottom != '' || padding.mobile.bottom != '' ) { dynamicStyle += '.ast-separate-container.ast-single-post #primary { padding-bottom: 0px;} '; dynamicStyle += '.ast-narrow-container.ast-single-post #primary { padding-bottom: 0px;} '; } astra_add_dynamic_css( 'remove-header-spacing', dynamicStyle ); } ); } ); astra_responsive_font_size( 'astra-settings[font-size-page-title]', 'body:not(.ast-single-post) .entry-title' ); // Check if anchors should be loaded in the CSS for headings. if (true == astraCustomizer.includeAnchorsInHeadindsCss) { astra_responsive_font_size('astra-settings[font-size-h1]', 'h1, .entry-content h1, .entry-content h1 a'); astra_responsive_font_size('astra-settings[font-size-h2]', 'h2, .entry-content h2, .entry-content h2 a'); astra_responsive_font_size('astra-settings[font-size-h3]', 'h3, .entry-content h3, .entry-content h3 a'); astra_responsive_font_size('astra-settings[font-size-h4]', 'h4, .entry-content h4, .entry-content h4 a'); astra_responsive_font_size('astra-settings[font-size-h5]', 'h5, .entry-content h5, .entry-content h5 a'); astra_responsive_font_size('astra-settings[font-size-h6]', 'h6, .entry-content h6, .entry-content h6 a'); } else { astra_responsive_font_size('astra-settings[font-size-h1]', 'h1, .entry-content h1'); astra_responsive_font_size('astra-settings[font-size-h2]', 'h2, .entry-content h2'); astra_responsive_font_size('astra-settings[font-size-h3]', 'h3, .entry-content h3'); astra_responsive_font_size('astra-settings[font-size-h4]', 'h4, .entry-content h4'); astra_responsive_font_size('astra-settings[font-size-h5]', 'h5, .entry-content h5'); astra_responsive_font_size('astra-settings[font-size-h6]', 'h6, .entry-content h6'); } // paragraph margin bottom. wp.customize( 'astra-settings[para-margin-bottom]', function( value ) { value.bind( function( marginBottom ) { if ( marginBottom == '' ) { wp.customize.preview.send( 'refresh' ); } if ( marginBottom ) { var dynamicStyle = ' p, .entry-content p { margin-bottom: ' + marginBottom + 'em; } '; astra_add_dynamic_css( 'para-margin-bottom', dynamicStyle ); } } ); } ); // Add preview underline in customizer for content links. wp.customize( 'astra-settings[underline-content-links]', function( setting ) { setting.bind( function( value ) { var dynamicStyle = ''; if ( value ) { dynamicStyle = '.ast-single-post .entry-content a, .ast-comment-content a:not(.ast-comment-edit-reply-wrap a) { text-decoration: underline; } '; astra_add_dynamic_css( 'underline-content-links', dynamicStyle ); } else { dynamicStyle = '.ast-single-post .entry-content a, .ast-comment-content a:not(.ast-comment-edit-reply-wrap a) { text-decoration: unset; } '; astra_add_dynamic_css( 'underline-content-links', dynamicStyle ); } } ); } ); if ( astraCustomizer.page_builder_button_style_css ) { if (true == astraCustomizer.includeAnchorsInHeadindsCss) { if ( 'color-typo' == astraCustomizer.elementor_default_color_font_setting || 'typo' == astraCustomizer.elementor_default_color_font_setting ) { astra_css('astra-settings[headings-line-height]', 'line-height', '.elementor-widget-heading h1.elementor-heading-title, .elementor-widget-heading h2.elementor-heading-title, .elementor-widget-heading h3.elementor-heading-title, .elementor-widget-heading h4.elementor-heading-title, .elementor-widget-heading h5.elementor-heading-title, .elementor-widget-heading h6.elementor-heading-title'); } astra_css('astra-settings[headings-line-height]', 'line-height', 'h1, .entry-content h1, .entry-content h1 a, h2, .entry-content h2, .entry-content h2 a, h3, .entry-content h3, .entry-content h3 a, h4, .entry-content h4, .entry-content h4 a, h5, .entry-content h5, .entry-content h5 a, h6, .entry-content h6, .entry-content h6 a, .site-title, .site-title a'); } else { if ( 'color-typo' == astraCustomizer.elementor_default_color_font_setting || 'typo' == astraCustomizer.elementor_default_color_font_setting ) { astra_css('astra-settings[headings-line-height]', 'line-height', '.elementor-widget-heading h1.elementor-heading-title, .elementor-widget-heading h2.elementor-heading-title, .elementor-widget-heading h3.elementor-heading-title, .elementor-widget-heading h4.elementor-heading-title, .elementor-widget-heading h5.elementor-heading-title, .elementor-widget-heading h6.elementor-heading-title'); } astra_css('astra-settings[headings-line-height]', 'line-height', 'h1, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6, .site-title, .site-title a'); } } else { if (true == astraCustomizer.includeAnchorsInHeadindsCss) { astra_css('astra-settings[headings-line-height]', 'line-height', 'h1, .entry-content h1, .entry-content h1 a, h2, .entry-content h2, .entry-content h2 a, h3, .entry-content h3, .entry-content h3 a, h4, .entry-content h4, .entry-content h4 a, h5, .entry-content h5, .entry-content h5 a, h6, .entry-content h6, .entry-content h6 a, .site-title, .site-title a'); } else { astra_css('astra-settings[headings-line-height]', 'line-height', 'h1, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6, .site-title, .site-title a'); } } // Check if anchors should be loaded in the CSS for headings. if (true == astraCustomizer.includeAnchorsInHeadindsCss) { astra_generate_outside_font_family_css('astra-settings[headings-font-family]', 'h1, .entry-content h1, .entry-content h1 a, h2, .entry-content h2, .entry-content h2 a, h3, .entry-content h3, .entry-content h3 a, h4, .entry-content h4, .entry-content h4 a, h5, .entry-content h5, .entry-content h5 a, h6, .entry-content h6, .entry-content h6 a, .site-title, .site-title a'); astra_generate_font_weight_css( 'astra-settings[headings-font-family]', 'astra-settings[headings-font-weight]', 'font-weight', 'h1, .entry-content h1, .entry-content h1 a, h2, .entry-content h2, .entry-content h2 a, h3, .entry-content h3, .entry-content h3 a, h4, .entry-content h4, .entry-content h4 a, h5, .entry-content h5, .entry-content h5 a, h6, .entry-content h6, .entry-content h6 a, .site-title, .site-title a' ); astra_font_extras_css( 'headings-font-extras', '.entry-content h1, .entry-content h1 a, h2, .entry-content h2, .entry-content h2 a, h3, .entry-content h3, .entry-content h3 a, h4, .entry-content h4, .entry-content h4 a, h5, .entry-content h5, .entry-content h5 a, h6, .entry-content h6, .entry-content h6 a, .site-title, .site-title a' ); } else { astra_generate_outside_font_family_css('astra-settings[headings-font-family]', 'h1, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6, .site-title, .site-title a'); astra_generate_font_weight_css( 'astra-settings[headings-font-family]', 'astra-settings[headings-font-weight]', 'font-weight', 'h1, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6, .site-title, .site-title a' ); astra_font_extras_css( 'headings-font-extras', '.entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6, .site-title, .site-title a' ); } // Global link astra_css( 'astra-settings[link-color]', 'color', '.entry-meta, .entry-meta *'); astra_css( 'astra-settings[link-h-color]', 'color', '.read-more a:hover, .entry-meta a:hover, .entry-meta a:hover *'); // Footer Bar. astra_css( 'astra-settings[footer-color]', 'color', '.ast-small-footer' ); astra_css( 'astra-settings[footer-link-color]', 'color', '.ast-small-footer a' ); astra_css( 'astra-settings[footer-link-h-color]', 'color', '.ast-small-footer a:hover' ); // Footer Bar background. wp.customize( 'astra-settings[footer-bg-obj]', function( value ) { value.bind( function( bg_obj ) { var dynamicStyle = ' .ast-small-footer > .ast-footer-overlay { {{css}} }'; astra_background_obj_css( wp.customize, bg_obj, 'footer-bg-obj', dynamicStyle ); } ); } ); // Footer Widgets. astra_css( 'astra-settings[footer-adv-wgt-title-color]', 'color', '.footer-adv .widget-title, .footer-adv .widget-title a' ); astra_css( 'astra-settings[footer-adv-text-color]', 'color', '.footer-adv' ); astra_css( 'astra-settings[footer-adv-link-color]', 'color', '.footer-adv a' ); astra_css( 'astra-settings[footer-adv-link-h-color]', 'color', '.footer-adv a:hover, .footer-adv .no-widget-text a:hover, .footer-adv a:focus, .footer-adv .no-widget-text a:focus' ); // Footer Widget background. wp.customize( 'astra-settings[footer-adv-bg-obj]', function( value ) { value.bind( function( bg_obj ) { var dynamicStyle = ' .footer-adv-overlay { {{css}} }'; astra_background_obj_css( wp.customize, bg_obj, 'footer-adv-bg-obj', dynamicStyle ); } ); } ); /* * Woocommerce Shop Archive Custom Width */ wp.customize( 'astra-settings[shop-archive-max-width]', function( setting ) { setting.bind( function( width ) { var dynamicStyle = '@media all and ( min-width: 921px ) {'; dynamicStyle += '.ast-woo-shop-archive .site-content > .ast-container{ max-width: ' + ( parseInt( width ) ) + 'px } '; if ( jQuery( 'body' ).hasClass( 'ast-fluid-width-layout' ) ) { dynamicStyle += '.ast-woo-shop-archive .site-content > .ast-container{ padding-left:20px; padding-right:20px; } '; } dynamicStyle += '}'; astra_add_dynamic_css( 'shop-archive-max-width', dynamicStyle ); } ); } ); //[1] Primary Menu Toggle Button Style. wp.customize( 'astra-settings[mobile-header-toggle-btn-style]', function( setting ) { setting.bind( function( icon_style ) { var icon_color = wp.customize('astra-settings[mobile-header-toggle-btn-color]').get(); if ( '' === icon_color && 'fill' === icon_style ) { var dynamicStyle = ' [data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg { fill: #ffffff; } '; astra_add_dynamic_css( 'mobile-header-toggle-btn-style', dynamicStyle ); } else { astra_add_dynamic_css( 'mobile-header-toggle-btn-style', '' ); } var buttons = $(document).find('.ast-mobile-menu-buttons .menu-toggle'); buttons.removeClass('ast-mobile-menu-buttons-default ast-mobile-menu-buttons-fill ast-mobile-menu-buttons-outline'); buttons.removeClass('ast-mobile-menu-buttons-default ast-mobile-menu-buttons-fill ast-mobile-menu-buttons-minimal'); buttons.addClass( 'ast-mobile-menu-buttons-' + icon_style ); var themeColor = wp.customize( 'astra-settings[theme-color]' ).get(); var defaultColor = '#ffffff'; var toggleButtonColor = wp.customize( 'astra-settings[mobile-header-toggle-btn-color]' ).get(); if ( 'fill' !== icon_style ) { defaultColor = themeColor } var iconColor = defaultColor; if ( '' !== toggleButtonColor && undefined !== toggleButtonColor && null !== toggleButtonColor ) { iconColor = toggleButtonColor } var dynamicStyle = '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg {'; dynamicStyle += 'fill: ' + iconColor + ';'; dynamicStyle +='}'; dynamicStyle += '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-wrap .mobile-menu {'; dynamicStyle += 'color: ' + iconColor + ';'; dynamicStyle +='}'; dynamicStyle += '[data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-fill, [data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-minimal {'; dynamicStyle += 'color: ' + iconColor + ';'; dynamicStyle += 'border: none;'; dynamicStyle +='}'; dynamicStyle += '[data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-outline {'; dynamicStyle += 'color: ' + iconColor + ';'; dynamicStyle +='}'; ; astra_add_dynamic_css( 'mobile-header-toggle-btn-style', dynamicStyle ); } ); } ); //[1] Toggle Button Border Radius. wp.customize( 'astra-settings[mobile-header-toggle-btn-border-radius]', function( setting ) { setting.bind( function( border ) { var dynamicStyle = '.ast-header-break-point .main-header-bar .ast-button-wrap .menu-toggle { border-radius: ' + ( parseInt( border ) ) + 'px } '; astra_add_dynamic_css( 'mobile-header-toggle-btn-border-radius', dynamicStyle ); } ); } ); /** * Primary Submenu border */ wp.customize( 'astra-settings[primary-submenu-border]', function( value ) { value.bind( function( border ) { var color = wp.customize( 'astra-settings[primary-submenu-b-color]' ).get(); if( '' != border.top || '' != border.right || '' != border.bottom || '' != border.left ) { var dynamicStyle = '.ast-desktop .main-header-menu.submenu-with-border .sub-menu'; dynamicStyle += '{'; dynamicStyle += 'border-top-width:' + border.top + 'px;'; dynamicStyle += 'border-right-width:' + border.right + 'px;'; dynamicStyle += 'border-left-width:' + border.left + 'px;'; dynamicStyle += 'border-bottom-width:' + border.bottom + 'px;'; dynamicStyle += 'border-color:' + color + ';'; dynamicStyle += 'border-style: solid;'; dynamicStyle += '}'; dynamicStyle += '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .sub-menu'; dynamicStyle += '{'; dynamicStyle += 'top:-' + border.top + 'px;'; dynamicStyle += '}'; // Submenu items goes outside? dynamicStyle += '@media (min-width: 769px){'; dynamicStyle += '.main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu:hover > .sub-menu, .main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu.focus > .sub-menu'; dynamicStyle += '{'; dynamicStyle += 'margin-left:-' + ( +border.left + +border.right ) + 'px;'; dynamicStyle += '}'; dynamicStyle += '}'; astra_add_dynamic_css( 'primary-submenu-border', dynamicStyle ); } else { wp.customize.preview.send( 'refresh' ); } } ); } ); /** * Primary Submenu border COlor */ wp.customize( 'astra-settings[primary-submenu-b-color]', function( value ) { value.bind( function( color ) { var border = wp.customize( 'astra-settings[primary-submenu-border]' ).get(); if ( '' != color ) { if( '' != border.top || '' != border.right || '' != border.bottom || '' != border.left ) { var dynamicStyle = '.ast-desktop .main-header-menu.submenu-with-border .sub-menu'; dynamicStyle += '{'; dynamicStyle += 'border-top-width:' + border.top + 'px;'; dynamicStyle += 'border-right-width:' + border.right + 'px;'; dynamicStyle += 'border-left-width:' + border.left + 'px;'; dynamicStyle += 'border-bottom-width:' + border.bottom + 'px;'; dynamicStyle += 'border-color:' + color + ';'; dynamicStyle += 'border-style: solid;'; dynamicStyle += '}'; dynamicStyle += '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .sub-menu'; dynamicStyle += '{'; dynamicStyle += 'top:-' + border.top + 'px;'; dynamicStyle += '}'; // Submenu items goes outside? dynamicStyle += '@media (min-width: 769px){'; dynamicStyle += '.main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu:hover > .sub-menu, .main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu.focus > .sub-menu'; dynamicStyle += '{'; dynamicStyle += 'margin-left:-' + ( +border.left + +border.right ) + 'px;'; dynamicStyle += '}'; dynamicStyle += '}'; astra_add_dynamic_css( 'primary-submenu-border-color', dynamicStyle ); } } else { wp.customize.preview.send( 'refresh' ); } } ); } ); /** * Primary Submenu border COlor */ wp.customize('astra-settings[primary-submenu-item-b-color]', function (value) { value.bind(function (color) { var insideBorder = wp.customize('astra-settings[primary-submenu-item-border]').get(); if ('' != color) { if ( true == insideBorder ) { var dynamicStyle = ''; dynamicStyle += '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .menu-link'; dynamicStyle += '{'; dynamicStyle += 'border-bottom-width:' + ( ( true === insideBorder ) ? '1px;' : '0px;' ); dynamicStyle += 'border-color:' + color + ';'; dynamicStyle += 'border-style: solid;'; dynamicStyle += '}'; astra_add_dynamic_css('primary-submenu-item-b-color', dynamicStyle); } } else { wp.customize.preview.send('refresh'); } }); }); /** * Primary Submenu border COlor */ wp.customize( 'astra-settings[primary-submenu-item-border]', function( value ) { value.bind( function( border ) { var color = wp.customize( 'astra-settings[primary-submenu-item-b-color]' ).get(); if( true === border ) { var dynamicStyle = '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .menu-link'; dynamicStyle += '{'; dynamicStyle += 'border-bottom-width:' + ( ( true === border ) ? '1px;' : '0px;' ); dynamicStyle += 'border-color:' + color + ';'; dynamicStyle += 'border-style: solid;'; dynamicStyle += '}'; astra_add_dynamic_css( 'primary-submenu-item-border', dynamicStyle ); } else { wp.customize.preview.send( 'refresh' ); } } ); } ); astra_css( 'astra-settings[header-main-rt-section-button-text-color]', 'color', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_css( 'astra-settings[header-main-rt-section-button-back-color]', 'background-color', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_css( 'astra-settings[header-main-rt-section-button-text-h-color]', 'color', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' ); astra_css( 'astra-settings[header-main-rt-section-button-back-h-color]', 'background-color', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' ); astra_css( 'astra-settings[header-main-rt-section-button-border-radius]', 'border-radius', '.main-header-bar .ast-container .button-custom-menu-item .ast-custom-button-link .ast-custom-button', 'px' ); astra_css( 'astra-settings[header-main-rt-section-button-border-color]', 'border-color', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_css( 'astra-settings[header-main-rt-section-button-border-h-color]', 'border-color', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' ); astra_responsive_spacing( 'astra-settings[header-main-rt-section-button-padding]','.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button', 'padding', ['top', 'right', 'bottom', 'left' ] ); // Header custom button - Typography preview stylings. astra_generate_outside_font_family_css( 'astra-settings[primary-header-button-font-family]', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_responsive_font_size( 'astra-settings[primary-header-button-font-size]', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_css( 'astra-settings[primary-header-button-font-weight]', 'font-weight', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_css( 'astra-settings[primary-header-button-line-height]', 'line-height', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_css( 'astra-settings[primary-header-button-text-transform]', 'text-transform', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ); astra_css( 'astra-settings[primary-header-button-letter-spacing]', 'letter-spacing', '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button', 'px' ); /** * Custom Button border */ wp.customize( 'astra-settings[header-main-rt-section-button-border-size]', function( value ) { value.bind( function( border ) { if( '' != border.top || '' != border.right || '' != border.bottom || '' != border.left ) { var dynamicStyle = '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button'; dynamicStyle += '{'; dynamicStyle += 'border-top-width:' + border.top + 'px;'; dynamicStyle += 'border-right-width:' + border.right + 'px;'; dynamicStyle += 'border-left-width:' + border.left + 'px;'; dynamicStyle += 'border-bottom-width:' + border.bottom + 'px;'; dynamicStyle += 'border-style: solid;'; dynamicStyle += '}'; astra_add_dynamic_css( 'header-main-rt-section-button-border-size', dynamicStyle ); } } ); } ); var ele_border_radius_selector = ''; var ele_border_width_selector = ''; var ele_padding_selector = ''; if ( astraCustomizer.page_builder_button_style_css ) { if ( 'color-typo' == astraCustomizer.elementor_default_color_font_setting || 'color' == astraCustomizer.elementor_default_color_font_setting || 'font' == astraCustomizer.elementor_default_color_font_setting ) { ele_border_radius_selector = ', .elementor-button-wrapper .elementor-button.elementor-size-sm, .elementor-button-wrapper .elementor-button.elementor-size-xs, .elementor-button-wrapper .elementor-button.elementor-size-md, .elementor-button-wrapper .elementor-button.elementor-size-lg, .elementor-button-wrapper .elementor-button.elementor-size-xl, .elementor-button-wrapper .elementor-button'; ele_border_width_selector = ', .elementor-button-wrapper .elementor-button, .elementor-button-wrapper .elementor-button:visited'; ele_padding_selector = ', .elementor-button-wrapper .elementor-button.elementor-size-sm, .elementor-button-wrapper .elementor-button.elementor-size-xs, .elementor-button-wrapper .elementor-button.elementor-size-md, .elementor-button-wrapper .elementor-button.elementor-size-lg, .elementor-button-wrapper .elementor-button.elementor-size-xl, .elementor-button-wrapper .elementor-button'; } } /** * Button border */ wp.customize( 'astra-settings[theme-button-border-group-border-size]', function( value ) { value.bind( function( border ) { var search_button_selector = hasWordPressWidgetBlockEditor() ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button, .woocommerce a.button' : ''; var dynamicStyle = '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button .wp-block-button__link' + ele_border_width_selector + search_button_selector + woo_btn_normal_sector; if( '' != border.top || '' != border.right || '' != border.bottom || '' != border.left ) { if( astraCustomizer.gb_outline_buttons_patterns_support && ! astraCustomizer.updated_gb_outline_button_patterns ) { wp.customize.preview.send( 'refresh' ); } else { dynamicStyle += '{'; dynamicStyle += 'border-top-width:' + border.top + 'px;'; dynamicStyle += 'border-right-width:' + border.right + 'px;'; dynamicStyle += 'border-left-width:' + border.left + 'px;'; dynamicStyle += 'border-bottom-width:' + border.bottom + 'px;'; dynamicStyle += 'border-style: solid;'; dynamicStyle += '}'; astra_add_dynamic_css( 'theme-button-border-group-border-size', dynamicStyle ); } } else { if( astraCustomizer.gb_outline_buttons_patterns_support && ! astraCustomizer.updated_gb_outline_button_patterns ) { wp.customize.preview.send( 'refresh' ); } else { dynamicStyle += '{'; dynamicStyle += 'border-top-width: 0;'; dynamicStyle += 'border-right-width: 0;'; dynamicStyle += 'border-left-width: 0;'; dynamicStyle += 'border-bottom-width: 0;'; dynamicStyle += '}'; astra_add_dynamic_css( 'theme-button-border-group-border-size', dynamicStyle ); } } } ); } ); var search_button_selector = hasWordPressWidgetBlockEditor() ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '' ; astra_responsive_spacing( 'astra-settings[theme-button-padding]','.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled], .wp-block-button .wp-block-button__link' + ele_padding_selector + search_button_selector, 'padding', [ 'top', 'bottom' ] ); astra_responsive_spacing( 'astra-settings[theme-button-padding]','.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled], .wp-block-button .wp-block-button__link' + ele_padding_selector + search_button_selector, 'padding', [ 'left', 'right' ] ); /** * Button border */ wp.customize( 'astra-settings[transparent-header-button-border-group]', function( value ) { value.bind( function( value ) { var optionValue = JSON.parse(value); var border = optionValue['header-main-rt-trans-section-button-border-size']; if( '' != border.top || '' != border.right || '' != border.bottom || '' != border.left ) { var dynamicStyle = '.ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button'; dynamicStyle += '{'; dynamicStyle += 'border-top-width:' + border.top + 'px;'; dynamicStyle += 'border-right-width:' + border.right + 'px;'; dynamicStyle += 'border-left-width:' + border.left + 'px;'; dynamicStyle += 'border-bottom-width:' + border.bottom + 'px;'; dynamicStyle += 'border-style: solid;'; dynamicStyle += '}'; astra_add_dynamic_css( 'header-main-rt-trans-section-button-border-size', dynamicStyle ); } } ); } ); // Site Title - Font family astra_generate_outside_font_family_css( 'astra-settings[font-family-site-title]', '.site-title, .site-title a' ); // Site Title - Font Weight astra_generate_font_weight_css( 'astra-settings[font-family-site-title]', 'astra-settings[font-weight-site-title]', 'font-weight', '.site-title, .site-title a' ); // Site Title - Font Size astra_responsive_font_size( 'astra-settings[font-size-site-title]', '.site-title, .site-title a' ); astra_font_extras_css( 'font-extras-site-title', '.site-title, .site-title a' ); // Site tagline - Font family astra_generate_outside_font_family_css( 'astra-settings[font-family-site-tagline]', '.site-header .site-description' ); // Site Tagline - Font Weight astra_generate_font_weight_css( 'astra-settings[font-family-site-tagline]', 'astra-settings[font-weight-site-tagline]', 'font-weight', '.site-header .site-description' ); // Site Tagline - Font Size astra_responsive_font_size( 'astra-settings[font-size-site-tagline]', '.site-header .site-description' ); // Site Tagline - Line Height astra_css( 'astra-settings[line-height-site-tagline]', 'line-height', '.site-header .site-description' ); // Site Tagline - Text Transform astra_css( 'astra-settings[text-transform-site-tagline]', 'text-transform', '.site-header .site-description' ); var search_button_selector = hasWordPressWidgetBlockEditor() ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button, .woocommerce a.button' : woo_btn_normal_sector ; var search_button_hover_selector = hasWordPressWidgetBlockEditor() ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus, .woocommerce a.button:hover' : woo_btn_hover_sector ; //Compatibility with wordpress 6.1.1 const global_builder_btn = 'div.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), div.wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color)'; const global_builder_btn_hover = ', div.wp-block-button.is-style-outline .wp-block-button__link:hover, div.wp-block-button.is-style-outline .wp-block-button__link:focus, div.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover, div.wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color):hover'; if ( astraCustomizer.page_builder_button_style_css ) { var btn_color_ele = ''; var btn_bg_color_ele = ''; var btn_h_color_ele = ''; var btn_bg_h_color_ele = ''; var btn_border_color_ele = ''; var btn_border_h_color_ele = ''; if ( 'color-typo' == astraCustomizer.elementor_default_color_font_setting || 'color' == astraCustomizer.elementor_default_color_font_setting ) { // Theme Button - Text Color btn_color_ele = ',.elementor-button-wrapper .elementor-button, .elementor-button-wrapper .elementor-button:visited'; // Theme Button - Background Color btn_bg_color_ele = ',.elementor-button-wrapper .elementor-button, .elementor-button-wrapper .elementor-button:visited'; // Theme Button - Text Hover Color btn_h_color_ele = ',.elementor-button-wrapper .elementor-button:hover, .elementor-button-wrapper .elementor-button:focus'; // Theme Button - Background Hover Color btn_bg_h_color_ele = ',.elementor-button-wrapper .elementor-button:hover, .elementor-button-wrapper .elementor-button:focus'; // Theme Button - Border Color btn_border_color_ele = ', .elementor-button-wrapper .elementor-button, .elementor-button-wrapper .elementor-button:visited'; // Theme Button - Border Hover Color btn_border_h_color_ele = ',.elementor-button-wrapper .elementor-button:hover, .elementor-button-wrapper .elementor-button:focus'; } var btnSelector = '.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button .wp-block-button__link, .ast-custom-button' + btn_bg_color_ele + search_button_selector + woo_btn_normal_sector; astraHandleButtonPresetPreview( btnSelector ); // Text color for outline style button as here the text color should be taken from border color. astra_css( 'astra-settings[theme-button-border-group-border-color]', 'color', global_builder_btn ); // Theme Button - Text Hover Color astra_css( 'astra-settings[button-h-color]', 'color', 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus, .ast-custom-button:hover, .ast-custom-button:focus, .wp-block-button .uagb-buttons-repeater.wp-block-button__link:hover' + btn_h_color_ele + search_button_hover_selector + global_builder_btn_hover, '', true ); // Theme Button - Background Hover Color astra_css( 'astra-settings[button-bg-h-color]', 'background-color', 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus, .ast-custom-button:hover, .ast-custom-button:focus, .wp-block-button .uagb-buttons-repeater.wp-block-button__link:hover' + btn_bg_h_color_ele + search_button_hover_selector + global_builder_btn_hover + woo_btn_hover_sector ); astra_css( 'astra-settings[theme-button-border-group-border-color]', 'border-color', '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button .wp-block-button__link' + btn_border_color_ele + search_button_selector + ', ' + global_builder_btn + woo_btn_normal_sector ); // Theme Button - Border Hover Color astra_css( 'astra-settings[theme-button-border-group-border-h-color]', 'border-color', 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .ast-custom-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' + btn_border_h_color_ele + search_button_hover_selector + global_builder_btn_hover + woo_btn_hover_sector ); } else { var btnSelector = '.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .ast-custom-button' + search_button_selector + woo_btn_normal_sector; astraHandleButtonPresetPreview( btnSelector ); // Theme Button - Border Color astra_css( 'astra-settings[button-bg-color]', 'border-color', '.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .ast-custom-button' + search_button_selector ); // Theme Button - Text Hover Color astra_css( 'astra-settings[button-h-color]', 'color', 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .ast-custom-button:hover, .ast-custom-button:focus' + search_button_hover_selector ); // Theme Button - Background Hover Color astra_css( 'astra-settings[button-bg-h-color]', 'background-color', 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .ast-custom-button:hover, .ast-custom-button:focus' + search_button_hover_selector ); astra_responsive_spacing( 'astra-settings[theme-button-padding]','.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled]' + search_button_selector, 'padding', [ 'top', 'bottom' ] ); astra_responsive_spacing( 'astra-settings[theme-button-padding]','.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled]' + search_button_selector, 'padding', [ 'left', 'right' ] ); } // Global custom event which triggers when partial refresh occurs. wp.customize.bind('preview-ready', function () { wp.customize.selectiveRefresh.bind('render-partials-response', function (response) { if( response.contents.hasOwnProperty('astra-settings[footer-desktop-items]') || ( ! ( response.contents.hasOwnProperty('astra-settings[header-desktop-items]') || response.contents.hasOwnProperty('astra-settings[header-mobile-items]') ) ) ) { return false; } setTimeout( function () { document.dispatchEvent( new CustomEvent( "astLayoutWidthChanged", { "detail": { 'response' : response } }) ); }, 10 ); }); wp.customize.selectiveRefresh.bind('partial-content-rendered', function (response) { if( response.partial.id.includes("footer") ) { return false; } sessionStorage.setItem('astPartialContentRendered', true); document.dispatchEvent( new CustomEvent( "astPartialContentRendered", { "detail": { 'response' : response } }) ); }); wp.customize.selectiveRefresh.bind('partial-content-rendered', function (response) { wp.customize.preview.send( 'AstraBuilderPartialContentRendered', response ); }); wp.customize.preview.bind( 'astPreviewDeviceChanged', function( device ) { document.dispatchEvent( new CustomEvent( "astPreviewDeviceChanged", { "detail": device }) ); } ); }) /** * Related Posts Query Arguments - Customizer preview support. */ wp.customize( 'astra-settings[related-posts-based-on]', function( setting ) { setting.bind( function() { wp.customize.preview.send( 'refresh' ); } ); } ); wp.customize( 'astra-settings[related-posts-order-by]', function( setting ) { setting.bind( function() { wp.customize.preview.send( 'refresh' ); } ); } ); wp.customize( 'astra-settings[related-posts-order]', function( setting ) { setting.bind( function() { wp.customize.preview.send( 'refresh' ); } ); } ); /** * Related Posts color stylings. */ astra_css( 'astra-settings[related-posts-text-color]', 'color', '.ast-related-post-content .entry-header .ast-related-post-title a, .ast-related-post-content .ast-related-post-excerpt' ); astra_css( 'astra-settings[related-posts-meta-color]', 'color', '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ); astra_css( 'astra-settings[related-posts-title-color]', 'color', '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ); astra_css( 'astra-settings[related-posts-background-color]', 'background-color', '.ast-single-related-posts-container' ); astra_css( 'astra-settings[related-posts-link-color]', 'color', '.ast-related-post-content .ast-related-post-cta a' ); astra_css( 'astra-settings[related-posts-link-hover-color]', 'color', '.ast-related-post-content .ast-related-post-cta a:hover' ); astra_css( 'astra-settings[related-posts-meta-link-hover-color]', 'color', '.ast-related-post-content .entry-meta a:hover, .ast-related-post-content .entry-meta span a span:hover' ); // Related Posts - Customizer preview for Post Title. astra_generate_outside_font_family_css( 'astra-settings[related-posts-title-font-family]', '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ); astra_css( 'astra-settings[related-posts-title-font-weight]', 'font-weight', '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ); astra_responsive_font_size( 'astra-settings[related-posts-title-font-size]', '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ); astra_font_extras_css( 'related-posts-title-font-extras', '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ); // Related Posts - Customizer preview for Section Title. astra_generate_outside_font_family_css( 'astra-settings[related-posts-section-title-font-family]', '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ); astra_css( 'astra-settings[related-posts-section-title-font-weight]', 'font-weight', '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ); astra_responsive_font_size( 'astra-settings[related-posts-section-title-font-size]', '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ); astra_css( 'astra-settings[releted-posts-title-alignment]', 'text-align', '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ); astra_font_extras_css( 'related-posts-section-title-font-extras', '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ); // Related Posts - Customizer preview for Post Meta. astra_generate_outside_font_family_css( 'astra-settings[related-posts-meta-font-family]', '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ); astra_css( 'astra-settings[related-posts-meta-font-weight]', 'font-weight', '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ); astra_responsive_font_size( 'astra-settings[related-posts-meta-font-size]', '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ); astra_font_extras_css( 'related-posts-meta-font-extras', '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ); // Related Posts - Customizer preview for Post Content. astra_generate_outside_font_family_css( 'astra-settings[related-posts-content-font-family]', '.ast-related-post-content .ast-related-post-excerpt' ); astra_css( 'astra-settings[related-posts-content-font-weight]', 'font-weight', '.ast-related-post-content .ast-related-post-excerpt' ); astra_responsive_font_size( 'astra-settings[related-posts-content-font-size]', '.ast-related-post-content .ast-related-post-excerpt' ); astra_font_extras_css( 'related-posts-content-font-extras', '.ast-related-post-content .ast-related-post-excerpt' ); // Title Color. astra_css( 'astra-settings[header-color-site-title]', 'color', '.ast-site-identity .site-title a, .ast-site-identity .site-title' ); // Title Hover Color. astra_css( 'astra-settings[header-color-h-site-title]', 'color', '.ast-site-identity .site-title a:hover, .ast-site-identity .site-title:hover' ); // Tagline Color. astra_css( 'astra-settings[header-color-site-tagline]', 'color', '.ast-site-identity .site-description' ); function astraHandleButtonPresetPreview( btnSelector ) { wp.customize( 'astra-settings[button-preset-style]', function( setting ) { setting.bind( function( value ) { var buttonBGColor = wp.customize( 'astra-settings[button-bg-color]' ).get(); var buttonTextColor = wp.customize( 'astra-settings[button-color]' ).get(); var themeColor = wp.customize( 'astra-settings[theme-color]' ).get(); if( 'button_04' === value || 'button_05' === value || 'button_06' === value ) { var buttonBorderColor = wp.customize( 'astra-settings[theme-button-border-group-border-color]' ).get(); if( '' === buttonBorderColor ) { jQuery( 'style#astra-settings-theme-button-border-group-border-color' ).remove(); // Theme Button - Background Color jQuery( 'head' ).append( '<style id="astra-settings-theme-button-border-group-border-color">' + btnSelector + ' { border-color: ' + buttonBGColor + ' }' + '</style>' ); } if( '' === buttonTextColor && '' !== buttonBGColor ) { jQuery( 'style#astra-settings-button-outline-preset-color' ).remove(); jQuery( 'head' ).append( '<style id="astra-settings-button-outline-preset-color">' + btnSelector + ' { color: ' + buttonBGColor + ' }' + '</style>' ); } if( '' === buttonTextColor && '' === buttonBGColor ) { jQuery( 'style#astra-settings-button-outline-preset-color' ).remove(); jQuery( 'head' ).append( '<style id="astra-settings-button-outline-preset-color">' + btnSelector + ' { color: ' + themeColor + ' }' + '</style>' ); } // Remove old. jQuery( 'style#astra-settings-button-preset-style-background-color' ).remove(); // Concat and append new <style>. jQuery( 'head' ).append( '<style id="astra-settings-button-preset-style-background-color">' + btnSelector + ' { background: transparent }' + '</style>' ); } else { jQuery( 'style#astra-settings-button-bg-color-background-color' ).remove(); jQuery( 'style#astra-settings-button-outline-preset-color' ).remove(); if( '' === buttonTextColor && '' === buttonBGColor ) { jQuery( 'head' ).append( '<style id="astra-settings-button-bg-color-background-color">' + btnSelector + ' { background-color: ' + themeColor + ' }' + '</style>' ); } else { // Set background color for button to theme color when value is empty. buttonBGColor = ( '' != buttonBGColor ) ? buttonBGColor : themeColor; // Theme Button - Background Color jQuery( 'head' ).append( '<style id="astra-settings-button-bg-color-background-color">' + btnSelector + ' { background-color: ' + buttonBGColor + ' }' + '</style>' ); } if( '' === buttonTextColor ) { // Set button text color to white when value is empty. jQuery( 'head' ).append( '<style id="astra-settings-button-outline-preset-color">' + btnSelector + ' { color: #FFFFFF; }' + '</style>' ); jQuery( 'style#astra-settings-button-color-color' ).remove(); } } } ); } ); wp.customize( 'astra-settings[button-color]', function( setting ) { setting.bind( function( value ) { if( '' === value ) { var buttonPreset = wp.customize( 'astra-settings[button-preset-style]' ).get(); // If button has outline preset. if( 'button_04' === buttonPreset || 'button_05' === buttonPreset || 'button_06' === buttonPreset ) { var buttonBGColor = wp.customize( 'astra-settings[button-bg-color]' ).get(); jQuery( 'style#astra-settings-button-outline-color' ).remove(); // Theme Button - Background Color jQuery( 'head' ).append( '<style id="astra-settings-button-color-color">' + btnSelector + ' { color: ' + buttonBGColor + ' }' + '</style>' ); } else { jQuery( 'style#astra-settings-button-color-color' ).remove(); // Theme Button - Background Color jQuery( 'head' ).append( '<style id="astra-settings-button-color-color">' + btnSelector + ' { color: #FFFFFF }' + '</style>' ); } } else { jQuery( 'style#astra-settings-button-color-color' ).remove(); // Theme Button - Background Color jQuery( 'head' ).append( '<style id="astra-settings-button-color-color">' + btnSelector + ' { color: ' + value + ' }' + '</style>' ); } } ); } ); wp.customize( 'astra-settings[button-bg-color]', function( setting ) { setting.bind( function( value ) { var buttonPreset = wp.customize( 'astra-settings[button-preset-style]' ).get(); var themeColor = wp.customize( 'astra-settings[theme-color]' ).get(); var buttonTextColor = wp.customize( 'astra-settings[button-color]' ).get(); // If button has outline preset. if( 'button_04' === buttonPreset || 'button_05' === buttonPreset || 'button_06' === buttonPreset ) { var buttonTextColor = wp.customize( 'astra-settings[button-color]' ).get(); var buttonBorderColor = wp.customize( 'astra-settings[theme-button-border-group-border-color]' ).get(); if( '' === buttonBorderColor ) { // Theme Button - Background Color jQuery( 'style#astra-settings-theme-button-border-group-border-color' ).remove(); // Theme Button - Background Color jQuery( 'head' ).append( '<style id="astra-settings-theme-button-border-group-border-color">' + btnSelector + ' { border-color: ' + value + ' }' + '</style>' ); } if( '' === buttonTextColor ) { jQuery( 'style#astra-settings-button-outline-preset-color' ).remove(); jQuery( 'head' ).append( '<style id="astra-settings-button-outline-preset-color">' + btnSelector + ' { color: ' + value + ' }' + '</style>' ); } } else { jQuery( 'style#astra-settings-button-bg-color-background-color' ).remove(); jQuery( 'style#astra-settings-button-outline-preset-color' ).remove(); // Set background color for button to theme color when value is empty. value = ( '' != value ) ? value : themeColor; if( '' === buttonTextColor ) { jQuery( 'head' ).append( '<style id="astra-settings-button-outline-preset-color">' + btnSelector + ' { color: #FFFFFF; }' + '</style>' ); } // Theme Button - Background Color jQuery( 'head' ).append( '<style id="stra-settings-button-bg-color-background-color">' + btnSelector + ' { background-color: ' + value + ' }' + '</style>' ); } } ); } ); /** * Cart Count Color. */ wp.customize( 'astra-settings[woo-header-cart-product-count-color]', function( setting ) { setting.bind( function( color ) { if( color ) { var dynamicStyle = '.ast-site-header-cart .ast-addon-cart-wrap i.astra-icon:after { color: ' + color + '; } '; astra_add_dynamic_css( 'woo-header-cart-product-count-color', dynamicStyle ); } else { wp.customize.preview.send( 'refresh' ); } } ); } ); /** * Cart Count Color Hover. */ wp.customize( 'astra-settings[woo-header-cart-product-count-h-color]', function( setting ) { setting.bind( function( color ) { if( color ) { var dynamicStyle = '.ast-site-header-cart .ast-site-header-cart-li:hover .ast-addon-cart-wrap i.astra-icon:after { color: ' + color + '; } '; astra_add_dynamic_css( 'woo-header-cart-product-count-h-color', dynamicStyle ); } else { wp.customize.preview.send( 'refresh' ); } } ); } ); wp.customize('astra-settings[single-product-cart-button-width]', function (value) { value.bind(function (size) { var tablet_break_point = astraBuilderPreview.tablet_break_point || 768, mobile_break_point = astraBuilderPreview.mobile_break_point || 544; if (size.desktop != '' || size.tablet != '' || size.mobile != '') { var dynamicStyle = ''; dynamicStyle += '.woocommerce div.product form.cart .button.single_add_to_cart_button {'; dynamicStyle += 'width: ' + size.desktop + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += '.woocommerce div.product form.cart .button.single_add_to_cart_button {'; dynamicStyle += 'width: ' + size.tablet + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += '.woocommerce div.product form.cart .button.single_add_to_cart_button {'; dynamicStyle += 'width: ' + size.mobile + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; astra_add_dynamic_css('header-woo-cart-icon-size', dynamicStyle); } else { wp.customize.preview.send( 'refresh' ); } }); }); // Single product Sticky add to cart. const astraStickyAddToCartBtnColor = '.woocommerce .ast-sticky-add-to-cart .button.alt'; const astraStickyAddToCartBtnHover = '.woocommerce .ast-sticky-add-to-cart .button.alt:hover'; astra_css( 'astra-settings[single-product-sticky-add-to-cart-btn-n-color]', 'color', astraStickyAddToCartBtnColor ); astra_css( 'astra-settings[single-product-sticky-add-to-cart-btn-h-color]', 'color', astraStickyAddToCartBtnHover ); astra_css( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-n-color]', 'background', astraStickyAddToCartBtnColor ); astra_css( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-h-color]', 'background', astraStickyAddToCartBtnHover ); astra_css( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-n-color]', 'border-color',astraStickyAddToCartBtnColor ); astra_css( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-h-color]', 'border-color', astraStickyAddToCartBtnHover ); astra_css( 'astra-settings[single-product-sticky-add-to-cart-text-color]', 'color', '.ast-sticky-add-to-cart .ast-container .ast-sticky-add-to-cart-content' ); astra_css( 'astra-settings[single-product-sticky-add-to-cart-bg-color]', 'background-color', '.ast-sticky-add-to-cart'); wp.customize( 'astra-settings[single-product-sticky-add-to-cart-position]', function( setting ) { setting.bind( function( position ) { var dynamicStyle = ''; if( 'top' === position ) { dynamicStyle += 'div.ast-sticky-add-to-cart{'; dynamicStyle += 'top: 0;'; dynamicStyle += 'bottom: initial;'; dynamicStyle += 'transform: translate(0, -100%);'; dynamicStyle += 'box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.1), 0px 1px 9px rgba(0, 0, 0, 0.06);'; dynamicStyle += 'opacity: 0'; dynamicStyle += '}'; } else { dynamicStyle += 'div.ast-sticky-add-to-cart{'; dynamicStyle += 'bottom: 0;'; dynamicStyle += 'top: initial;'; dynamicStyle += 'transform: translate(0, 100%);'; dynamicStyle += 'box-shadow: 0px -1px 10px rgba(0, 0, 0, 0.1), 0px -1px 9px rgba(0, 0, 0, 0.06);'; dynamicStyle += 'opacity: 0'; dynamicStyle += '}'; } astra_add_dynamic_css( 'sticky-add-to-cart-position', dynamicStyle ); } ); } ); wp.customize( 'astra-settings[single-product-payment-icon-color]', function( setting ) { setting.bind( function( value ) { wp.customize.preview.send( 'refresh' ); } ); } ); wp.customize( 'astra-settings[single-product-payment-text]', function( setting ) { setting.bind( function( text ) { const paymentText = document.querySelector('.ast-single-product-payments legend'); if( paymentText ) { paymentText.textContent = text; } } ); } ); wp.customize( 'astra-settings[single-product-payment-list]', function( setting ) { setting.bind( function( value ) { wp.customize.preview.send( 'refresh' ); } ); } ); } } )( jQuery ); skip-link-focus-fix.js 0000666 00000002043 15165371455 0010723 0 ustar 00 /** * File skip-link-focus-fix.js * * Helps with accessibility for keyboard only users. * This is the source file for what is minified in the astra_skip_link_focus_fix() PHP function. * * Learn more: https://github.com/Automattic/_s/pull/136 * * @package Astra */ ( function() { var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) { window.addEventListener( 'hashchange', function() { var id = location.hash.substring( 1 ), element; if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { return; } element = document.getElementById( id ); if ( element ) { if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { element.tabIndex = -1; } element.focus(); } }, false ); } })(); frontend-pro.js 0000666 00000015343 15165371455 0007545 0 ustar 00 /** * File fronend-pro.js * * Handles toggling the navigation menu for Addon widget * * @package Astra */ astraToggleSetupPro = function( mobileHeaderType, body, menu_click_listeners ) { var flag = false; var menuToggleAllLength; if ( 'off-canvas' === mobileHeaderType || 'full-width' === mobileHeaderType ) { // comma separated selector added, if menu is outside of Off-Canvas then submenu is not clickable, it work only for Off-Canvas area with dropdown style. var __main_header_all = document.querySelectorAll( '#ast-mobile-popup, #ast-mobile-header' ); if ( body.classList.contains('ast-header-break-point') ) { var menu_toggle_all = document.querySelectorAll('#ast-mobile-header .main-header-menu-toggle'); } else { menu_toggle_all = document.querySelectorAll('#ast-desktop-header .main-header-menu-toggle'); } menuToggleAllLength = menu_toggle_all.length; } else { if ( body.classList.contains('ast-header-break-point') ) { var __main_header_all = document.querySelectorAll( '#ast-mobile-header' ), menu_toggle_all = document.querySelectorAll( '#ast-mobile-header .main-header-menu-toggle' ); } else { var __main_header_all = document.querySelectorAll( '#ast-desktop-header' ), menu_toggle_all = document.querySelectorAll( '#ast-desktop-header .main-header-menu-toggle' ); } menuToggleAllLength = menu_toggle_all.length; flag = menuToggleAllLength > 0 ? false : true; menuToggleAllLength = flag ? 1 : menuToggleAllLength; } if ( menuToggleAllLength > 0 || flag ) { for (var i = 0; i < menuToggleAllLength; i++) { if ( !flag ) { menu_toggle_all[i].setAttribute('data-index', i); if (!menu_click_listeners[i]) { menu_click_listeners[i] = menu_toggle_all[i]; menu_toggle_all[i].addEventListener('click', astraNavMenuToggle, false); } } if ('undefined' !== typeof __main_header_all[i]) { // To handle the comma seprated selector added above we need this loop. for( var mainHeaderCount =0; mainHeaderCount < __main_header_all.length; mainHeaderCount++ ){ if (document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-link')) { var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .menu-item-has-children > .menu-link, ul.main-header-menu .ast-menu-toggle'); } else { var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .ast-menu-toggle'); } // Add Eventlisteners for Submenu. if (astra_menu_toggle.length > 0) { for (var j = 0; j < astra_menu_toggle.length; j++) { astra_menu_toggle[j].addEventListener('click', AstraToggleSubMenu, false); } } } } } } } astraNavMenuTogglePro = function ( event, body, mobileHeaderType, thisObj ) { event.preventDefault(); var desktop_header = event.target.closest('#ast-desktop-header'); var desktop_header_content = document.querySelector('#masthead > #ast-desktop-header .ast-desktop-header-content'); if ( null !== desktop_header && undefined !== desktop_header && '' !== desktop_header ) { var desktop_toggle = desktop_header.querySelector( '.main-header-menu-toggle' ); } else { var desktop_toggle = document.querySelector('#masthead > #ast-desktop-header .main-header-menu-toggle'); } var desktop_menu = document.querySelector('#masthead > #ast-desktop-header .ast-desktop-header-content .main-header-bar-navigation'); if ( 'desktop' === event.currentTarget.trigger_type ) { if ( null !== desktop_menu && '' !== desktop_menu && undefined !== desktop_menu ) { astraToggleClass(desktop_menu, 'toggle-on'); if (desktop_menu.classList.contains('toggle-on')) { desktop_menu.style.display = 'block'; } else { desktop_menu.style.display = ''; } } astraToggleClass(desktop_toggle, 'toggled'); if ( desktop_toggle.classList.contains( 'toggled' ) ) { body.classList.add("ast-main-header-nav-open"); if ( 'dropdown' === mobileHeaderType ) { desktop_header_content.style.display = 'block'; } } else { body.classList.remove("ast-main-header-nav-open"); desktop_header_content.style.display = 'none'; } return; } var __main_header_all = document.querySelectorAll('#masthead > #ast-mobile-header .main-header-bar-navigation'); menu_toggle_all = document.querySelectorAll( '#masthead > #ast-mobile-header .main-header-menu-toggle' ) var event_index = '0'; var sticky_header = false; if ( null !== thisObj.closest( '#ast-fixed-header' ) ) { __main_header_all = document.querySelectorAll('#ast-fixed-header > #ast-mobile-header .main-header-bar-navigation'); menu_toggle_all = document.querySelectorAll( '#ast-fixed-header .main-header-menu-toggle' ) event_index = '0'; sticky_header = true; } if ('undefined' === typeof __main_header_all[event_index]) { return false; } var menuHasChildren = __main_header_all[event_index].querySelectorAll('.menu-item-has-children'); for (var i = 0; i < menuHasChildren.length; i++) { menuHasChildren[i].classList.remove('ast-submenu-expanded'); var menuHasChildrenSubMenu = menuHasChildren[i].querySelectorAll('.sub-menu'); for (var j = 0; j < menuHasChildrenSubMenu.length; j++) { menuHasChildrenSubMenu[j].style.display = 'none'; } } var menu_class = thisObj.getAttribute('class') || ''; if ( menu_class.indexOf('main-header-menu-toggle') !== -1 ) { astraToggleClass(__main_header_all[event_index], 'toggle-on'); astraToggleClass(menu_toggle_all[event_index], 'toggled'); if ( sticky_header && 1 < menu_toggle_all.length ) { astraToggleClass(menu_toggle_all['1'], 'toggled'); } if (__main_header_all[event_index].classList.contains('toggle-on')) { __main_header_all[event_index].style.display = 'block'; body.classList.add("ast-main-header-nav-open"); } else { __main_header_all[event_index].style.display = ''; body.classList.remove("ast-main-header-nav-open"); } } } mobile-cart.js 0000666 00000012526 15165371455 0007326 0 ustar 00 /** * * Handle Mobile Cart events. * * @since 3.1.0 * @package Astra */ (function () { var cart_flyout = document.getElementById('astra-mobile-cart-drawer'), main_header_masthead = document.getElementById('masthead'); // Return if masthead not exixts. if (!main_header_masthead) { return; } var woo_data = '', mobileHeader = main_header_masthead.querySelector("#ast-mobile-header"), edd_data = ''; if (undefined !== cart_flyout && '' !== cart_flyout && null !== cart_flyout) { woo_data = cart_flyout.querySelector('.widget_shopping_cart.woocommerce'); edd_data = cart_flyout.querySelector('.widget_edd_cart_widget'); } /** * Opens the Cart Flyout. */ cartFlyoutOpen = function (event) { event.preventDefault(); var current_cart = event.currentTarget.cart_type; if ('woocommerce' === current_cart && document.body.classList.contains('woocommerce-cart')) { return; } cart_flyout.classList.remove('active'); cart_flyout.classList.remove('woocommerce-active'); cart_flyout.classList.remove('edd-active'); if (undefined !== cart_flyout && '' !== cart_flyout && null !== cart_flyout) { cart_flyout.classList.add('active'); document.documentElement.classList.add('ast-mobile-cart-active'); if (undefined !== edd_data && '' !== edd_data && null !== edd_data) { edd_data.style.display = 'block'; if ('woocommerce' === current_cart) { edd_data.style.display = 'none'; cart_flyout.classList.add('woocommerce-active'); } } if (undefined !== woo_data && '' !== woo_data && null !== woo_data) { woo_data.style.display = 'block'; if ('edd' === current_cart) { woo_data.style.display = 'none'; cart_flyout.classList.add('edd-active'); } } } document.dispatchEvent( new CustomEvent( "astra_on_slide_In_cart_open", { "detail": {} }) ); } /** * Closes the Cart Flyout. */ cartFlyoutClose = function (event) { event.preventDefault(); if (undefined !== cart_flyout && '' !== cart_flyout && null !== cart_flyout) { cart_flyout.classList.remove('active'); document.documentElement.classList.remove('ast-mobile-cart-active'); } } /** * Main Init Function. */ function cartInit() { // Close Popup if esc is pressed. document.addEventListener('keyup', function (event) { // 27 is keymap for esc key. if (event.keyCode === 27) { event.preventDefault(); cart_flyout.classList.remove('active'); document.documentElement.classList.remove('ast-mobile-cart-active'); updateTrigger(); } }); // Close Popup on outside click. document.addEventListener('click', function (event) { var target = event.target; var cart_modal = document.querySelector('.ast-mobile-cart-active .astra-mobile-cart-overlay'); if (target === cart_modal) { cart_flyout.classList.remove('active'); document.documentElement.classList.remove('ast-mobile-cart-active'); } }); if (undefined !== mobileHeader && '' !== mobileHeader && null !== mobileHeader) { // Mobile Header Cart Flyout. if( 'flyout' == astra_cart.desktop_layout ) { var woo_carts = document.querySelectorAll('.ast-mobile-header-wrap .ast-header-woo-cart, #ast-desktop-header .ast-desktop-cart-flyout'); } else { var woo_carts = document.querySelectorAll('.ast-mobile-header-wrap .ast-header-woo-cart'); } var edd_cart = document.querySelector('.ast-mobile-header-wrap .ast-header-edd-cart'); var cart_close = document.querySelector('.astra-cart-drawer-close'); if( 0 < woo_carts.length ){ woo_carts.forEach(function callbackFn(woo_cart) { if (undefined !== woo_cart && '' !== woo_cart && null !== woo_cart && cart_flyout) { woo_cart.addEventListener("click", cartFlyoutOpen, false); woo_cart.cart_type = 'woocommerce'; } }) } if (undefined !== edd_cart && '' !== edd_cart && null !== edd_cart && cart_flyout) { edd_cart.addEventListener("click", cartFlyoutOpen, false); edd_cart.cart_type = 'edd'; } if (undefined !== cart_close && '' !== cart_close && null !== cart_close) { cart_close.addEventListener("click", cartFlyoutClose, false); } } } // Get the screen inner width. var screenInnerWidth = window.innerWidth; window.addEventListener('resize', function () { // Close Cart var cart_close = document.querySelector('.astra-cart-drawer-close'); if ( undefined !== cart_close && '' !== cart_close && null !== cart_close && 'INPUT' !== document.activeElement.tagName && cart_flyout.classList.contains( 'active' ) ) { // Get the modified screen inner width. var modifiedInnerWidth = window.innerWidth; if ( modifiedInnerWidth !== screenInnerWidth ) { screenInnerWidth = modifiedInnerWidth; cart_close.click(); } } }); window.addEventListener('load', function () { cartInit(); }); document.addEventListener('astLayoutWidthChanged', function () { cartInit(); }); document.addEventListener('astPartialContentRendered', function () { cartInit(); }); var layoutChangeDelay; window.addEventListener('resize', function () { clearTimeout(layoutChangeDelay); layoutChangeDelay = setTimeout(function () { cartInit(); document.dispatchEvent(new CustomEvent("astLayoutWidthChanged", {"detail": {'response': ''}})); }, 50); }); })(); sticky-add-to-cart.js 0000666 00000002075 15165371455 0010531 0 ustar 00 (function() { // Triggers sticky add to cart on scroll. const astraStickyAddToCart = document.querySelector( ".ast-sticky-add-to-cart" ); if( astraStickyAddToCart ) { const scrollOffset = document.querySelector( '.product .single_add_to_cart_button' ).offsetTop; window.addEventListener( "scroll", function() { if ( window.scrollY >= scrollOffset ) { astraStickyAddToCart.classList.add('is-active'); } else { astraStickyAddToCart.classList.remove('is-active'); } }) } // Smooth scrolls if select option button is active. const AstraSmoothScrollBtn = document.querySelector( ".ast-sticky-add-to-cart-action-wrap .single_link_to_cart_button" ); if( AstraSmoothScrollBtn ) { AstraSmoothScrollBtn.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth', }); }); } })(); frontend.js 0000666 00000121156 15165371455 0006747 0 ustar 00 /** * File fronend.js * * Handles toggling the navigation menu for small screens and enables tab * support for dropdown menus. * * @package Astra */ /** * Get all of an element's parent elements up the DOM tree * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var astraGetParents = function ( elem, selector ) { // Element.matches() polyfill. if ( ! Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll( s ), i = matches.length; while (--i >= 0 && matches.item( i ) !== this) {} return i > -1; }; } // Setup parents array. var parents = []; // Get matching parent elements. for ( ; elem && elem !== document; elem = elem.parentNode ) { // Add matching parents to array. if ( selector ) { if ( elem.matches( selector ) ) { parents.push( elem ); } } else { parents.push( elem ); } } return parents; }; /** * Deprecated: Get all of an element's parent elements up the DOM tree * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var getParents = function ( elem, selector ) { console.warn( 'getParents() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraGetParents() instead.' ); astraGetParents( elem, selector ); } /** * Toggle Class funtion * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var astraToggleClass = function ( el, className ) { if ( el.classList.contains( className ) ) { el.classList.remove( className ); } else { el.classList.add( className ); } }; /** * Deprecated: Toggle Class funtion * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var toggleClass = function ( el, className ) { console.warn( 'toggleClass() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraToggleClass() instead.' ); astraToggleClass( el, className ); }; // CustomEvent() constructor functionality in Internet Explorer 9 and higher. (function () { if (typeof window.CustomEvent === "function") return false; function CustomEvent(event, params) { params = params || { bubbles: false, cancelable: false, detail: undefined }; var evt = document.createEvent('CustomEvent'); evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); return evt; } CustomEvent.prototype = window.Event.prototype; window.CustomEvent = CustomEvent; })(); /** * Trigget custom JS Event. * * @since 1.4.6 * * @link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent * @param {Node} el Dom Node element on which the event is to be triggered. * @param {Node} typeArg A DOMString representing the name of the event. * @param {String} A CustomEventInit dictionary, having the following fields: * "detail", optional and defaulting to null, of type any, that is an event-dependent value associated with the event. */ var astraTriggerEvent = function astraTriggerEvent( el, typeArg ) { var customEventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var event = new CustomEvent(typeArg, customEventInit); el.dispatchEvent(event); }; /** * Scroll to ID/Top with smooth scroll behavior. * * @since x.x.x * * @param {Event} e Event which is been fired. * @param {String} top offset from top. */ astraSmoothScroll = function astraSmoothScroll( e, top ) { e.preventDefault(); window.scrollTo({ top: top, left: 0, behavior: 'smooth' }); }; /** * Scroll to Top trigger visibility adjustments. * * @since x.x.x * * @param {Node} masthead Page header. * @param {Node} astScrollTop Scroll to Top selector. */ astScrollToTopHandler = function ( masthead, astScrollTop ) { var content = getComputedStyle(astScrollTop).content, device = astScrollTop.dataset.onDevices; content = content.replace( /[^0-9]/g, '' ); if( 'both' == device || ( 'desktop' == device && '769' == content ) || ( 'mobile' == device && '' == content ) ) { // Get current window / document scroll. var scrollTop = window.pageYOffset || document.body.scrollTop; // If masthead found. if( masthead && masthead.length ) { if (scrollTop > masthead.offsetHeight + 100) { astScrollTop.style.display = "block"; } else { astScrollTop.style.display = "none"; } } else { // If there is no masthead set default start scroll if ( window.pageYOffset > 300 ) { astScrollTop.style.display = "block"; } else { astScrollTop.style.display = "none"; } } } else { astScrollTop.style.display = "none"; } }; ( function() { var menu_toggle_all = document.querySelectorAll( '#masthead .main-header-menu-toggle' ), main_header_masthead = document.getElementById('masthead'), menu_click_listeners_nav = {}, mobileHeaderType = '', body = document.body, mobileHeader = ''; if ( undefined !== main_header_masthead && null !== main_header_masthead ) { mobileHeader = main_header_masthead.querySelector("#ast-mobile-header"); } if ( '' !== mobileHeader && null !== mobileHeader ) { mobileHeaderType = mobileHeader.dataset.type; } document.addEventListener( 'astMobileHeaderTypeChange', updateHeaderType, false ); /** * Updates the header type. */ function updateHeaderType( e ) { mobileHeaderType = e.detail.type; var popupTrigger = document.querySelectorAll( '.menu-toggle' ); if( 'dropdown' === mobileHeaderType ) { document.getElementById( 'ast-mobile-popup' ).classList.remove( 'active', 'show' ); updateTrigger('updateHeader'); } if ( 'off-canvas' === mobileHeaderType ) { for ( var item = 0; item < popupTrigger.length; item++ ) { if ( undefined !== popupTrigger[item] && popupTrigger[item].classList.contains( 'toggled') ) { popupTrigger[item].click(); } } } init( mobileHeaderType ); } /** * Opens the Popup when trigger is clicked. */ popupTriggerClick = function ( event ) { var triggerType = event.currentTarget.trigger_type; var popupWrap = document.getElementById( 'ast-mobile-popup' ); const menuToggleClose = document.getElementById('menu-toggle-close'); if( menuToggleClose ) { menuToggleClose.focus(); } if ( ! body.classList.contains( 'ast-popup-nav-open' ) ) { body.classList.add( 'ast-popup-nav-open' ); } if ( ! body.classList.contains( 'ast-main-header-nav-open' ) && 'mobile' !== triggerType ) { body.classList.add( 'ast-main-header-nav-open' ); } if ( ! document.documentElement.classList.contains( 'ast-off-canvas-active' ) ) { document.documentElement.classList.add( 'ast-off-canvas-active' ); } if ( 'desktop' === triggerType ) { popupWrap.querySelector( '.ast-mobile-popup-content' ).style.display = 'none'; popupWrap.querySelector( '.ast-desktop-popup-content' ).style.display = 'block'; } if ( 'mobile' === triggerType ) { popupWrap.querySelector( '.ast-desktop-popup-content' ).style.display = 'none'; popupWrap.querySelector( '.ast-mobile-popup-content' ).style.display = 'block'; } this.style.display = 'none'; popupWrap.classList.add( 'active', 'show' ); } /** * Closes the Trigger when Popup is Closed. */ function updateTrigger(currentElement) { mobileHeader = main_header_masthead.querySelector( "#ast-mobile-header" ); var parent_li_sibling = ''; if( undefined !== mobileHeader && null !== mobileHeader && 'dropdown' === mobileHeader.dataset.type && 'updateHeader' !== currentElement ) { return; } if ( undefined !== currentElement && 'updateHeader' !== currentElement ) { parent_li_sibling = currentElement.closest( '.ast-mobile-popup-inner' ).querySelectorAll('.menu-item-has-children'); } else { var popup = document.querySelector( '#ast-mobile-popup' ); parent_li_sibling = popup.querySelectorAll('.menu-item-has-children'); } for ( var j = 0; j < parent_li_sibling.length; j++ ) { parent_li_sibling[j].classList.remove('ast-submenu-expanded'); var all_sub_menu = parent_li_sibling[j].querySelectorAll('.sub-menu'); for ( var k = 0; k < all_sub_menu.length; k++ ) { all_sub_menu[k].style.display = 'none'; } } var popupTrigger = document.querySelectorAll( '.menu-toggle' ); document.body.classList.remove( 'ast-main-header-nav-open', 'ast-popup-nav-open' ); document.documentElement.classList.remove( 'ast-off-canvas-active' ); for ( var item = 0; item < popupTrigger.length; item++ ) { popupTrigger[item].classList.remove( 'toggled' ); popupTrigger[item].style.display = 'flex'; } } /** * Main Init Function. */ function init( mobileHeaderType ) { var popupTriggerMobile = document.querySelectorAll( '#ast-mobile-header .menu-toggle' ); var popupTriggerDesktop = document.querySelectorAll( '#ast-desktop-header .menu-toggle' ); if ( undefined === mobileHeaderType && null !== main_header_masthead ) { mobileHeader = main_header_masthead.querySelector("#ast-mobile-header"); if( mobileHeader ) { mobileHeaderType = mobileHeader.dataset.type; } else { var desktopHeader = main_header_masthead.querySelector("#ast-desktop-header"); if ( desktopHeader ) { mobileHeaderType = desktopHeader.dataset.toggleType; } else { return; } } } if ( 'off-canvas' === mobileHeaderType ) { var popupClose = document.getElementById( 'menu-toggle-close' ), popupInner = document.querySelector( '.ast-mobile-popup-inner' ); if ( undefined === popupInner || null === popupInner ){ return; // if toggel button component is not loaded. } popupLinks = popupInner.getElementsByTagName('a'); for ( var item = 0; item < popupTriggerMobile.length; item++ ) { popupTriggerMobile[item].removeEventListener("click", astraNavMenuToggle, false); // Open the Popup when click on trigger popupTriggerMobile[item].addEventListener("click", popupTriggerClick, false); popupTriggerMobile[item].trigger_type = 'mobile'; } for ( var item = 0; item < popupTriggerDesktop.length; item++ ) { popupTriggerDesktop[item].removeEventListener("click", astraNavMenuToggle, false); // Open the Popup when click on trigger popupTriggerDesktop[item].addEventListener("click", popupTriggerClick, false); popupTriggerDesktop[item].trigger_type = 'desktop'; } //Close Popup on CLose Button Click. popupClose.addEventListener("click", function( e ) { document.getElementById( 'ast-mobile-popup' ).classList.remove( 'active', 'show' ); updateTrigger(this); }); // Close Popup if esc is pressed. document.addEventListener( 'keyup', function (event) { // 27 is keymap for esc key. if ( event.keyCode === 27 ) { event.preventDefault(); document.getElementById( 'ast-mobile-popup' ).classList.remove( 'active', 'show' ); updateTrigger(); } }); // Close Popup on outside click. document.addEventListener('click', function (event) { var target = event.target; var modal = document.querySelector( '.ast-mobile-popup-drawer.active .ast-mobile-popup-overlay' ); if ( target === modal ) { document.getElementById( 'ast-mobile-popup' ).classList.remove( 'active', 'show' ); updateTrigger(); } }); // Close Popup on # link click inside Popup. for ( let link = 0, len = popupLinks.length; link < len; link++ ) { if( null !== popupLinks[link].getAttribute("href") && ( popupLinks[link].getAttribute("href").startsWith('#') || -1 !== popupLinks[link].getAttribute("href").search("#") ) && ( ! popupLinks[link].parentElement.classList.contains('menu-item-has-children') || ( popupLinks[link].parentElement.classList.contains('menu-item-has-children') && document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-icon') ) ) ){ popupLinks[link].addEventListener( 'click', triggerToggleClose, true ); popupLinks[link].headerType = 'off-canvas'; } } AstraToggleSetup(); } else if ( 'dropdown' === mobileHeaderType ) { var mobileDropdownContent = document.querySelectorAll( '.ast-mobile-header-content' ) || false, desktopDropdownContent = document.querySelector( '.ast-desktop-header-content' ) || false; // Close Popup on # link click inside Popup. if ( mobileDropdownContent.length > 0 ) { for ( let index = 0; index < mobileDropdownContent.length; index++ ) { var mobileLinks = mobileDropdownContent[index].getElementsByTagName('a'); for ( link = 0, len = mobileLinks.length; link < len; link++ ) { if ( null !== mobileLinks[link].getAttribute("href") && ( mobileLinks[link].getAttribute("href").startsWith('#') || -1 !== mobileLinks[link].getAttribute("href").search("#") ) && ( !mobileLinks[link].parentElement.classList.contains('menu-item-has-children') || ( mobileLinks[link].parentElement.classList.contains('menu-item-has-children') && document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-icon') ) ) ) { mobileLinks[link].addEventListener( 'click', triggerToggleClose, true ); mobileLinks[link].headerType = 'dropdown'; } } } } // Close Popup on # link click inside Popup. if( desktopDropdownContent ) { var desktopLinks = desktopDropdownContent.getElementsByTagName('a'); for ( link = 0, len = desktopLinks.length; link < len; link++ ) { desktopLinks[link].addEventListener( 'click', triggerToggleClose, true ); desktopLinks[link].headerType = 'dropdown'; } } for ( var item = 0; item < popupTriggerMobile.length; item++ ) { popupTriggerMobile[item].removeEventListener("click", popupTriggerClick, false); popupTriggerMobile[item].addEventListener('click', astraNavMenuToggle, false); popupTriggerMobile[item].trigger_type = 'mobile'; } for ( var item = 0; item < popupTriggerDesktop.length; item++ ) { popupTriggerDesktop[item].removeEventListener("click", popupTriggerClick, false); popupTriggerDesktop[item].addEventListener('click', astraNavMenuToggle, false); popupTriggerDesktop[item].trigger_type = 'desktop'; } AstraToggleSetup(); } accountPopupTrigger(); } function triggerToggleClose( event ) { var headerType = event.currentTarget.headerType; switch( headerType ) { case 'dropdown': var popupTrigger = document.querySelectorAll( '.menu-toggle.toggled' ); for ( var item = 0; item < popupTrigger.length; item++ ) { popupTrigger[item].click(); } break; case 'off-canvas': var popupClose = document.getElementById( 'menu-toggle-close' ); popupClose.click(); break; default: break; } } window.addEventListener( 'load', function() { init(); } ); document.addEventListener( 'astLayoutWidthChanged', function() { init(); } ); document.addEventListener( 'astPartialContentRendered', function() { menu_toggle_all = document.querySelectorAll( '.main-header-menu-toggle' ); body.classList.remove("ast-main-header-nav-open"); document.addEventListener( 'astMobileHeaderTypeChange', updateHeaderType, false ); init(); accountPopupTrigger(); } ); var mobile_width = ( null !== navigator.userAgent.match(/Android/i) && 'Android' === navigator.userAgent.match(/Android/i)[0] ) ? window.visualViewport.width : window.innerWidth; function AstraHandleResizeEvent() { var menu_offcanvas_close = document.getElementById('menu-toggle-close'); var menu_dropdown_close = document.querySelector('.menu-toggle.toggled'); var desktop_header_content = document.querySelector('#masthead > #ast-desktop-header .ast-desktop-header-content'); var elementor_editor = document.querySelector('.elementor-editor-active'); if ( desktop_header_content ) { desktop_header_content.style.display = 'none'; } var mobileResizeWidth = ( null !== navigator.userAgent.match(/Android/i) && 'Android' === navigator.userAgent.match(/Android/i)[0] ) ? window.visualViewport.width : window.innerWidth; if ( mobileResizeWidth !== mobile_width ) { if ( menu_dropdown_close && null === elementor_editor ) { menu_dropdown_close.click(); } document.body.classList.remove( 'ast-main-header-nav-open', 'ast-popup-nav-open' ); if( menu_offcanvas_close && null == elementor_editor ) { menu_offcanvas_close.click(); } } updateHeaderBreakPoint(); AstraToggleSetup(); } window.addEventListener('resize', function(){ // Skip resize event when keyboard display event triggers on devices. if( 'INPUT' !== document.activeElement.tagName ) { AstraHandleResizeEvent(); } } ); document.addEventListener('DOMContentLoaded', function () { AstraToggleSetup(); /** * Navigation Keyboard Navigation. */ var containerButton; if ( body.classList.contains('ast-header-break-point') ) { containerButton = document.getElementById( 'ast-mobile-header' ); } else { containerButton = document.getElementById( 'ast-desktop-header' ); } if( null !== containerButton ) { var containerMenu = containerButton.querySelector( '.navigation-accessibility' ); navigation_accessibility( containerMenu, containerButton ); } }); var get_window_width = function () { return document.documentElement.clientWidth; } /* Add break point Class and related trigger */ var updateHeaderBreakPoint = function () { // Content overrflowing out of screen can give incorrect window.innerWidth. // Adding overflow hidden and then calculating the window.innerWidth fixes the problem. var originalOverflow = body.style.overflow; body.style.overflow = 'hidden'; var ww = get_window_width(); body.style.overflow = originalOverflow; var break_point = astra.break_point; /** * This case is when one hits a URL one after the other via `Open in New Tab` option * Chrome returns the value of outer width as 0 in this case. * This mis-calculates the width of the window and header seems invisible. * This could be fixed by using `0 === ww` condition below. */ if (ww > break_point || 0 === ww) { //remove menu toggled class. if ( menu_toggle_all.length > 0 ) { for (var i = 0; i < menu_toggle_all.length; i++) { if( null !== menu_toggle_all[i] ) { menu_toggle_all[i].classList.remove('toggled'); } } } body.classList.remove("ast-header-break-point"); body.classList.add("ast-desktop"); astraTriggerEvent(body, "astra-header-responsive-enabled"); } else { body.classList.add("ast-header-break-point"); body.classList.remove("ast-desktop"); astraTriggerEvent(body, "astra-header-responsive-disabled") } } var accountPopupTrigger = function () { // Account login form popup. var header_account_trigger = document.querySelectorAll( '.ast-account-action-login' ); if ( undefined !== header_account_trigger ) { var header_account__close_trigger = document.querySelectorAll( '#ast-hb-login-close' ); var login_popup = document.querySelectorAll('#ast-hb-account-login-wrap'); if ( 0 < header_account__close_trigger.length ) { for ( let index = 0; index < header_account_trigger.length; index++ ) { header_account_trigger[ index ].onclick = function (event) { event.preventDefault(); event.stopPropagation(); if ( ! login_popup[ index ].classList.contains('show')) { login_popup[ index ].classList.add('show'); } }; header_account__close_trigger[ index ].onclick = function (event) { event.preventDefault(); login_popup[ index ].classList.remove('show'); }; } } } } updateHeaderBreakPoint(); AstraToggleSubMenu = function( event ) { event.preventDefault(); if ('false' === event.target.getAttribute('aria-expanded') || ! event.target.getAttribute('aria-expanded')) { event.target.setAttribute('aria-expanded', 'true'); } else { event.target.setAttribute('aria-expanded', 'false'); } var parent_li = this.parentNode; if ( parent_li.classList.contains('ast-submenu-expanded') && document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-link') ) { if (!this.classList.contains('ast-menu-toggle')) { var link = parent_li.querySelector('a').getAttribute('href'); if ( '' !== link && '#' !== link) { window.location = link; } } } var parent_li_child = parent_li.querySelectorAll('.menu-item-has-children'); for (var j = 0; j < parent_li_child.length; j++) { parent_li_child[j].classList.remove('ast-submenu-expanded'); var parent_li_child_sub_menu = parent_li_child[j].querySelector('.sub-menu, .children'); if( null !== parent_li_child_sub_menu ) { parent_li_child_sub_menu.style.display = 'none'; } } var parent_li_sibling = parent_li.parentNode.querySelectorAll('.menu-item-has-children'); for (var j = 0; j < parent_li_sibling.length; j++) { if (parent_li_sibling[j] != parent_li) { parent_li_sibling[j].classList.remove('ast-submenu-expanded'); var all_sub_menu = parent_li_sibling[j].querySelectorAll('.sub-menu'); for (var k = 0; k < all_sub_menu.length; k++) { all_sub_menu[k].style.display = 'none'; } } } if (parent_li.classList.contains('menu-item-has-children') ) { astraToggleClass(parent_li, 'ast-submenu-expanded'); if (parent_li.classList.contains('ast-submenu-expanded')) { parent_li.querySelector('.sub-menu').style.display = 'block'; } else { parent_li.querySelector('.sub-menu').style.display = 'none'; } } }; AstraToggleSetup = function () { if( typeof astraAddon != 'undefined' && typeof astraToggleSetupPro === "function" ) { astraToggleSetupPro( mobileHeaderType, body, menu_click_listeners_nav ); } else { var flag = false; var menuToggleAllLength; if ( 'off-canvas' === mobileHeaderType || 'full-width' === mobileHeaderType ) { // comma separated selector added, if menu is outside of Off-Canvas then submenu is not clickable, it work only for Off-Canvas area with dropdown style. var __main_header_all = document.querySelectorAll( '#ast-mobile-popup, #ast-mobile-header' ); var menu_toggle_all = document.querySelectorAll('#ast-mobile-header .main-header-menu-toggle'); menuToggleAllLength = menu_toggle_all.length; } else { var __main_header_all = document.querySelectorAll( '#ast-mobile-header' ), menu_toggle_all = document.querySelectorAll('#ast-mobile-header .main-header-menu-toggle'); menuToggleAllLength = menu_toggle_all.length; flag = menuToggleAllLength > 0 ? false : true; menuToggleAllLength = flag ? 1 : menuToggleAllLength; } if ( menuToggleAllLength > 0 || flag ) { for (var i = 0; i < menuToggleAllLength; i++) { if ( ! flag ) { menu_toggle_all[i].setAttribute('data-index', i); if ( ! menu_click_listeners_nav[i] ) { menu_click_listeners_nav[i] = menu_toggle_all[i]; menu_toggle_all[i].addEventListener('click', astraNavMenuToggle, false); } } if ('undefined' !== typeof __main_header_all[i]) { // To handle the comma seprated selector added above we need this loop. for( var mainHeaderCount =0; mainHeaderCount < __main_header_all.length; mainHeaderCount++ ){ if (document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-link')) { var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .menu-item-has-children > .menu-link, ul.main-header-menu .ast-menu-toggle'); } else { var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .ast-menu-toggle'); } // Add Eventlisteners for Submenu. if (astra_menu_toggle.length > 0) { for (var j = 0; j < astra_menu_toggle.length; j++) { astra_menu_toggle[j].addEventListener('click', AstraToggleSubMenu, false); } } } } } } } }; astraNavMenuToggle = function ( event ) { if( typeof astraAddon != 'undefined' ) { astraNavMenuTogglePro( event, body, mobileHeaderType, this ); } else { event.preventDefault(); var __main_header_all = document.querySelectorAll('#masthead > #ast-mobile-header .main-header-bar-navigation'); menu_toggle_all = document.querySelectorAll( '#masthead > #ast-mobile-header .main-header-menu-toggle' ) var event_index = '0'; if ( null !== this.closest( '#ast-fixed-header' ) ) { __main_header_all = document.querySelectorAll('#ast-fixed-header > #ast-mobile-header .main-header-bar-navigation'); menu_toggle_all = document.querySelectorAll( '#ast-fixed-header .main-header-menu-toggle' ) event_index = '0'; } if ('undefined' === typeof __main_header_all[event_index]) { return false; } var menuHasChildren = __main_header_all[event_index].querySelectorAll('.menu-item-has-children'); for (var i = 0; i < menuHasChildren.length; i++) { menuHasChildren[i].classList.remove('ast-submenu-expanded'); var menuHasChildrenSubMenu = menuHasChildren[i].querySelectorAll('.sub-menu'); for (var j = 0; j < menuHasChildrenSubMenu.length; j++) { menuHasChildrenSubMenu[j].style.display = 'none'; } } var menu_class = this.getAttribute('class') || ''; if ( menu_class.indexOf('main-header-menu-toggle') !== -1 ) { astraToggleClass(__main_header_all[event_index], 'toggle-on'); astraToggleClass(menu_toggle_all[event_index], 'toggled'); if (__main_header_all[event_index].classList.contains('toggle-on')) { __main_header_all[event_index].style.display = 'block'; body.classList.add("ast-main-header-nav-open"); } else { __main_header_all[event_index].style.display = ''; body.classList.remove("ast-main-header-nav-open"); } } } }; body.addEventListener("astra-header-responsive-enabled", function () { var __main_header_all = document.querySelectorAll('.main-header-bar-navigation'); if (__main_header_all.length > 0) { for (var i = 0; i < __main_header_all.length; i++) { if (null != __main_header_all[i]) { __main_header_all[i].classList.remove('toggle-on'); __main_header_all[i].style.display = ''; } var sub_menu = __main_header_all[i].getElementsByClassName('sub-menu'); for (var j = 0; j < sub_menu.length; j++) { sub_menu[j].style.display = ''; } var child_menu = __main_header_all[i].getElementsByClassName('children'); for (var k = 0; k < child_menu.length; k++) { child_menu[k].style.display = ''; } var searchIcons = __main_header_all[i].getElementsByClassName('ast-search-menu-icon'); for (var l = 0; l < searchIcons.length; l++) { searchIcons[l].classList.remove('ast-dropdown-active'); searchIcons[l].style.display = ''; } } } }, false); var get_browser = function () { var ua = navigator.userAgent,tem,M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; if(/trident/i.test(M[1])) { tem = /\brv[ :]+(\d+)/g.exec(ua) || []; return; } if( 'Chrome' === M[1] ) { tem = ua.match(/\bOPR|Edge\/(\d+)/) if(tem != null) { return; } } M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; if((tem = ua.match(/version\/(\d+)/i)) != null) { M.splice(1,1,tem[1]); } if( 'Safari' === M[0] && M[1] < 11 ) { document.body.classList.add( "ast-safari-browser-less-than-11" ); } } get_browser(); /* Search Script */ var SearchIcons = document.getElementsByClassName( 'astra-search-icon' ); for (var i = 0; i < SearchIcons.length; i++) { SearchIcons[i].onclick = function(event) { if ( this.classList.contains( 'slide-search' ) ) { event.preventDefault(); var sibling = this.parentNode.parentNode.parentNode.querySelector( '.ast-search-menu-icon' ); if ( ! sibling.classList.contains( 'ast-dropdown-active' ) ) { sibling.classList.add( 'ast-dropdown-active' ); sibling.querySelector( '.search-field' ).setAttribute('autocomplete','off'); setTimeout(function() { sibling.querySelector( '.search-field' ).focus(); },200); } else { var searchTerm = sibling.querySelector( '.search-field' ).value || ''; if( '' !== searchTerm ) { sibling.querySelector( '.search-form' ).submit(); } sibling.classList.remove( 'ast-dropdown-active' ); } } } } /* Hide Dropdown on body click*/ body.onclick = function( event ) { if ( typeof event.target.classList !== 'undefined' ) { if ( ! event.target.classList.contains( 'ast-search-menu-icon' ) && astraGetParents( event.target, '.ast-search-menu-icon' ).length === 0 && astraGetParents( event.target, '.ast-search-icon' ).length === 0 ) { var dropdownSearchWrap = document.getElementsByClassName( 'ast-search-menu-icon' ); for (var i = 0; i < dropdownSearchWrap.length; i++) { dropdownSearchWrap[i].classList.remove( 'ast-dropdown-active' ); } } } } /** * Navigation Keyboard Navigation. */ function navigation_accessibility( containerMenu, containerButton ) { if ( ! containerMenu || ! containerButton ) { return; } var button = containerButton.getElementsByTagName( 'button' )[0]; if ( 'undefined' === typeof button ) { button = containerButton.getElementsByTagName( 'a' )[0]; var search_type = button.classList.contains('astra-search-icon'); if ( true === search_type ) { return; } if ( 'undefined' === typeof button ) { return; } } var menu = containerMenu.getElementsByTagName( 'ul' )[0]; // Hide menu toggle button if menu is empty and return early. if ( 'undefined' === typeof menu ) { button.style.display = 'none'; return; } if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { menu.className += ' nav-menu'; } if ( 'off-canvas' === mobileHeaderType ) { var popupClose = document.getElementById( 'menu-toggle-close' ); popupClose.onclick = function() { if ( -1 !== containerMenu.className.indexOf( 'toggled' ) ) { containerMenu.className = containerMenu.className.replace( ' toggled', '' ); button.setAttribute( 'aria-expanded', 'false' ); menu.setAttribute( 'aria-expanded', 'false' ); } else { containerMenu.className += ' toggled'; button.setAttribute( 'aria-expanded', 'true' ); menu.setAttribute( 'aria-expanded', 'true' ); } }; } button.onclick = function() { if ( -1 !== containerMenu.className.indexOf( 'toggled' ) ) { containerMenu.className = containerMenu.className.replace( ' toggled', '' ); button.setAttribute( 'aria-expanded', 'false' ); menu.setAttribute( 'aria-expanded', 'false' ); } else { containerMenu.className += ' toggled'; button.setAttribute( 'aria-expanded', 'true' ); menu.setAttribute( 'aria-expanded', 'true' ); } }; if( ! astra.is_header_footer_builder_active ) { // Get all the link elements within the menu. var links = menu.getElementsByTagName( 'a' ); var subMenus = menu.getElementsByTagName( 'ul' ); // Set menu items with submenus to aria-haspopup="true". for ( var i = 0, len = subMenus.length; i < len; i++ ) { subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); } // Each time a menu link is focused or blurred, toggle focus. for ( i = 0, len = links.length; i < len; i++ ) { links[i].addEventListener( 'focus', toggleFocus, true ); links[i].addEventListener( 'blur', toggleFocus, true ); links[i].addEventListener( 'click', toggleClose, true ); } } if( astra.is_header_footer_builder_active ) { tabNavigation(); } } // Tab navigation for accessibility. function tabNavigation() { const dropdownToggleLinks = document.querySelectorAll('nav.site-navigation .menu-item-has-children > a .ast-header-navigation-arrow'); const siteNavigationSubMenu = document.querySelectorAll('nav.site-navigation .sub-menu'); const menuLi = document.querySelectorAll('nav.site-navigation .menu-item-has-children'); const megaMenuFullWidth = document.querySelectorAll('.astra-full-megamenu-wrapper'); if (dropdownToggleLinks) { dropdownToggleLinks.forEach(element => { element.addEventListener('keydown', function (e) { if ('Enter' === e.key) { if (!e.target.closest('li').querySelector('.sub-menu').classList.contains('astra-megamenu')) { setTimeout(() => { e.target.closest('li').querySelector('.sub-menu').classList.toggle('toggled-on'); e.target.closest('li').classList.toggle('ast-menu-hover'); if ('false' === e.target.getAttribute('aria-expanded') || !e.target.getAttribute('aria-expanded')) { e.target.setAttribute('aria-expanded', 'true'); } else { e.target.setAttribute('aria-expanded', 'false'); } }, 10); } else { // This is to handle mega menu setTimeout(() => { const subMenuTarget = e.target.closest('li').querySelector('.sub-menu'); const fullMegaMenuWrapper = e.target.closest('li').querySelector('.astra-full-megamenu-wrapper'); if( subMenuTarget ) { subMenuTarget.classList.toggle('astra-megamenu-focus'); } if( fullMegaMenuWrapper ) { fullMegaMenuWrapper.classList.toggle('astra-megamenu-wrapper-focus'); } e.target.closest('li').classList.toggle('ast-menu-hover'); if ('false' === e.target.getAttribute('aria-expanded') || !e.target.getAttribute('aria-expanded')) { e.target.setAttribute('aria-expanded', 'true'); } else { e.target.setAttribute('aria-expanded', 'false'); } }, 10); } } }); }); if (siteNavigationSubMenu || menuLi) { // Close sub-menus when clicking elsewhere document.addEventListener('click', function (e) { closeNavigationMenu(siteNavigationSubMenu, dropdownToggleLinks, menuLi, megaMenuFullWidth); }, false); } if (siteNavigationSubMenu || menuLi) { // Close sub-menus on escape key document.addEventListener('keydown', function (e) { if ('Escape' === e.key) { closeNavigationMenu(siteNavigationSubMenu, dropdownToggleLinks, menuLi, megaMenuFullWidth); } }, false); } } const allParentMenu = document.querySelectorAll('nav.site-navigation .ast-nav-menu > .menu-item-has-children > a .ast-header-navigation-arrow'); if (allParentMenu) { allParentMenu.forEach(element => { element.addEventListener('keydown', function (e) { if (!e.target.closest('li').classList.contains('ast-menu-hover') && 'Enter' === e.key) { closeNavigationMenu(siteNavigationSubMenu, dropdownToggleLinks, menuLi, megaMenuFullWidth); } }, false); }); } } function closeNavigationMenu(siteNavigationSubMenu, dropdownToggleLinks, menuLi, megaMenuFullWidth) { if (siteNavigationSubMenu) { siteNavigationSubMenu.forEach(element => { element.classList.remove('astra-megamenu-focus'); element.classList.remove('toggled-on'); }); } if (menuLi) { menuLi.forEach(element => { element.classList.remove('ast-menu-hover'); }); } if (megaMenuFullWidth) { megaMenuFullWidth.forEach(element => { element.classList.remove('astra-megamenu-wrapper-focus') }); } if (dropdownToggleLinks) { dropdownToggleLinks.forEach(element => { element.setAttribute('aria-expanded', 'false'); }); } } /** * Close the Toggle Menu on Click on hash (#) link. * * @since 1.3.2 * @return void */ function toggleClose( ) { var self = this || '', hash = '#'; if( self && ! self.classList.contains('astra-search-icon') && null === self.closest('.ast-builder-menu') ) { var link = new String( self ); if( link.indexOf( hash ) !== -1 ) { var link_parent = self.parentNode; if ( body.classList.contains('ast-header-break-point') ) { if( ! ( document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-link') && link_parent.classList.contains('menu-item-has-children') ) ) { /* Close Builder Header Menu */ var builder_header_menu_toggle = document.querySelector( '.main-header-menu-toggle' ); builder_header_menu_toggle.classList.remove( 'toggled' ); var main_header_bar_navigation = document.querySelector( '.main-header-bar-navigation' ); main_header_bar_navigation.classList.remove( 'toggle-on' ); main_header_bar_navigation.style.display = 'none'; astraTriggerEvent( document.querySelector('body'), 'astraMenuHashLinkClicked' ); } } else { while ( -1 === self.className.indexOf( 'nav-menu' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { if ( -1 !== self.className.indexOf( 'focus' ) ) { self.className = self.className.replace( ' focus', '' ); } } self = self.parentElement; } } } } } /** * Sets or removes .focus class on an element on focus. */ function toggleFocus() { var self = this; // Move up through the ancestors of the current link until we hit .nav-menu. while ( -1 === self.className.indexOf( 'navigation-accessibility' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { self.classList.toggle('focus'); } self = self.parentElement; } } if( ! astra.is_header_footer_builder_active ) { /* Add class if mouse clicked and remove if tab pressed */ if ( 'querySelector' in document && 'addEventListener' in window ) { body.addEventListener( 'mousedown', function() { body.classList.add( 'ast-mouse-clicked' ); } ); body.addEventListener( 'keydown', function() { body.classList.remove( 'ast-mouse-clicked' ); } ); } } /** * Scroll to specific hash link. * * @since x.x.x */ if ( astra.is_scroll_to_id ) { const links = document.querySelectorAll('a[href*="#"]:not([href="#"]):not([href="#0"]):not([href*="uagb-tab"])'); if (links) { for (const link of links) { if (link.hash !== "") { link.addEventListener("click", scrollToIDHandler); } } } function scrollToIDHandler(e) { let offset = 0; const siteHeader = document.querySelector('.site-header'); if (siteHeader) { //Check and add offset to scroll top if header is sticky. const headerHeight = siteHeader.querySelectorAll('div[data-stick-support]'); if (headerHeight) { headerHeight.forEach(single => { offset += single.clientHeight; }); } const href = this.hash; if (href) { const scrollId = document.querySelector(href); if (scrollId) { const scrollOffsetTop = scrollId.offsetTop - offset; if( scrollOffsetTop ) { astraSmoothScroll( e, scrollOffsetTop ); } } } } } } /** * Scroll to top. * * @since x.x.x */ if ( astra.is_scroll_to_top ) { var masthead = document.querySelector( '#page header' ); var astScrollTop = document.getElementById( 'ast-scroll-top' ); astScrollToTopHandler(masthead, astScrollTop); window.addEventListener('scroll', function () { astScrollToTopHandler(masthead, astScrollTop); }); astScrollTop.onclick = function(e){ astraSmoothScroll( e, 0 ); }; astScrollTop.addEventListener( 'keydown' , function(e) { if ( e.key === 'Enter') { astraSmoothScroll( e, 0 ); } }); } })(); shop-add-to-cart.js 0000666 00000002407 15165371455 0010173 0 ustar 00 jQuery(document).ready(function () { jQuery(document.body).on('added_to_cart', function () { const singleProductButton = jQuery('.single_add_to_cart_button'); if (!singleProductButton.hasClass('loading') && astra_shop_add_to_cart.shop_add_to_cart_action) { const slideInCart = jQuery('#astra-mobile-cart-drawer'); if (typeof astra_shop_add_to_cart.elementor_preview_active !== 'undefined' && !astra_shop_add_to_cart.elementor_preview_active) { if ('slide_in_cart' === astra_shop_add_to_cart.shop_add_to_cart_action && slideInCart) { slideInCart.addClass('active'); jQuery('html').addClass('ast-mobile-cart-active'); } if (astra_shop_add_to_cart.is_astra_pro) { if ('redirect_cart_page' === astra_shop_add_to_cart.shop_add_to_cart_action) { window.open(astra_shop_add_to_cart.cart_url, "_self"); } if ('redirect_checkout_page' === astra_shop_add_to_cart.shop_add_to_cart_action) { window.open(astra_shop_add_to_cart.checkout_url, "_self"); } } } } }); }); navigation.js 0000666 00000057043 15165371455 0007272 0 ustar 00 /** * File navigation.js * * Handles toggling the navigation menu for small screens and enables tab * support for dropdown menus. * * @package Astra */ /** * Get all of an element's parent elements up the DOM tree * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var astraGetParents = function ( elem, selector ) { // Element.matches() polyfill. if ( ! Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll( s ), i = matches.length; while (--i >= 0 && matches.item( i ) !== this) {} return i > -1; }; } // Setup parents array. var parents = []; // Get matching parent elements. for ( ; elem && elem !== document; elem = elem.parentNode ) { // Add matching parents to array. if ( selector ) { if ( elem.matches( selector ) ) { parents.push( elem ); } } else { parents.push( elem ); } } return parents; }; /** * Deprecated: Get all of an element's parent elements up the DOM tree * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var getParents = function ( elem, selector ) { console.warn( 'getParents() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraGetParents() instead.' ); astraGetParents( elem, selector ); } /** * Toggle Class funtion * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var astraToggleClass = function ( el, className ) { if ( el.classList.contains( className ) ) { el.classList.remove( className ); } else { el.classList.add( className ); } }; /** * Deprecated: Toggle Class funtion * * @param {Node} elem The element. * @param {String} selector Selector to match against [optional]. * @return {Array} The parent elements. */ var toggleClass = function ( el, className ) { console.warn( 'toggleClass() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraToggleClass() instead.' ); astraToggleClass( el, className ); }; // CustomEvent() constructor functionality in Internet Explorer 9 and higher. (function () { if (typeof window.CustomEvent === "function") return false; function CustomEvent(event, params) { params = params || { bubbles: false, cancelable: false, detail: undefined }; var evt = document.createEvent('CustomEvent'); evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); return evt; } CustomEvent.prototype = window.Event.prototype; window.CustomEvent = CustomEvent; })(); /** * Trigget custom JS Event. * * @since 1.4.6 * * @link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent * @param {Node} el Dom Node element on which the event is to be triggered. * @param {Node} typeArg A DOMString representing the name of the event. * @param {String} A CustomEventInit dictionary, having the following fields: * "detail", optional and defaulting to null, of type any, that is an event-dependent value associated with the event. */ var astraTriggerEvent = function astraTriggerEvent( el, typeArg ) { var customEventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var event = new CustomEvent(typeArg, customEventInit); el.dispatchEvent(event); }; /** * Scroll to ID/Top with smooth scroll behavior. * * @since x.x.x * * @param {Event} e Event which is been fired. * @param {String} top offset from top. */ astraSmoothScroll = function astraSmoothScroll( e, top ) { e.preventDefault(); window.scrollTo({ top: top, left: 0, behavior: 'smooth' }); }; /** * Scroll to Top trigger visibility adjustments. * * @since x.x.x * * @param {Node} masthead Page header. * @param {Node} astScrollTop Scroll to Top selector. */ astScrollToTopHandler = function ( masthead, astScrollTop ) { var content = getComputedStyle(astScrollTop).content, device = astScrollTop.dataset.onDevices; content = content.replace( /[^0-9]/g, '' ); if( 'both' == device || ( 'desktop' == device && '769' == content ) || ( 'mobile' == device && '' == content ) ) { // Get current window / document scroll. var scrollTop = window.pageYOffset || document.body.scrollTop; // If masthead found. if( masthead && masthead.length ) { if (scrollTop > masthead.offsetHeight + 100) { astScrollTop.style.display = "block"; } else { astScrollTop.style.display = "none"; } } else { // If there is no masthead set default start scroll if ( window.pageYOffset > 300 ) { astScrollTop.style.display = "block"; } else { astScrollTop.style.display = "none"; } } } else { astScrollTop.style.display = "none"; } }; ( function() { var menu_toggle_all = document.querySelectorAll( '.main-header-menu-toggle' ); var menu_click_listeners_nav = {}; /* Add break point Class and related trigger */ var updateHeaderBreakPoint = function () { // Content overrflowing out of screen can give incorrect window.innerWidth. // Adding overflow hidden and then calculating the window.innerWidth fixes the problem. var originalOverflow = document.querySelector('body').style.overflow; document.querySelector('body').style.overflow = 'hidden'; var ww = window.innerWidth; document.querySelector('body').style.overflow = originalOverflow; var break_point = astra.break_point, headerWrap = document.querySelectorAll('.main-header-bar-wrap'); if (headerWrap.length > 0) { for (var i = 0; i < headerWrap.length; i++) { if (headerWrap[i].tagName == 'DIV' && headerWrap[i].classList.contains('main-header-bar-wrap')) { if (ww > break_point) { //remove menu toggled class. if (null != menu_toggle_all[i]) { menu_toggle_all[i].classList.remove('toggled'); } document.body.classList.remove("ast-header-break-point"); document.body.classList.add("ast-desktop"); astraTriggerEvent(document.body, "astra-header-responsive-enabled"); } else { document.body.classList.add("ast-header-break-point"); document.body.classList.remove("ast-desktop"); astraTriggerEvent(document.body, "astra-header-responsive-disabled") } } } } } updateHeaderBreakPoint(); AstraToggleSubMenu = function() { var parent_li = this.parentNode; if (parent_li.classList.contains('ast-submenu-expanded') && document.querySelector("header.site-header").classList.contains("ast-menu-toggle-link")) { if (!this.classList.contains('ast-menu-toggle')) { var link = parent_li.querySelector('a').getAttribute('href'); if ('' !== link || '#' !== link) { window.location = link; } } } var parent_li_child = parent_li.querySelectorAll('.menu-item-has-children'); for (var j = 0; j < parent_li_child.length; j++) { parent_li_child[j].classList.remove('ast-submenu-expanded'); var parent_li_child_sub_menu = parent_li_child[j].querySelector('.sub-menu, .children'); if( null !== parent_li_child_sub_menu ) { parent_li_child_sub_menu.style.display = 'none'; } } var parent_li_sibling = parent_li.parentNode.querySelectorAll('.menu-item-has-children'); for (var j = 0; j < parent_li_sibling.length; j++) { if (parent_li_sibling[j] != parent_li) { parent_li_sibling[j].classList.remove('ast-submenu-expanded'); var all_sub_menu = parent_li_sibling[j].querySelectorAll('.sub-menu'); for (var k = 0; k < all_sub_menu.length; k++) { all_sub_menu[k].style.display = 'none'; } } } if (parent_li.classList.contains('menu-item-has-children') ) { astraToggleClass(parent_li, 'ast-submenu-expanded'); if (parent_li.classList.contains('ast-submenu-expanded')) { parent_li.querySelector('.sub-menu').style.display = 'block'; } else { parent_li.querySelector('.sub-menu').style.display = 'none'; } } }; AstraNavigationMenu = function( parentList ) { console.warn( 'AstraNavigationMenu() function has been deprecated since version 1.6.5 or above of Astra Theme and will be removed in the future.' ); }; AstraToggleMenu = function( astra_menu_toggle ) { console.warn('AstraToggleMenu() function has been deprecated since version 1.6.5 or above of Astra Theme and will be removed in the future. Use AstraToggleSubMenu() instead.'); // Add Eventlisteners for Submenu. if (astra_menu_toggle.length > 0) { for (var i = 0; i < astra_menu_toggle.length; i++) { astra_menu_toggle[i].addEventListener('click', AstraToggleSubMenu, false); } } }; AstraToggleSetup = function () { var __main_header_all = document.querySelectorAll('.main-header-bar-navigation'); if (menu_toggle_all.length > 0) { for (var i = 0; i < menu_toggle_all.length; i++) { menu_toggle_all[i].setAttribute('data-index', i); if ( ! menu_click_listeners_nav[i] ) { menu_click_listeners_nav[i] = menu_toggle_all[i]; menu_toggle_all[i].addEventListener('click', astraNavMenuToggle, false); } if ('undefined' !== typeof __main_header_all[i]) { if (document.querySelector("header.site-header").classList.contains("ast-menu-toggle-link")) { var astra_menu_toggle = __main_header_all[i].querySelectorAll('.ast-header-break-point .main-header-menu .menu-item-has-children > .menu-link, .ast-header-break-point ul.main-header-menu .ast-menu-toggle'); } else { var astra_menu_toggle = __main_header_all[i].querySelectorAll('ul.main-header-menu .ast-menu-toggle'); } // Add Eventlisteners for Submenu. if (astra_menu_toggle.length > 0) { for (var j = 0; j < astra_menu_toggle.length; j++) { astra_menu_toggle[j].addEventListener('click', AstraToggleSubMenu, false); } } } } } }; astraNavMenuToggle = function ( event ) { event.preventDefault(); var __main_header_all = document.querySelectorAll('.main-header-bar-navigation'); var event_index = this.getAttribute('data-index'); if ('undefined' === typeof __main_header_all[event_index]) { return false; } var menuHasChildren = __main_header_all[event_index].querySelectorAll('.menu-item-has-children'); for (var i = 0; i < menuHasChildren.length; i++) { menuHasChildren[i].classList.remove('ast-submenu-expanded'); var menuHasChildrenSubMenu = menuHasChildren[i].querySelectorAll('.sub-menu'); for (var j = 0; j < menuHasChildrenSubMenu.length; j++) { menuHasChildrenSubMenu[j].style.display = 'none'; } } var menu_class = this.getAttribute('class') || ''; if ( menu_class.indexOf('main-header-menu-toggle') !== -1 ) { astraToggleClass(__main_header_all[event_index], 'toggle-on'); astraToggleClass(menu_toggle_all[event_index], 'toggled'); if (__main_header_all[event_index].classList.contains('toggle-on')) { __main_header_all[event_index].style.display = 'block'; document.body.classList.add("ast-main-header-nav-open"); } else { __main_header_all[event_index].style.display = ''; document.body.classList.remove("ast-main-header-nav-open"); } } }; document.body.addEventListener("astra-header-responsive-enabled", function () { var __main_header_all = document.querySelectorAll('.main-header-bar-navigation'); if (__main_header_all.length > 0) { for (var i = 0; i < __main_header_all.length; i++) { if (null != __main_header_all[i]) { __main_header_all[i].classList.remove('toggle-on'); __main_header_all[i].style.display = ''; } var sub_menu = __main_header_all[i].getElementsByClassName('sub-menu'); for (var j = 0; j < sub_menu.length; j++) { sub_menu[j].style.display = ''; } var child_menu = __main_header_all[i].getElementsByClassName('children'); for (var k = 0; k < child_menu.length; k++) { child_menu[k].style.display = ''; } var searchIcons = __main_header_all[i].getElementsByClassName('ast-search-menu-icon'); for (var l = 0; l < searchIcons.length; l++) { searchIcons[l].classList.remove('ast-dropdown-active'); searchIcons[l].style.display = ''; } } } }, false); window.addEventListener('resize', function () { // Skip resize event when keyboard display event triggers on devices. if( 'INPUT' !== document.activeElement.tagName ) { updateHeaderBreakPoint(); AstraToggleSetup(); } }); document.addEventListener('DOMContentLoaded', function () { AstraToggleSetup(); /** * Navigation Keyboard Navigation. */ var container, count; container = document.querySelectorAll( '.navigation-accessibility' ); for ( count = 0; count <= container.length - 1; count++ ) { if ( container[count] ) { navigation_accessibility( container[count] ); } } }); var get_browser = function () { var ua = navigator.userAgent,tem,M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; if(/trident/i.test(M[1])) { tem = /\brv[ :]+(\d+)/g.exec(ua) || []; return; } if( 'Chrome' === M[1] ) { tem = ua.match(/\bOPR|Edge\/(\d+)/) if(tem != null) { return; } } M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; if((tem = ua.match(/version\/(\d+)/i)) != null) { M.splice(1,1,tem[1]); } var bodyElement = document.body; if( 'Safari' === M[0] && M[1] < 11 ) { bodyElement.classList.add( "ast-safari-browser-less-than-11" ); } } get_browser(); /* Search Script */ var SearchIcons = document.getElementsByClassName( 'astra-search-icon' ); for (var i = 0; i < SearchIcons.length; i++) { SearchIcons[i].onclick = function(event) { if ( this.classList.contains( 'slide-search' ) ) { event.preventDefault(); var sibling = this.parentNode.parentNode.parentNode.querySelector( '.ast-search-menu-icon' ); if ( ! sibling.classList.contains( 'ast-dropdown-active' ) ) { sibling.classList.add( 'ast-dropdown-active' ); sibling.querySelector( '.search-field' ).setAttribute('autocomplete','off'); setTimeout(function() { sibling.querySelector( '.search-field' ).focus(); },200); } else { var searchTerm = sibling.querySelector( '.search-field' ).value || ''; if( '' !== searchTerm ) { sibling.querySelector( '.search-form' ).submit(); } sibling.classList.remove( 'ast-dropdown-active' ); } } } } /* Hide Dropdown on body click*/ document.body.onclick = function( event ) { if ( typeof event.target.classList !== 'undefined' ) { if ( ! event.target.classList.contains( 'ast-search-menu-icon' ) && astraGetParents( event.target, '.ast-search-menu-icon' ).length === 0 && astraGetParents( event.target, '.ast-search-icon' ).length === 0 ) { var dropdownSearchWrap = document.getElementsByClassName( 'ast-search-menu-icon' ); for (var i = 0; i < dropdownSearchWrap.length; i++) { dropdownSearchWrap[i].classList.remove( 'ast-dropdown-active' ); } } } } /** * Navigation Keyboard Navigation. */ function navigation_accessibility( container ) { if ( ! container ) { return; } var button = container.getElementsByTagName( 'button' )[0]; if ( 'undefined' === typeof button ) { button = container.getElementsByTagName( 'a' )[0]; if ( 'undefined' === typeof button ) { return; } } var menu = container.getElementsByTagName( 'ul' )[0]; // Hide menu toggle button if menu is empty and return early. if ( 'undefined' === typeof menu ) { button.style.display = 'none'; return; } menu.setAttribute( 'aria-expanded', 'false' ); if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { menu.className += ' nav-menu'; } button.onclick = function() { if ( -1 !== container.className.indexOf( 'toggled' ) ) { container.className = container.className.replace( ' toggled', '' ); button.setAttribute( 'aria-expanded', 'false' ); menu.setAttribute( 'aria-expanded', 'false' ); } else { container.className += ' toggled'; button.setAttribute( 'aria-expanded', 'true' ); menu.setAttribute( 'aria-expanded', 'true' ); } }; // Get all the link elements within the menu. var links = menu.getElementsByTagName( 'a' ); var subMenus = menu.getElementsByTagName( 'ul' ); // Set menu items with submenus to aria-haspopup="true". for ( var i = 0, len = subMenus.length; i < len; i++ ) { subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); } // Each time a menu link is focused or blurred, toggle focus. for ( i = 0, len = links.length; i < len; i++ ) { links[i].addEventListener( 'focus', toggleFocus, true ); links[i].addEventListener( 'blur', toggleBlurFocus, true ); links[i].addEventListener( 'click', toggleClose, true ); } } /** * Close the Toggle Menu on Click on hash (#) link. * * @since 1.3.2 * @return void */ function toggleClose( ) { var self = this || '', hash = '#'; if( self && ! self.classList.contains('astra-search-icon') ) { var link = new String( self ); if( link.indexOf( hash ) !== -1 ) { var link_parent = self.parentNode; if ( document.body.classList.contains('ast-header-break-point') && ! ( document.querySelector("header.site-header").classList.contains("ast-menu-toggle-link") && link_parent.classList.contains("menu-item-has-children") ) ) { /* Close Main Header Menu */ var main_header_menu_toggle = document.querySelector( '.main-header-menu-toggle' ); main_header_menu_toggle.classList.remove( 'toggled' ); var main_header_bar_navigation = document.querySelector( '.main-header-bar-navigation' ); main_header_bar_navigation.classList.remove( 'toggle-on' ); main_header_bar_navigation.style.display = 'none'; /* Close Below Header Menu */ var before_header_menu_toggle = document.querySelector( '.menu-below-header-toggle' ); var before_header_bar_navigation = document.querySelector( '.ast-below-header' ); var before_header_bar = document.querySelector( '.ast-below-header-actual-nav' ); if ( before_header_menu_toggle && before_header_bar_navigation && before_header_bar ) { before_header_menu_toggle.classList.remove( 'toggled' ); before_header_bar_navigation.classList.remove( 'toggle-on' ); before_header_bar.style.display = 'none'; } /* Close After Header Menu */ var after_header_menu_toggle = document.querySelector( '.menu-above-header-toggle' ); var after_header_bar_navigation = document.querySelector( '.ast-above-header' ); var after_header_bar = document.querySelector( '.ast-above-header-navigation' ); if ( after_header_menu_toggle && after_header_bar_navigation && after_header_bar ) { after_header_menu_toggle.classList.remove( 'toggled' ); after_header_bar_navigation.classList.remove( 'toggle-on' ); after_header_bar.style.display = 'none'; } astraTriggerEvent( document.querySelector('body'), 'astraMenuHashLinkClicked' ); } else { while ( -1 === self.className.indexOf( 'nav-menu' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { if ( -1 !== self.className.indexOf( 'focus' ) ) { self.className = self.className.replace( ' focus', '' ); } } self = self.parentElement; } } } } } /** * Sets or removes .focus class on an element and its ancestors until a specific class is found. * @param {Element} element - The element to apply the .focus class and traverse its ancestors. * @param {string} targetClass - The class name to search for in the ancestors. */ function toggleFocusAndAncestors(element, targetClass) { while (-1 === element.className.indexOf(targetClass)) { if ('li' === element.tagName.toLowerCase()) { if (element.classList.contains('focus')) { element.classList.remove('focus'); } else { element.classList.add('focus'); } } element = element.parentElement; } } /** * Sets or removes .focus class on an element on focus. */ function toggleFocus() { var self = this; toggleFocusAndAncestors(self, 'nav-menu'); } /** * Sets or removes .focus class on an element on blur. */ function toggleBlurFocus() { var self = this || '', hash = '#'; var link = String(self); if (link.includes(hash) && document.body.classList.contains('ast-mouse-clicked')) { return; } toggleFocusAndAncestors(self, 'nav-menu'); } /* Add class if mouse clicked and remove if tab pressed */ if ( 'querySelector' in document && 'addEventListener' in window ) { var body = document.body; body.addEventListener( 'mousedown', function() { body.classList.add( 'ast-mouse-clicked' ); } ); body.addEventListener( 'keydown', function() { body.classList.remove( 'ast-mouse-clicked' ); } ); } /** * Scroll to specific hash link. * * @since x.x.x */ if ( astra.is_scroll_to_id ) { const links = document.querySelectorAll('a[href*="#"]:not([href="#"]):not([href="#0"]):not([href*="uagb-tab"])'); if (links) { for (const link of links) { if (link.hash !== "") { link.addEventListener("click", scrollToIDHandler); } } } function scrollToIDHandler(e) { let offset = 0; const siteHeader = document.querySelector('.site-header'); if (siteHeader) { //Check and add offset to scroll top if header is sticky. const headerHeight = siteHeader.querySelectorAll('div[data-stick-support]'); if (headerHeight) { headerHeight.forEach(single => { offset += single.clientHeight; }); } const href = this.hash; if (href) { const scrollId = document.querySelector(href); if (scrollId) { const scrollOffsetTop = scrollId.offsetTop - offset; if( scrollOffsetTop ) { astraSmoothScroll( e, scrollOffsetTop ); } } } } } } /** * Scroll to top. * * @since x.x.x */ if ( astra.is_scroll_to_top ) { var masthead = document.querySelector( '#page header' ); var astScrollTop = document.getElementById( 'ast-scroll-top' ); astScrollToTopHandler(masthead, astScrollTop); window.addEventListener('scroll', function () { astScrollToTopHandler(masthead, astScrollTop); }); astScrollTop.onclick = function(e){ astraSmoothScroll( e, 0 ); }; } } )(); flexibility.js 0000666 00000063122 15165371455 0007452 0 ustar 00 /** * Flexibility is a JavaScript polyfill for Flexbox By Jonathan Neal, 10up. (https://github.com/jonathantneal/flexibility) * Licensed under MIT ( https://github.com/jonathantneal/flexibility/blob/master/LICENSE.md ) */ ! function(e) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = e(); else if ("function" == typeof define && define.amd) define([], e); else { var t; t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, t.flexibility = e() } }(function() { return function e(t, r, l) { function n(f, i) { if (!r[f]) { if (!t[f]) { var s = "function" == typeof require && require; if (!i && s) return s(f, !0); if (o) return o(f, !0); var a = new Error("Cannot find module '" + f + "'"); throw a.code = "MODULE_NOT_FOUND", a } var c = r[f] = { exports: {} }; t[f][0].call(c.exports, function(e) { var r = t[f][1][e]; return n(r ? r : e) }, c, c.exports, e, t, r, l) } return r[f].exports } for (var o = "function" == typeof require && require, f = 0; f < l.length; f++) n(l[f]); return n }({ 1: [function(e, t, r) { t.exports = function(e) { var t, r, l, n = -1; if (e.lines.length > 1 && "flex-start" === e.style.alignContent) for (t = 0; l = e.lines[++n];) l.crossStart = t, t += l.cross; else if (e.lines.length > 1 && "flex-end" === e.style.alignContent) for (t = e.flexStyle.crossSpace; l = e.lines[++n];) l.crossStart = t, t += l.cross; else if (e.lines.length > 1 && "center" === e.style.alignContent) for (t = e.flexStyle.crossSpace / 2; l = e.lines[++n];) l.crossStart = t, t += l.cross; else if (e.lines.length > 1 && "space-between" === e.style.alignContent) for (r = e.flexStyle.crossSpace / (e.lines.length - 1), t = 0; l = e.lines[++n];) l.crossStart = t, t += l.cross + r; else if (e.lines.length > 1 && "space-around" === e.style.alignContent) for (r = 2 * e.flexStyle.crossSpace / (2 * e.lines.length), t = r / 2; l = e.lines[++n];) l.crossStart = t, t += l.cross + r; else for (r = e.flexStyle.crossSpace / e.lines.length, t = e.flexStyle.crossInnerBefore; l = e.lines[++n];) l.crossStart = t, l.cross += r, t += l.cross } }, {}], 2: [function(e, t, r) { t.exports = function(e) { for (var t, r = -1; line = e.lines[++r];) for (t = -1; child = line.children[++t];) { var l = child.style.alignSelf; "auto" === l && (l = e.style.alignItems), "flex-start" === l ? child.flexStyle.crossStart = line.crossStart : "flex-end" === l ? child.flexStyle.crossStart = line.crossStart + line.cross - child.flexStyle.crossOuter : "center" === l ? child.flexStyle.crossStart = line.crossStart + (line.cross - child.flexStyle.crossOuter) / 2 : (child.flexStyle.crossStart = line.crossStart, child.flexStyle.crossOuter = line.cross, child.flexStyle.cross = child.flexStyle.crossOuter - child.flexStyle.crossBefore - child.flexStyle.crossAfter) } } }, {}], 3: [function(e, t, r) { t.exports = function l(e, l) { var t = "row" === l || "row-reverse" === l, r = e.mainAxis; if (r) { var n = t && "inline" === r || !t && "block" === r; n || (e.flexStyle = { main: e.flexStyle.cross, cross: e.flexStyle.main, mainOffset: e.flexStyle.crossOffset, crossOffset: e.flexStyle.mainOffset, mainBefore: e.flexStyle.crossBefore, mainAfter: e.flexStyle.crossAfter, crossBefore: e.flexStyle.mainBefore, crossAfter: e.flexStyle.mainAfter, mainInnerBefore: e.flexStyle.crossInnerBefore, mainInnerAfter: e.flexStyle.crossInnerAfter, crossInnerBefore: e.flexStyle.mainInnerBefore, crossInnerAfter: e.flexStyle.mainInnerAfter, mainBorderBefore: e.flexStyle.crossBorderBefore, mainBorderAfter: e.flexStyle.crossBorderAfter, crossBorderBefore: e.flexStyle.mainBorderBefore, crossBorderAfter: e.flexStyle.mainBorderAfter }) } else t ? e.flexStyle = { main: e.style.width, cross: e.style.height, mainOffset: e.style.offsetWidth, crossOffset: e.style.offsetHeight, mainBefore: e.style.marginLeft, mainAfter: e.style.marginRight, crossBefore: e.style.marginTop, crossAfter: e.style.marginBottom, mainInnerBefore: e.style.paddingLeft, mainInnerAfter: e.style.paddingRight, crossInnerBefore: e.style.paddingTop, crossInnerAfter: e.style.paddingBottom, mainBorderBefore: e.style.borderLeftWidth, mainBorderAfter: e.style.borderRightWidth, crossBorderBefore: e.style.borderTopWidth, crossBorderAfter: e.style.borderBottomWidth } : e.flexStyle = { main: e.style.height, cross: e.style.width, mainOffset: e.style.offsetHeight, crossOffset: e.style.offsetWidth, mainBefore: e.style.marginTop, mainAfter: e.style.marginBottom, crossBefore: e.style.marginLeft, crossAfter: e.style.marginRight, mainInnerBefore: e.style.paddingTop, mainInnerAfter: e.style.paddingBottom, crossInnerBefore: e.style.paddingLeft, crossInnerAfter: e.style.paddingRight, mainBorderBefore: e.style.borderTopWidth, mainBorderAfter: e.style.borderBottomWidth, crossBorderBefore: e.style.borderLeftWidth, crossBorderAfter: e.style.borderRightWidth }, "content-box" === e.style.boxSizing && ("number" == typeof e.flexStyle.main && (e.flexStyle.main += e.flexStyle.mainInnerBefore + e.flexStyle.mainInnerAfter + e.flexStyle.mainBorderBefore + e.flexStyle.mainBorderAfter), "number" == typeof e.flexStyle.cross && (e.flexStyle.cross += e.flexStyle.crossInnerBefore + e.flexStyle.crossInnerAfter + e.flexStyle.crossBorderBefore + e.flexStyle.crossBorderAfter)); e.mainAxis = t ? "inline" : "block", e.crossAxis = t ? "block" : "inline", "number" == typeof e.style.flexBasis && (e.flexStyle.main = e.style.flexBasis + e.flexStyle.mainInnerBefore + e.flexStyle.mainInnerAfter + e.flexStyle.mainBorderBefore + e.flexStyle.mainBorderAfter), e.flexStyle.mainOuter = e.flexStyle.main, e.flexStyle.crossOuter = e.flexStyle.cross, "auto" === e.flexStyle.mainOuter && (e.flexStyle.mainOuter = e.flexStyle.mainOffset), "auto" === e.flexStyle.crossOuter && (e.flexStyle.crossOuter = e.flexStyle.crossOffset), "number" == typeof e.flexStyle.mainBefore && (e.flexStyle.mainOuter += e.flexStyle.mainBefore), "number" == typeof e.flexStyle.mainAfter && (e.flexStyle.mainOuter += e.flexStyle.mainAfter), "number" == typeof e.flexStyle.crossBefore && (e.flexStyle.crossOuter += e.flexStyle.crossBefore), "number" == typeof e.flexStyle.crossAfter && (e.flexStyle.crossOuter += e.flexStyle.crossAfter) } }, {}], 4: [function(e, t, r) { var l = e("../reduce"); t.exports = function(e) { if (e.mainSpace > 0) { var t = l(e.children, function(e, t) { return e + parseFloat(t.style.flexGrow) }, 0); t > 0 && (e.main = l(e.children, function(r, l) { return "auto" === l.flexStyle.main ? l.flexStyle.main = l.flexStyle.mainOffset + parseFloat(l.style.flexGrow) / t * e.mainSpace : l.flexStyle.main += parseFloat(l.style.flexGrow) / t * e.mainSpace, l.flexStyle.mainOuter = l.flexStyle.main + l.flexStyle.mainBefore + l.flexStyle.mainAfter, r + l.flexStyle.mainOuter }, 0), e.mainSpace = 0) } } }, { "../reduce": 12 }], 5: [function(e, t, r) { var l = e("../reduce"); t.exports = function(e) { if (e.mainSpace < 0) { var t = l(e.children, function(e, t) { return e + parseFloat(t.style.flexShrink) }, 0); t > 0 && (e.main = l(e.children, function(r, l) { return l.flexStyle.main += parseFloat(l.style.flexShrink) / t * e.mainSpace, l.flexStyle.mainOuter = l.flexStyle.main + l.flexStyle.mainBefore + l.flexStyle.mainAfter, r + l.flexStyle.mainOuter }, 0), e.mainSpace = 0) } } }, { "../reduce": 12 }], 6: [function(e, t, r) { var l = e("../reduce"); t.exports = function(e) { var t; e.lines = [t = { main: 0, cross: 0, children: [] }]; for (var r, n = -1; r = e.children[++n];) "nowrap" === e.style.flexWrap || 0 === t.children.length || "auto" === e.flexStyle.main || e.flexStyle.main - e.flexStyle.mainInnerBefore - e.flexStyle.mainInnerAfter - e.flexStyle.mainBorderBefore - e.flexStyle.mainBorderAfter >= t.main + r.flexStyle.mainOuter ? (t.main += r.flexStyle.mainOuter, t.cross = Math.max(t.cross, r.flexStyle.crossOuter)) : e.lines.push(t = { main: r.flexStyle.mainOuter, cross: r.flexStyle.crossOuter, children: [] }), t.children.push(r); e.flexStyle.mainLines = l(e.lines, function(e, t) { return Math.max(e, t.main) }, 0), e.flexStyle.crossLines = l(e.lines, function(e, t) { return e + t.cross }, 0), "auto" === e.flexStyle.main && (e.flexStyle.main = Math.max(e.flexStyle.mainOffset, e.flexStyle.mainLines + e.flexStyle.mainInnerBefore + e.flexStyle.mainInnerAfter + e.flexStyle.mainBorderBefore + e.flexStyle.mainBorderAfter)), "auto" === e.flexStyle.cross && (e.flexStyle.cross = Math.max(e.flexStyle.crossOffset, e.flexStyle.crossLines + e.flexStyle.crossInnerBefore + e.flexStyle.crossInnerAfter + e.flexStyle.crossBorderBefore + e.flexStyle.crossBorderAfter)), e.flexStyle.crossSpace = e.flexStyle.cross - e.flexStyle.crossInnerBefore - e.flexStyle.crossInnerAfter - e.flexStyle.crossBorderBefore - e.flexStyle.crossBorderAfter - e.flexStyle.crossLines, e.flexStyle.mainOuter = e.flexStyle.main + e.flexStyle.mainBefore + e.flexStyle.mainAfter, e.flexStyle.crossOuter = e.flexStyle.cross + e.flexStyle.crossBefore + e.flexStyle.crossAfter } }, { "../reduce": 12 }], 7: [function(e, t, r) { function l(t) { for (var r, l = -1; r = t.children[++l];) e("./flex-direction")(r, t.style.flexDirection); e("./flex-direction")(t, t.style.flexDirection), e("./order")(t), e("./flexbox-lines")(t), e("./align-content")(t), l = -1; for (var n; n = t.lines[++l];) n.mainSpace = t.flexStyle.main - t.flexStyle.mainInnerBefore - t.flexStyle.mainInnerAfter - t.flexStyle.mainBorderBefore - t.flexStyle.mainBorderAfter - n.main, e("./flex-grow")(n), e("./flex-shrink")(n), e("./margin-main")(n), e("./margin-cross")(n), e("./justify-content")(n, t.style.justifyContent, t); e("./align-items")(t) } t.exports = l }, { "./align-content": 1, "./align-items": 2, "./flex-direction": 3, "./flex-grow": 4, "./flex-shrink": 5, "./flexbox-lines": 6, "./justify-content": 8, "./margin-cross": 9, "./margin-main": 10, "./order": 11 }], 8: [function(e, t, r) { t.exports = function(e, t, r) { var l, n, o, f = r.flexStyle.mainInnerBefore, i = -1; if ("flex-end" === t) for (l = e.mainSpace, l += f; o = e.children[++i];) o.flexStyle.mainStart = l, l += o.flexStyle.mainOuter; else if ("center" === t) for (l = e.mainSpace / 2, l += f; o = e.children[++i];) o.flexStyle.mainStart = l, l += o.flexStyle.mainOuter; else if ("space-between" === t) for (n = e.mainSpace / (e.children.length - 1), l = 0, l += f; o = e.children[++i];) o.flexStyle.mainStart = l, l += o.flexStyle.mainOuter + n; else if ("space-around" === t) for (n = 2 * e.mainSpace / (2 * e.children.length), l = n / 2, l += f; o = e.children[++i];) o.flexStyle.mainStart = l, l += o.flexStyle.mainOuter + n; else for (l = 0, l += f; o = e.children[++i];) o.flexStyle.mainStart = l, l += o.flexStyle.mainOuter } }, {}], 9: [function(e, t, r) { t.exports = function(e) { for (var t, r = -1; t = e.children[++r];) { var l = 0; "auto" === t.flexStyle.crossBefore && ++l, "auto" === t.flexStyle.crossAfter && ++l; var n = e.cross - t.flexStyle.crossOuter; "auto" === t.flexStyle.crossBefore && (t.flexStyle.crossBefore = n / l), "auto" === t.flexStyle.crossAfter && (t.flexStyle.crossAfter = n / l), "auto" === t.flexStyle.cross ? t.flexStyle.crossOuter = t.flexStyle.crossOffset + t.flexStyle.crossBefore + t.flexStyle.crossAfter : t.flexStyle.crossOuter = t.flexStyle.cross + t.flexStyle.crossBefore + t.flexStyle.crossAfter } } }, {}], 10: [function(e, t, r) { t.exports = function(e) { for (var t, r = 0, l = -1; t = e.children[++l];) "auto" === t.flexStyle.mainBefore && ++r, "auto" === t.flexStyle.mainAfter && ++r; if (r > 0) { for (l = -1; t = e.children[++l];) "auto" === t.flexStyle.mainBefore && (t.flexStyle.mainBefore = e.mainSpace / r), "auto" === t.flexStyle.mainAfter && (t.flexStyle.mainAfter = e.mainSpace / r), "auto" === t.flexStyle.main ? t.flexStyle.mainOuter = t.flexStyle.mainOffset + t.flexStyle.mainBefore + t.flexStyle.mainAfter : t.flexStyle.mainOuter = t.flexStyle.main + t.flexStyle.mainBefore + t.flexStyle.mainAfter; e.mainSpace = 0 } } }, {}], 11: [function(e, t, r) { var l = /^(column|row)-reverse$/; t.exports = function(e) { e.children.sort(function(e, t) { return e.style.order - t.style.order || e.index - t.index }), l.test(e.style.flexDirection) && e.children.reverse() } }, {}], 12: [function(e, t, r) { function l(e, t, r) { for (var l = e.length, n = -1; ++n < l;) n in e && (r = t(r, e[n], n)); return r } t.exports = l }, {}], 13: [function(e, t, r) { function l(e) { i(f(e)) } var n = e("./read"), o = e("./write"), f = e("./readAll"), i = e("./writeAll"); t.exports = l, t.exports.read = n, t.exports.write = o, t.exports.readAll = f, t.exports.writeAll = i }, { "./read": 15, "./readAll": 16, "./write": 17, "./writeAll": 18 }], 14: [function(e, t, r) { function l(e, t, r) { var l = e[t], f = String(l).match(o); if (!f) { var a = t.match(s); if (a) { var c = e["border" + a[1] + "Style"]; return "none" === c ? 0 : i[l] || 0 } return l } var y = f[1], x = f[2]; return "px" === x ? 1 * y : "cm" === x ? .3937 * y * 96 : "in" === x ? 96 * y : "mm" === x ? .3937 * y * 96 / 10 : "pc" === x ? 12 * y * 96 / 72 : "pt" === x ? 96 * y / 72 : "rem" === x ? 16 * y : n(l, r) } function n(e, t) { f.style.cssText = "border:none!important;clip:rect(0 0 0 0)!important;display:block!important;font-size:1em!important;height:0!important;margin:0!important;padding:0!important;position:relative!important;width:" + e + "!important", t.parentNode.insertBefore(f, t.nextSibling); var r = f.offsetWidth; return t.parentNode.removeChild(f), r } t.exports = l; var o = /^([-+]?\d*\.?\d+)(%|[a-z]+)$/, f = document.createElement("div"), i = { medium: 4, none: 0, thick: 6, thin: 2 }, s = /^border(Bottom|Left|Right|Top)Width$/ }, {}], 15: [function(e, t, r) { function l(e) { var t = { alignContent: "stretch", alignItems: "stretch", alignSelf: "auto", borderBottomStyle: "none", borderBottomWidth: 0, borderLeftStyle: "none", borderLeftWidth: 0, borderRightStyle: "none", borderRightWidth: 0, borderTopStyle: "none", borderTopWidth: 0, boxSizing: "content-box", display: "inline", flexBasis: "auto", flexDirection: "row", flexGrow: 0, flexShrink: 1, flexWrap: "nowrap", justifyContent: "flex-start", height: "auto", marginTop: 0, marginRight: 0, marginLeft: 0, marginBottom: 0, paddingTop: 0, paddingRight: 0, paddingLeft: 0, paddingBottom: 0, maxHeight: "none", maxWidth: "none", minHeight: 0, minWidth: 0, order: 0, position: "static", width: "auto" }, r = e instanceof Element; if (r) { var l = e.hasAttribute("data-style"), i = l ? e.getAttribute("data-style") : e.getAttribute("style") || ""; l || e.setAttribute("data-style", i); var s = window.getComputedStyle && getComputedStyle(e) || {}; f(t, s); var c = e.currentStyle || {}; n(t, c), o(t, i); for (var y in t) t[y] = a(t, y, e); var x = e.getBoundingClientRect(); t.offsetHeight = x.height || e.offsetHeight, t.offsetWidth = x.width || e.offsetWidth } var S = { element: e, style: t }; return S } function n(e, t) { for (var r in e) { var l = r in t; if (l) e[r] = t[r]; else { // Replace uppercase characters with lowercase. var n = r.replace(/[A-Z]/g, "-$&").toLowerCase(), o = n in t; o && (e[r] = t[n]) } } var f = "-js-display" in t; f && (e.display = t["-js-display"]) } function o(e, t) { for (var r; r = i.exec(t);) { // Replace lowercase characters with uppercase. var l = r[1].toLowerCase().replace(/-[a-z]/g, function(e) { return e.slice(1).toUpperCase() }); e[l] = r[2] } } function f(e, t) { for (var r in e) { var l = r in t; l && !s.test(r) && (e[r] = t[r]) } } t.exports = l; var i = /([^\s:;]+)\s*:\s*([^;]+?)\s*(;|$)/g, s = /^(alignSelf|height|width)$/, a = e("./getComputedLength") }, { "./getComputedLength": 14 }], 16: [function(e, t, r) { function l(e) { var t = []; return n(e, t), t } function n(e, t) { for (var r, l = o(e), i = [], s = -1; r = e.childNodes[++s];) { var a = 3 === r.nodeType && !/^\s*$/.test(r.nodeValue); if (l && a) { var c = r; r = e.insertBefore(document.createElement("flex-item"), c), r.appendChild(c) } var y = r instanceof Element; if (y) { var x = n(r, t); if (l) { var S = r.style; S.display = "inline-block", S.position = "absolute", x.style = f(r).style, i.push(x) } } } var m = { element: e, children: i }; return l && (m.style = f(e).style, t.push(m)), m } function o(e) { var t = e instanceof Element, r = t && e.getAttribute("data-style"), l = t && e.currentStyle && e.currentStyle["-js-display"], n = i.test(r) || s.test(l); return n } t.exports = l; var f = e("../read"), i = /(^|;)\s*display\s*:\s*(inline-)?flex\s*(;|$)/i, s = /^(inline-)?flex$/i }, { "../read": 15 }], 17: [function(e, t, r) { function l(e) { o(e); var t = e.element.style, r = "inline" === e.mainAxis ? ["main", "cross"] : ["cross", "main"]; t.boxSizing = "content-box", t.display = "block", t.position = "relative", t.width = n(e.flexStyle[r[0]] - e.flexStyle[r[0] + "InnerBefore"] - e.flexStyle[r[0] + "InnerAfter"] - e.flexStyle[r[0] + "BorderBefore"] - e.flexStyle[r[0] + "BorderAfter"]), t.height = n(e.flexStyle[r[1]] - e.flexStyle[r[1] + "InnerBefore"] - e.flexStyle[r[1] + "InnerAfter"] - e.flexStyle[r[1] + "BorderBefore"] - e.flexStyle[r[1] + "BorderAfter"]); for (var l, f = -1; l = e.children[++f];) { var i = l.element.style, s = "inline" === l.mainAxis ? ["main", "cross"] : ["cross", "main"]; i.boxSizing = "content-box", i.display = "block", i.position = "absolute", "auto" !== l.flexStyle[s[0]] && (i.width = n(l.flexStyle[s[0]] - l.flexStyle[s[0] + "InnerBefore"] - l.flexStyle[s[0] + "InnerAfter"] - l.flexStyle[s[0] + "BorderBefore"] - l.flexStyle[s[0] + "BorderAfter"])), "auto" !== l.flexStyle[s[1]] && (i.height = n(l.flexStyle[s[1]] - l.flexStyle[s[1] + "InnerBefore"] - l.flexStyle[s[1] + "InnerAfter"] - l.flexStyle[s[1] + "BorderBefore"] - l.flexStyle[s[1] + "BorderAfter"])), i.top = n(l.flexStyle[s[1] + "Start"]), i.left = n(l.flexStyle[s[0] + "Start"]), i.marginTop = n(l.flexStyle[s[1] + "Before"]), i.marginRight = n(l.flexStyle[s[0] + "After"]), i.marginBottom = n(l.flexStyle[s[1] + "After"]), i.marginLeft = n(l.flexStyle[s[0] + "Before"]) } } function n(e) { return "string" == typeof e ? e : Math.max(e, 0) + "px" } t.exports = l; var o = e("../flexbox") }, { "../flexbox": 7 }], 18: [function(e, t, r) { function l(e) { for (var t, r = -1; t = e[++r];) n(t) } t.exports = l; var n = e("../write") }, { "../write": 17 }] }, {}, [13])(13) }); add-to-cart-quantity-btn.js 0000666 00000023720 15165371455 0011662 0 ustar 00 /** * WooCommerce quantity buttons. * * @since x.x.x */ window.addEventListener( "load", function(e) { astrawpWooQuantityButtons(); }); // Here we are selecting the node that will be observed for mutations. const astraminiCarttargetNode = document.getElementById("ast-site-header-cart"); if (astraminiCarttargetNode != null) { const config = { attributes: false, childList: true, subtree: true }; const astraMinicartObserver = () => { astrawpWooQuantityButtons(); }; const observer = new MutationObserver(astraMinicartObserver); observer.observe(astraminiCarttargetNode, config); } /**This comment explains that in order to refresh the wc_fragments_refreshed event when an AJAX call is made, jQuery is used to update the quantity button. * Here plain JavaScript may not be able to trigger the wc_fragments_refreshed event in the same way, * hence the need to use jQuery */ jQuery( function( $ ) { $( document.body ).on( 'wc_fragments_refreshed', function() { astrawpWooQuantityButtons(); }); }); (function() { var send = XMLHttpRequest.prototype.send XMLHttpRequest.prototype.send = function() { this.addEventListener('load', function() { astrawpWooQuantityButtons(); }) return send.apply(this, arguments) } })(); /** * Astra WooCommerce Quantity Buttons. */ function astrawpWooQuantityButtons( $quantitySelector ) { var $cart = document.querySelector( '.woocommerce div.product form.cart' ); if ( ! $quantitySelector ) { $quantitySelector = '.qty'; } $quantityBoxesWrap = document.querySelectorAll( 'div.quantity:not(.elementor-widget-woocommerce-cart .quantity):not(.buttons_added), td.quantity:not(.elementor-widget-woocommerce-cart .quantity):not(.buttons_added)' ); for ( var i = 0; i < $quantityBoxesWrap.length; i++ ) { var e = $quantityBoxesWrap[i]; var $quantityBoxes = e.querySelector( $quantitySelector ); if ( $quantityBoxes && 'date' !== $quantityBoxes.getAttribute( 'type' ) && 'hidden' !== $quantityBoxes.getAttribute( 'type' ) ) { // Add plus and minus icons. $qty_parent = $quantityBoxes.parentElement; $qty_parent.classList.add( 'buttons_added' ); switch ( astra_qty_btn.style_type ) { case 'no-internal-border': $quantityBoxes.classList.add( 'ast-no-internal-border' ); $qty_parent.insertAdjacentHTML( 'afterbegin', '<label class="screen-reader-text" for="minus_qty">' + astra_qty_btn.minus_qty + '</label><a href="javascript:void(0)" id ="minus_qty" class="minus no-internal-border">-</a>' ); $qty_parent.insertAdjacentHTML( 'beforeend', '<label class="screen-reader-text" for="plus_qty"> '+ astra_qty_btn.plus_qty + '</label><a href="javascript:void(0)" id ="plus_qty" class="plus no-internal-border">+</a> ' ); break; case 'vertical-icon': $qty_parent.classList.add( 'ast-vertical-style-applied' ); $quantityBoxes.classList.add( 'vertical-icons-applied' ); $qty_parent.insertAdjacentHTML( 'beforeend', '<label class="screen-reader-text" for="plus_qty"> '+ astra_qty_btn.plus_qty + '</label><a href="javascript:void(0)" id ="plus_qty" class="plus ast-vertical-icon">+</a>'+ '<label class="screen-reader-text" for="minus_qty">' + astra_qty_btn.minus_qty + '</label><a href="javascript:void(0)" id ="minus_qty" class="minus ast-vertical-icon">-</a>' ); break; default: $qty_parent.insertAdjacentHTML( 'afterbegin', '<label class="screen-reader-text" for="minus_qty">' + astra_qty_btn.minus_qty + '</label><a href="javascript:void(0)" id ="minus_qty" class="minus">-</a>' ); $qty_parent.insertAdjacentHTML( 'beforeend', '<label class="screen-reader-text" for="plus_qty"> '+ astra_qty_btn.plus_qty + '</label><a href="javascript:void(0)" id ="plus_qty" class="plus">+</a>' ); break; } $quantityEach = document.querySelectorAll( 'input' + $quantitySelector + ':not(.product-quantity)' ); for ( var j = 0; j < $quantityEach.length; j++ ) { var el = $quantityEach[j]; var $min = el.getAttribute( 'min' ); if ( $min && $min > 0 && parseFloat( el.value ) < $min ) { el.value = $min; } } // Quantity input. let objbody = document.getElementsByTagName('BODY')[0]; let cart = document.getElementsByClassName('cart')[0]; if (objbody.classList.contains('single-product') && !cart.classList.contains('grouped_form')) { let quantityInput = document.querySelector('.woocommerce input[type=number].qty'); // Check for single product page. if (quantityInput) { quantityInput.addEventListener('keyup', function () { let qtyVal = quantityInput.value; quantityInput.value = qtyVal; }); } } var plus_minus_obj = e.querySelectorAll( '.plus, .minus' ); for ( var l = 0; l < plus_minus_obj.length; l++ ) { var pm_el = plus_minus_obj[l]; pm_el.addEventListener( "click", function(ev) { // Quantity. var $quantityBox; $quantityBox = ev.target.parentElement.querySelector( $quantitySelector ); // Get values. var $currentQuantity = parseFloat( $quantityBox.value ), $maxQuantity = parseFloat( $quantityBox.getAttribute( 'max' ) ), $minQuantity = parseFloat( $quantityBox.getAttribute( 'min' ) ), $step = parseFloat( $quantityBox.getAttribute( 'step' ) ), checkStepInteger = Number.isInteger( $step ), finalValue; // Fallback default values. if ( ! $currentQuantity || '' === $currentQuantity || 'NaN' === $currentQuantity ) { $currentQuantity = 0; } if ( '' === $maxQuantity || 'NaN' === $maxQuantity ) { $maxQuantity = ''; } if ( '' === $minQuantity || 'NaN' === $minQuantity ) { $minQuantity = 0; } if ( 'any' === $step || '' === $step || undefined === $step || 'NaN' === $step ) { $step = 1; } // Change the value. if ( ev.target.classList.contains( 'plus' ) ) { if ( $maxQuantity && ( $maxQuantity == $currentQuantity || $currentQuantity > $maxQuantity ) ) { $quantityBox.value = $maxQuantity; } else { finalValue = $currentQuantity + parseFloat( $step ); $quantityBox.value = checkStepInteger ? finalValue : ( finalValue ).toFixed(1); } } else { if ( $minQuantity && ( $minQuantity == $currentQuantity || $currentQuantity < $minQuantity ) ) { $quantityBox.value = $minQuantity; } else if ( $currentQuantity > 0 ) { finalValue = $currentQuantity - parseFloat( $step ); $quantityBox.value = checkStepInteger ? finalValue : ( finalValue ).toFixed(1); } } // Trigger the change event on the input. var changeEvent = new Event('change', { bubbles: true }); $quantityBox.dispatchEvent(changeEvent); // Trigger change event. var update_cart_btn = document.getElementsByName("update_cart"); if (update_cart_btn.length > 0) { for ( var btn = 0; btn < update_cart_btn.length; btn++ ) { update_cart_btn[btn].disabled = false; update_cart_btn[btn].click(); } } // Send AJAX request from mini cart. const miniCart = ev.currentTarget.closest( '.woocommerce-mini-cart' ); if ( miniCart && astra && astra.single_product_qty_ajax_nonce && astra.ajax_url ) { let quantity = $quantityBox.value; let itemHash = $quantityBox.getAttribute('name').replace(/cart\[([\w]+)\]\[qty\]/g, '$1'); let qtyNonce = astra.single_product_qty_ajax_nonce; miniCart.classList.add('ajax-mini-cart-qty-loading'); // Creating a XMLHttpRequest object. let xhrRequest = new XMLHttpRequest(); xhrRequest.open( 'POST', astra.ajax_url, true ); // Send the proper header information along with the request xhrRequest.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" ); xhrRequest.send( 'action=astra_add_cart_single_product_quantity&hash=' + itemHash + '&quantity=' + quantity + '&qtyNonce=' + qtyNonce ); xhrRequest.onload = function () { if ( xhrRequest.readyState == XMLHttpRequest.DONE ) { // XMLHttpRequest.DONE == 4 if ( 200 <= xhrRequest.status || 400 <= xhrRequest.status ) { // Trigger event so themes can refresh other areas. var event = document.createEvent( 'HTMLEvents' ); event.initEvent( 'wc_fragment_refresh', true, false ); document.body.dispatchEvent(event); miniCart.classList.remove('ajax-mini-cart-qty-loading'); if ( typeof wc_add_to_cart_params === 'undefined' ) { return; } } } }; } }, false); } } } } customizer-controls.js 0000666 00000004073 15165371455 0011173 0 ustar 00 /** * 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(); }, /** * Initializes the logic for showing and hiding controls * when a setting changes. * * @since 1.0.0 * @access private * @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 ); }); }); }); }); }); } }; $( 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 ); extend-customizer.js 0000666 00000015335 15165371455 0010622 0 ustar 00 /** * Extend Customizer Panel * * @package Astra */ ( function( $ ) { var api = wp.customize; api.bind( 'pane-contents-reflowed', function() { // Reflow sections var sections = []; api.section.each( function( section ) { if ( 'ast_section' !== section.params.type || 'undefined' === typeof section.params.section ) { return; } sections.push( section ); }); sections.sort( api.utils.prioritySort ).reverse(); $.each( sections, function( i, section ) { var parentContainer = $( '#sub-accordion-section-' + section.params.section ); parentContainer.children( '.section-meta' ).after( section.headContainer ); }); // Reflow panels var panels = []; api.panel.each( function( panel ) { if ( 'ast_panel' !== panel.params.type || 'undefined' === typeof panel.params.panel ) { return; } panels.push( panel ); }); panels.sort( api.utils.prioritySort ).reverse(); $.each( panels, function( i, panel ) { var parentContainer = $( '#sub-accordion-panel-' + panel.params.panel ); parentContainer.children( '.panel-meta' ).after( panel.headContainer ); }); }); // Extend Panel var _panelEmbed = wp.customize.Panel.prototype.embed; var _panelIsContextuallyActive = wp.customize.Panel.prototype.isContextuallyActive; var _panelAttachEvents = wp.customize.Panel.prototype.attachEvents; wp.customize.Panel = wp.customize.Panel.extend({ attachEvents: function() { if ( 'ast_panel' !== this.params.type || 'undefined' === typeof this.params.panel ) { _panelAttachEvents.call( this ); return; } _panelAttachEvents.call( this ); var panel = this; panel.expanded.bind( function( expanded ) { var parent = api.panel( panel.params.panel ); if ( expanded ) { parent.contentContainer.addClass( 'current-panel-parent' ); } else { parent.contentContainer.removeClass( 'current-panel-parent' ); } }); panel.container.find( '.customize-panel-back' ) .off( 'click keydown' ) .on( 'click keydown', function( event ) { if ( api.utils.isKeydownButNotEnterEvent( event ) ) { return; } event.preventDefault(); // Keep this AFTER the key filter above if ( panel.expanded() ) { api.panel( panel.params.panel ).expand(); } }); }, embed: function() { if ( 'ast_panel' !== this.params.type || 'undefined' === typeof this.params.panel ) { _panelEmbed.call( this ); return; } _panelEmbed.call( this ); var panel = this; var parentContainer = $( '#sub-accordion-panel-' + this.params.panel ); parentContainer.append( panel.headContainer ); }, isContextuallyActive: function() { if ( 'ast_panel' !== this.params.type ) { return _panelIsContextuallyActive.call( this ); } var panel = this; var children = this._children( 'panel', 'section' ); api.panel.each( function( child ) { if ( ! child.params.panel ) { return; } if ( child.params.panel !== panel.id ) { return; } children.push( child ); }); children.sort( api.utils.prioritySort ); var activeCount = 0; _( children ).each( function ( child ) { if ( child.active() && child.isContextuallyActive() ) { activeCount += 1; } }); return ( activeCount !== 0 ); } }); // Extend Section var _sectionEmbed = wp.customize.Section.prototype.embed; var _sectionIsContextuallyActive = wp.customize.Section.prototype.isContextuallyActive; var _sectionAttachEvents = wp.customize.Section.prototype.attachEvents; wp.customize.Section = wp.customize.Section.extend({ attachEvents: function() { if ( 'ast_section' !== this.params.type || 'undefined' === typeof this.params.section ) { _sectionAttachEvents.call( this ); return; } _sectionAttachEvents.call( this ); var section = this; section.expanded.bind( function( expanded ) { var parent = api.section( section.params.section ); if ( expanded ) { parent.contentContainer.addClass( 'current-section-parent' ); } else { parent.contentContainer.removeClass( 'current-section-parent' ); } }); section.container.find( '.customize-section-back' ) .off( 'click keydown' ) .on( 'click keydown', function( event ) { if ( api.utils.isKeydownButNotEnterEvent( event ) ) { return; } event.preventDefault(); // Keep this AFTER the key filter above if ( section.expanded() ) { api.section( section.params.section ).expand(); } }); }, embed: function() { if ( 'ast_section' !== this.params.type || 'undefined' === typeof this.params.section ) { _sectionEmbed.call( this ); return; } _sectionEmbed.call( this ); var section = this; var parentContainer = $( '#sub-accordion-section-' + this.params.section ); parentContainer.append( section.headContainer ); }, isContextuallyActive: function() { if ( 'ast_section' !== this.params.type ) { return _sectionIsContextuallyActive.call( this ); } var section = this; var children = this._children( 'section', 'control' ); api.section.each( function( child ) { if ( ! child.params.section ) { return; } if ( child.params.section !== section.id ) { return; } children.push( child ); }); children.sort( api.utils.prioritySort ); var activeCount = 0; _( children ).each( function ( child ) { if ( 'undefined' !== typeof child.isContextuallyActive ) { if ( child.active() && child.isContextuallyActive() ) { activeCount += 1; } } else { if ( child.active() ) { activeCount += 1; } } }); return ( activeCount !== 0 ); } }); })( jQuery ); customizer-controls-toggle.js 0000666 00000005433 15165371455 0012453 0 ustar 00 /** * Customizer controls toggles * * @package Astra */ ( function( $ ) { /** * Trigger hooks */ ASTControlTrigger = { /** * Trigger a hook. * * @since 1.0.0 * @method triggerHook * @param {String} hook The hook to trigger. * @param {Array} args An array of args to pass to the hook. */ triggerHook: function( hook, args ) { $( 'body' ).trigger( 'astra-control-trigger.' + hook, args ); }, /** * Add a hook. * * @since 1.0.0 * @method addHook * @param {String} hook The hook to add. * @param {Function} callback A function to call when the hook is triggered. */ addHook: function( hook, callback ) { $( 'body' ).on( 'astra-control-trigger.' + hook, callback ); }, /** * Remove a hook. * * @since 1.0.0 * @method removeHook * @param {String} hook The hook to remove. * @param {Function} callback The callback function to remove. */ removeHook: function( hook, callback ) { $( 'body' ).off( 'astra-control-trigger.' + hook, callback ); }, }; /** * Helper class that contains data for showing and hiding controls. * * @since 1.0.0 * @class ASTCustomizerToggles */ ASTCustomizerToggles = { 'astra-settings[display-site-title-responsive]' : [], 'astra-settings[display-site-tagline-responsive]' : [], 'astra-settings[ast-header-retina-logo]' :[], 'custom_logo' : [], /** * Section - Header * * @link ?autofocus[section]=section-header */ /** * Layout 2 */ // Layout 2 > Right Section > Text / HTML // Layout 2 > Right Section > Search Type // Layout 2 > Right Section > Search Type > Search Box Type. 'astra-settings[header-main-rt-section]' : [], 'astra-settings[hide-custom-menu-mobile]' :[], /** * Blog */ 'astra-settings[blog-width]' :[], 'astra-settings[blog-post-structure]' :[], /** * Blog Single */ 'astra-settings[blog-single-post-structure]' : [], 'astra-settings[blog-single-width]' : [], 'astra-settings[blog-single-meta]' :[], /** * Small Footer */ 'astra-settings[footer-sml-layout]' : [], 'astra-settings[footer-sml-section-1]' :[], 'astra-settings[footer-sml-section-2]' :[], 'astra-settings[footer-sml-divider]' :[], 'astra-settings[header-main-sep]' :[], 'astra-settings[disable-primary-nav]' :[], /** * Footer Widgets */ 'astra-settings[footer-adv]' :[], 'astra-settings[shop-archive-width]' :[], 'astra-settings[mobile-header-logo]' :[], 'astra-settings[different-mobile-logo]' :[], }; } )( jQuery );
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings