wordpress/wp-content/themes/basic/themify/customizer/class-themify-customizer.php
/**
		 * Enqueue script for live preview.
		 */
Enqueue script for live preview.
Enqueue script for live preview .
function live_preview_scripts() {
			themify_enque_script('themify-customize-preview', THEMIFY_CUSTOMIZER_URI . '/js/themify.customize-preview.js', array('jquery', 'customize-preview', 'underscore', 'backbone'), THEMIFY_VERSION, true);
			$controls = array(
				'nonce' => wp_create_nonce('ajax-nonce'),
				'ajaxurl' => admin_url('admin-ajax.php'),
				'isRTL' => is_rtl(),
				'breakpoints' => $this->get_breakpoints(),
				'cf_api_url' => Themify_Custom_Fonts::$api_url
			);
			foreach ($this->settings as $key => $params) {
				if (!isset($params['selector'])) {
					continue;
				}
				if ($this->endsWith($key, '_font')) {
					$controls['fontControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_background') || $this->endsWith($key, '_background_color') ) {
					$controls['backgroundControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_position')) {
					$controls['positionControls'][$key] = $params['selector'];
				} elseif (false !== stripos($key, '-logo_')) {
					if ( $params['prop'] === 'margin' ) {
						$controls['marginControls'][$key] = $params['selector'];
					} else {
						$controls['logoControls'][$key] = $params['selector'];
						$controls['fontControls'][$key] = $params['selector'];
					}
				} elseif ($this->endsWith($key, '-tagline')) {
					$controls['taglineControls'][$key] = $params['selector'];
					$controls['fontControls'][$key] = $params['selector'];
					$controls['marginControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_border')) {
					$controls['borderControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_margin')) {
					$controls['marginControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_padding')) {
					$controls['paddingControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_width')) {
					$controls['widthControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_height')) {
					$controls['heightControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, 'border_color')) {
					$controls['borderColorControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_color')) {
					$controls['colorControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, 'customcss')) {
					$controls['customcssControls'][$key] = $params['selector'];
				} elseif ($this->endsWith($key, '_imageselect')) {
					$controls['imageselectControls'][$key] = $params['selector'];
				}
			}
			wp_localize_script('themify-customize-preview', 'themifyCustomizer', $controls);
		}
function live_preview_scripts ( ) { themify_enque_script ( 'themify-customize-preview' , THEMIFY_CUSTOMIZER_URI . '/js/themify.customize-preview.js' , array ( 'jquery' , 'customize-preview' , 'underscore' , 'backbone' ) , THEMIFY_VERSION , true ) ; $ controls = array ( 'nonce' => wp_create_nonce ( 'ajax-nonce' ) , 'ajaxurl' => admin_url ( 'admin-ajax.php' ) , 'isRTL' => is_rtl ( ) , 'breakpoints' => $ this -> get_breakpoints ( ) , 'cf_api_url' => Themify_Custom_Fonts :: $ api_url ) ; foreach ( $ this -> settings as $ key => $ params ) { if ( ! isset ( $ params [ 'selector' ] ) ) { continue ; } if ( $ this -> endsWith ( $ key , '_font' ) ) { $ controls [ 'fontControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_background' ) || $ this -> endsWith ( $ key , '_background_color' ) ) { $ controls [ 'backgroundControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_position' ) ) { $ controls [ 'positionControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( false !== stripos ( $ key , '-logo_' ) ) { if ( $ params [ 'prop' ] === 'margin' ) { $ controls [ 'marginControls' ] [ $ key ] = $ params [ 'selector' ] ; } else { $ controls [ 'logoControls' ] [ $ key ] = $ params [ 'selector' ] ; $ controls [ 'fontControls' ] [ $ key ] = $ params [ 'selector' ] ; } } elseif ( $ this -> endsWith ( $ key , '-tagline' ) ) { $ controls [ 'taglineControls' ] [ $ key ] = $ params [ 'selector' ] ; $ controls [ 'fontControls' ] [ $ key ] = $ params [ 'selector' ] ; $ controls [ 'marginControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_border' ) ) { $ controls [ 'borderControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_margin' ) ) { $ controls [ 'marginControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_padding' ) ) { $ controls [ 'paddingControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_width' ) ) { $ controls [ 'widthControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_height' ) ) { $ controls [ 'heightControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , 'border_color' ) ) { $ controls [ 'borderColorControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_color' ) ) { $ controls [ 'colorControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , 'customcss' ) ) { $ controls [ 'customcssControls' ] [ $ key ] = $ params [ 'selector' ] ; } elseif ( $ this -> endsWith ( $ key , '_imageselect' ) ) { $ controls [ 'imageselectControls' ] [ $ key ] = $ params [ 'selector' ] ; } } wp_localize_script ( 'themify-customize-preview' , 'themifyCustomizer' , $ controls ) ; }
Enqueue script for live preview.
Enqueue script for live preview .
// Live preview JS // Pass JS variables to live preview scripts