// Scripts for the theme customizer var $str = jQuery.noConflict(); $str(document).ready(function() { // Add theme links var links = ' \
  • \
    \
    \ '; if ( bentoCustomizerVars.license_status != 'valid' ) { links += ' \ \ \ ' +bentoCustomizerVars.exp+ ''; } links += ' \ \ \ ' +bentoCustomizerVars.review+ ' \
  • '; $str('#customize-theme-controls > ul').prepend(links); // Control visibility logic function bntWebsiteLayout() { var $parent = $str( '#customize-control-bento_website_layout select' ); var $child = $str( '#customize-control-bento_website_background' ); if ( $parent.attr('value') == 1 ) { $child.show(); } else { $child.hide(); } } bntWebsiteLayout(); $str( '#customize-control-bento_website_layout select' ).change( function() { bntWebsiteLayout(); bntWebsiteBackground(); }); function bntWebsiteBackground() { var $parent = $str( '#customize-control-bento_website_background select' ); var $children = $str( '#customize-control-bento_website_background_color, #customize-control-bento_website_background_texture, #customize-control-bento_website_background_image' ); if ( $parent.is(':visible') ) { var pvalue = $parent.attr('value'); $children.each(function( index, value ) { if ( index == pvalue ) { $str(value).show(); } else { $str(value).hide(); } }); } else { $children.hide(); } } bntWebsiteBackground(); $str( '#customize-control-bento_website_background select' ).change( function() { bntWebsiteBackground(); }); function bntMenuBackground() { var $parent = $str( '#customize-control-bento_menu_config select' ); var $child1 = $str( '#customize-control-bento_primary_menu_background' ); var $child2 = $str( '#customize-control-bento_menu_separators' ); if ( $parent.attr('value') == 2 ) { $child1.show(); $child2.hide(); } else if ( $parent.attr('value') == 3 ) { $child2.show(); $child1.hide(); } else { $child1.hide(); $child2.hide(); } } bntMenuBackground(); $str( '#customize-control-bento_menu_config select' ).change( function() { bntMenuBackground(); }); function bntPopupLocation() { var $parent = $str( '#customize-control-bento_cta_location select' ); var $child = $str( '#customize-control-bento_cta_page' ); if ( $parent.attr('value') == 4 ) { $child.show(); } else { $child.hide(); } } bntPopupLocation(); $str( '#customize-control-bento_cta_location select' ).change( function() { bntPopupLocation(); }); function bntPopupTrigger() { var $parent = $str( '#customize-control-bento_cta_trigger select' ); var $child = $str( '#customize-control-bento_cta_timeonpage' ); if ( $parent.attr('value') == 0 ) { $child.show(); } else { $child.hide(); } } bntPopupTrigger(); $str( '#customize-control-bento_cta_trigger select' ).change( function() { bntPopupTrigger(); }); });