| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /* jshint esnext:true */
- (function($, undefined) {
- 'use strict';
- var api = wp.customize;
- // toggle visibility of some controls based on a setting's value
- // @see wp-admin/js/customize-controls.js
- $.each({
- 'vamtam_theme[header-logo-type]': [
- {
- controls: [ 'vamtam_theme[custom-header-logo]' ],
- callback: function( to ) { return 'image' === to; }
- },
- ],
- 'vamtam_theme[site-layout-type]': [
- {
- controls: [ 'vamtam_theme[full-width-header]' ],
- callback: function( to ) { return 'boxed' !== to; }
- },
- {
- controls: [ 'vamtam_theme[boxed-layout-padding]', ],
- callback: function( to ) { return 'boxed' === to; }
- },
- ],
- 'vamtam_theme[header-layout]': [
- {
- controls: [ 'vamtam_theme[full-width-header]' ],
- callback: function( to ) { return 'logo-menu' === to; } // show if header is 'logo-menu'
- },
- {
- controls: [ 'vamtam_theme[sub-header-background]' ],
- callback: function( to ) { return 'logo-menu' !== to; } // show if header is not 'logo-menu'
- },
- ],
- 'vamtam_theme[top-bar-layout]': [
- {
- controls: [
- 'vamtam_theme[top-bar-social-lead]',
- 'vamtam_theme[top-bar-social-fb]',
- 'vamtam_theme[top-bar-social-twitter]',
- 'vamtam_theme[top-bar-social-linkedin]',
- 'vamtam_theme[top-bar-social-gplus]',
- 'vamtam_theme[top-bar-social-flickr]',
- 'vamtam_theme[top-bar-social-pinterest]',
- 'vamtam_theme[top-bar-social-dribbble]',
- 'vamtam_theme[top-bar-social-instagram]',
- 'vamtam_theme[top-bar-social-youtube]',
- 'vamtam_theme[top-bar-social-vimeo]',
- ],
- callback: function( to ) {
- return [ 'menu-social', 'social-menu', 'social-text', 'text-social' ].indexOf( to ) > -1;
- }
- },
- {
- controls: [
- 'vamtam_theme[top-bar-text]',
- ],
- callback: function( to ) {
- return [ 'menu-text', 'text-menu', 'social-text', 'text-social', 'fulltext' ].indexOf( to ) > -1;
- }
- },
- ],
- }, ( settingId, conditions ) => {
- api( settingId, setting => {
- $.each( conditions, ( cndi, o ) => {
- $.each( o.controls, ( i, controlId ) => {
- api.control( controlId, ( control ) => {
- var visibility = ( to ) => {
- control.container.toggle( o.callback( to ) );
- };
- visibility( setting.get() );
- setting.bind( visibility );
- });
- });
- } );
- });
- });
- })(jQuery);
|