/** * Update controls * * @package Hestia */ /* global requestpost */ /* global wp */ /* global WPEditorWidget */ ( function( $ ) { 'use strict'; wp.customize( 'page_on_front', function( value ) { value.bind( function( newval ) { $.ajax( { url: requestpost.ajaxurl, type: 'post', data: { action: 'hestia_ajax_call', pid: newval }, success: function (result) { if (result !== '' && result !== 'undefined' ) { result = JSON.parse( result ); var html, content = result.post_content; jQuery( '#hestia_page_editor' ).val( content ); WPEditorWidget.setEditorContent( 'hestia_page_editor' ); if (result.post_thumbnail !== '' && result.post_thumbnail !== 'undefined') { wp.customize.instance( requestpost.thumbnail_control ).set( result.post_thumbnail ); html = '' + '
'; } else { wp.customize.instance( requestpost.thumbnail_control ).set( '' ); html = '' + '' + ''; } wp.customize.control( requestpost.thumbnail_control ).container['0'].innerHTML = html; wp.customize.instance( requestpost.editor_control ).previewer.refresh(); } } } ); } ); } ); } )( jQuery );