/** * Customizer controls toggles * * @package Artech */ ( function( $ ) { /* Internal shorthand */ var api = wp.customize; /** * Trigger hooks */ ARTECH_ControlTrigger = { /** * 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( 'artech-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( 'artech-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( 'artech-control-trigger.' + hook, callback ); }, }; /** * Helper class that contains data for showing and hiding controls. * * @since 1.0.0 * @class ARTECH_CustomizerToggles */ ARTECH_CustomizerToggles = { /** * Mobile Logo */ 'mobile_logo_on' : [ { controls: [ 'mobile_logo' ], callback: function( mobile_logo ) { var mobile_logo = api( 'mobile_logo_on' ).get(); if ( '1' == mobile_logo ) { return true; } return false; } } ], /** * hs_nav_toggle */ 'hs_nav_toggle' : [ { controls: [ 'artech_toggle_content', ], callback: function( hs_nav_toggle ) { var hs_nav_toggle = api( 'hs_nav_toggle' ).get(); if ( '1' == hs_nav_toggle ) { return true; } return false; } } ], /** * hide_show_social_icon */ 'hide_show_social_icon' : [ { controls: [ 'social_icons', ], callback: function( hide_show_social_icon ) { var hide_show_social_icon = api( 'hide_show_social_icon' ).get(); if ( '1' == hide_show_social_icon ) { return true; } return false; } } ], /** * hide_show_email_details */ 'hide_show_email_details' : [ { controls: [ 'tlh_email_icon', 'tlh_email_title', 'tlh_email_link', ], callback: function( hide_show_email_details ) { var hide_show_email_details = api( 'hide_show_email_details' ).get(); if ( '1' == hide_show_email_details ) { return true; } return false; } } ], /** * hide_show_mbl_details */ 'hide_show_mbl_details' : [ { controls: [ 'tlh_mobile_icon', 'tlh_mobile_title', 'tlh_mobile_link', ], callback: function( hide_show_mbl_details ) { var hide_show_mbl_details = api( 'hide_show_mbl_details' ).get(); if ( '1' == hide_show_mbl_details ) { return true; } return false; } } ], /** * hs_scroller */ 'hs_scroller' : [ { controls: [ 'scroller_icon' ], callback: function( hs_scroller ) { var hs_scroller = api( 'hs_scroller' ).get(); if ( '1' == hs_scroller ) { return true; } return false; } } ], /** * hs_breadcrumb */ 'hs_breadcrumb' : [ { controls: [ 'breadcrumb_seprator', 'breadcrumb_bg_head', 'breadcrumb_bg_img', 'breadcrumb_back_attach', 'breadcrumb_bg_img_opacity', 'breadcrumb_overlay_color', 'breadcrumb_typography', 'breadcrumb_title_size', 'breadcrumb_content_size', ], callback: function( hs_breadcrumb ) { var hs_breadcrumb = api( 'hs_breadcrumb' ).get(); if ( '1' == hs_breadcrumb ) { return true; } return false; } } ], /** * Slider */ 'slider_overlay_enable' : [ { controls: [ 'slide_overlay_color', 'slider_opacity' ], callback: function( slider_overlay_enable ) { var slider_overlay_enable = api( 'slider_overlay_enable' ).get(); if ( '1' == slider_overlay_enable ) { return true; } return false; } } ], /** * Color */ 'theme_color_enable' : [ { controls: [ 'primary_color1', 'primary_color2', 'secondary_color1', 'secondary_color2' ], callback: function( theme_color_enable ) { var theme_color_enable = api( 'theme_color_enable' ).get(); if ( '1' == theme_color_enable ) { return true; } return false; } } ], 'footer_bottom_layout' : [ { controls: [ 'footer_bottom_1', 'footer_bottom_2', 'footer_bottom_3' ], callback: function( footer_bottom_layout ) { if ( 'disable' != footer_bottom_layout ) { return true; } return false; } }, { controls: [ 'footer_first_img', ], callback: function( footer_bottom_layout ) { var footer_section_1 = api( 'footer_bottom_1' ).get(); if ( 'disable' != footer_bottom_layout && 'image' == footer_section_1 ) { return true; } return false; } }, { controls: [ 'footer_second_custom', ], callback: function( footer_bottom_layout ) { var footer_section_2 = api( 'footer_bottom_2' ).get(); if ( 'disable' != footer_bottom_layout && 'custom' == footer_section_2 ) { return true; } return false; } }, { controls: [ 'footer_social_icons', ], callback: function( footer_bottom_layout ) { var footer_section_2 = api( 'footer_bottom_2' ).get(); if ( 'disable' != footer_bottom_layout && 'social' == footer_section_2 ) { return true; } return false; } }, { controls: [ 'footer_third_custom', ], callback: function( footer_bottom_layout ) { var footer_section_3 = api( 'footer_bottom_3' ).get(); if ( 'disable' != footer_bottom_layout && 'custom' == footer_section_3 ) { return true; } return false; } }, ], 'footer_bottom_1' : [ { controls: [ 'footer_first_img', ], callback: function( enabled_section_1 ) { var footer_layout = api( 'footer_bottom_layout' ).get(); if ( 'image' == enabled_section_1 && 'disable' != footer_layout ) { return true; } return false; } } ], 'footer_bottom_2' : [ { controls: [ 'footer_second_custom', ], callback: function( enabled_section_2 ) { var footer_layout = api( 'footer_bottom_layout' ).get(); if ( 'custom' == enabled_section_2 && 'disable' != footer_layout ) { return true; } return false; } }, { controls: [ 'footer_social_icons', ], callback: function( enabled_section_2 ) { var footer_layout = api( 'footer_bottom_layout' ).get(); if ( 'social' == enabled_section_2 && 'disable' != footer_layout ) { return true; } return false; } } ], 'footer_bottom_3' : [ { controls: [ 'footer_third_custom', ], callback: function( enabled_section_2 ) { var footer_layout = api( 'footer_bottom_layout' ).get(); if ( 'custom' == enabled_section_2 && 'disable' != footer_layout ) { return true; } return false; } } ], /** * artech_header_type */ 'artech_header_type' : [ { controls: [ 'hdr_nav_cart', 'hide_show_cart', 'hdr_nav_btn', 'hide_show_nav_btn', 'nav_btn_icon', 'nav_btn_lbl', 'nav_btn_link' ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-1' == artech_header_type || 'header-4' == artech_header_type || 'header-5' == artech_header_type || 'header-6' == artech_header_type || 'header-7' == artech_header_type) { return true; } return false; } }, { controls: [ 'hdr_nav_toggle', 'hs_nav_toggle', 'artech_toggle_content', ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-1' == artech_header_type || 'header-4' == artech_header_type || 'header-6' == artech_header_type) { return true; } return false; } }, { controls: [ 'hdr_nav_text_content_head', 'hdr_nav_text_content', ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-4' == artech_header_type) { return true; } return false; } }, { controls: [ 'hdr_nav_contact_head', 'hdr_nav_contact_content', ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-4' == artech_header_type || 'header-5' == artech_header_type || 'header-6' == artech_header_type) { return true; } return false; } }, { controls: [ 'hdr_top_icon_menu_head', 'hs_hdr_icon_menu', 'hdr_top_icon_menu' ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-5' == artech_header_type || 'header-7' == artech_header_type) { return true; } return false; } }, { controls: [ 'hdr_nav_contact_content2' ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-5' == artech_header_type || 'header-6' == artech_header_type) { return true; } return false; } }, { controls: [ 'hdr_nav_contact_content3' ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-6' == artech_header_type) { return true; } return false; } }, { controls: [ 'hdr_social_head', 'hide_show_social_icon', 'social_icons' ], callback: function( artech_header_type ) { var artech_header_type = api( 'artech_header_type' ).get(); if ( 'header-7' !== artech_header_type) { return true; } return false; } } ], }; } )( jQuery );