/* global wp, jQuery */ /** * File customizer.js. * * Theme Customizer enhancements for a better user experience. * * Contains handlers to make Theme Customizer preview reload changes asynchronously. */ ( function( $ ) { // Site title and description wp.customize( 'blogname', function( value ) { value.bind( function( to ) { $( '.site-title a' ).text( to ); } ); } ); wp.customize( 'blogdescription', function( value ) { value.bind( function( to ) { $( '.site-description' ).text( to ); } ); } ); // Content padding wp.customize( 'billow_site_padding', function( value ) { value.bind( function( to ) { $('.billow .container') .css('padding-left', to ) .css('padding-right', to ); } ); } ); wp.customize( 'billow_content_padding_top', function( value ) { value.bind( function( to ) { $('.billow .site-content .container') .css('padding-top', to ); } ); } ); wp.customize( 'billow_content_padding_bottom', function( value ) { value.bind( function( to ) { $('.billow .site-content .container') .css('padding-bottom', to ); } ); } ); // Header text color wp.customize( 'header_textcolor', function( value ) { value.bind( function( to ) { if ( 'blank' === to ) { $( '.site-title, .site-description' ).css( { clip: 'rect(1px, 1px, 1px, 1px)', position: 'absolute', } ); } else { $( '.site-title, .site-description' ).css( { clip: 'auto', position: 'relative', } ); $( '.site-title a, .site-description' ).css( { color: to, } ); } } ); } ); // Single Post wp.customize( 'billow_single_content_padding_top', function( value ) { value.bind( function( to ) { $('.billow.single-post .site-content .container') .css('padding-top', to ); } ); } ); wp.customize( 'billow_single_content_padding_bottom', function( value ) { value.bind( function( to ) { $('.billow.single-post .site-content .container') .css('padding-bottom', to ); } ); } ); // Header Layout wp.customize( 'billow_header_layout_align', function( value ) { value.bind( function ( to ) { $( ".billow header.site-header .header-wrap .container" ).removeClass ( function ( index, className ) { return ( className.match (/(^|\s)header-(left|center|right)/g) || [] ).join( ' ' ); } ); $( '.billow header.site-header .header-wrap .container' ).addClass( to ); } ); }); // Blog/Category/Archive/Search Sidebar Layout wp.customize( 'billow_posts_sidebar_position', function( value ) { value.bind( function ( to ) { $( ".blog .blw-blog-site-main .main-wrap, .archive .site-main .main-wrap, .category .site-main .main-wrap, .tag .site-main .main-wrap, .search .site-main .main-wrap" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)sidebar-(none|right|left)/g ) || [] ).join( ' ' ); } ); $( '.blog .blw-blog-site-main .main-wrap, .archive .site-main .main-wrap, .category .site-main .main-wrap, .tag .site-main .main-wrap, .search .site-main .main-wrap' ).addClass( to ); } ); } ); // Post Sidebar Layout wp.customize( 'billow_post_sidebar_position', function( value ) { value.bind( function ( to ) { $( ".single-post .site-main .main-wrap" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)sidebar-(none|right|left)/g ) || [] ).join( ' ' ); }); $( '.single-post .site-main .main-wrap' ).addClass( to ); } ); } ); // Single Product Sidebar Layout wp.customize( 'billow_single_product_sidebar_position', function( value ) { value.bind( function ( to ) { $( ".single-product .content-area .single-product-wrapper" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)sidebar-(none|right|left)/g ) || [] ).join( ' ' ); } ); $( '.single-product .content-area .single-product-wrapper' ).addClass( to ); } ); } ); // Shop Sidebar Layout wp.customize( 'billow_shop_sidebar_position', function( value ) { value.bind( function ( to ) { $( ".post-type-archive-product .site .content-area .shop-wrapper" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)sidebar-(none|right|left)/g ) || [] ).join( ' ' ); } ); $( '.post-type-archive-product .site .content-area .shop-wrapper' ).addClass( to ); } ); } ); // Front Page Title Align wp.customize( 'billow_home_page_horizontal_align', function( value ) { value.bind( function ( to ) { $( ".blw-hero-area .hero-content" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)(left|center|right)/g ) || [] ).join( ' ' ); } ); $( '.blw-hero-area .hero-content' ).addClass( to ); } ); } ); // Blog Title Align wp.customize( 'billow_posts_title_align', function( value ) { value.bind( function ( to ) { $( ".billow.archive header.archive-header, .billow.blog header.blw-blog-page-header, .billow.search header.search-header" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)title-(left|center|right)/g ) || [] ).join( ' ' ); } ); $( '.billow.archive header.archive-header, .billow.blog header.blw-blog-page-header, .billow.search header.search-header' ).addClass( to ); } ); } ); // Blog Background Align wp.customize( 'billow_posts_bc_align', function( value ) { value.bind( function ( to ) { $( ".billow.archive header.archive-header span.archive-background, .billow.blog header.blw-blog-page-header span.background, .billow.search header.search-header span.search-background" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)bc-(left|center|right)/g ) || [] ).join( ' ' ); } ); $( '.billow.archive header.archive-header span.archive-background, .billow.blog header.blw-blog-page-header span.background, .billow.search header.search-header span.search-background' ).addClass( to ); } ); } ); // Blog Structure wp.customize( 'billow_posts_structure', function( value ) { value.bind( function ( to ) { $( ".billow .main-wrap .main-content" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)(classic|simple|grid|gutenberg)/g ) || [] ).join( ' ' ); } ); $( '.billow .main-wrap .main-content' ).addClass( to ); } ); } ); // Socials Align wp.customize( 'billow_social_links_align', function( value ) { value.bind( function ( to ) { $( "ul.social-networks" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)align-(left|center|right)/g ) || [] ).join( ' ' ); } ); $( 'ul.social-networks' ).addClass( to ); } ); } ); // Scroll to Top Align wp.customize( 'billow_scroll_top_align', function( value ) { value.bind( function ( to ) { $( "a#scroll-to-top" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)(left|center|right)/g ) || [] ).join( ' ' ); } ); $( 'a#scroll-to-top' ).addClass( to ); } ); } ); // Scroll to Top Icon Type wp.customize( 'billow_scroll_top_icon_type', function( value ) { value.bind( function ( to ) { $( "a#scroll-to-top" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)type-(1|2|3)/g) || [] ).join( ' ' ); } ); $( 'a#scroll-to-top' ).addClass( to ); } ); } ); // Scroll to Top Button Type wp.customize( 'billow_scroll_top_button_type', function( value ) { value.bind( function ( to ) { $( "a#scroll-to-top" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)(square|circle)/g ) || [] ).join( ' ' ); } ); $( 'a#scroll-to-top' ).addClass( to ); } ); } ); // Footer Align wp.customize( 'billow_copyright_align', function( value ) { value.bind( function ( to ) { $( ".site-footer .site-info .container" ).removeClass ( function ( index, className ) { return ( className.match ( /(^|\s)align-(left|center|right)/g ) || [] ).join( ' ' ); } ); $( '.site-footer .site-info .container' ).addClass( to ); } ); } ); }( jQuery ) );