/** * Scripts within the customizer controls window. **/ (function( $, api ) { wp.customize.bind('ready', function() { /* === Radio Image Control === */ api.controlConstructor['radio-color'] = api.Control.extend( { ready: function() { var control = this; $( 'input:radio', control.container ).change( function() { control.setting.set( $( this ).val() ); } ); } } ); // Sortable sections jQuery( 'ul.blog-center-sortable-list' ).sortable({ handle: '.blog-center-drag-handle', axis: 'y', update: function( e, ui ){ jQuery('input.blog-center-sortable-input').trigger( 'change' ); } }); // Sortable sections jQuery( "body" ).on( 'hover', '.blog-center-drag-handle', function() { jQuery( 'ul.blog-center-sortable-list' ).sortable({ handle: '.blog-center-drag-handle', axis: 'y', update: function( e, ui ){ jQuery('input.blog-center-sortable-input').trigger( 'change' ); } }); }); /* On changing the value. */ jQuery( "body" ).on( 'change', 'input.blog-center-sortable-input', function() { /* Get the value, and convert to string. */ this_checkboxes_values = jQuery( this ).parents( 'ul.blog-center-sortable-list' ).find( 'input.blog-center-sortable-input' ).map( function() { return this.value; }).get().join( ',' ); /* Add the value to hidden input. */ jQuery( this ).parents( 'ul.blog-center-sortable-list' ).find( 'input.blog-center-sortable-value' ).val( this_checkboxes_values ).trigger( 'change' ); }); // Deep linking for counter section to about section. jQuery('.blog-center-edit').click(function(e) { e.preventDefault(); var jump_to = jQuery(this).attr( 'data-jump' ); wp.customize.section( jump_to ).focus() }); $('#sub-accordion-section-blog_center_topbar').css( 'display', 'none' ); }); })( jQuery, wp.customize ); (function(api) { const blog_center_section_lists = ['breaking-news','posts-carousel','instagram']; blog_center_section_lists.forEach(blog_center_homepage_scroll); function blog_center_homepage_scroll(item, index) { // Detect when the front page sections section is expanded (or closed) so we can adjust the preview accordingly. item = item.replace(/-/g, '_'); wp.customize.section('blog_center_' + item + '_section', function(section) { section.expanded.bind(function(isExpanding) { // Value of isExpanding will = true if you're entering the section, false if you're leaving it. wp.customize.previewer.send(item, { expanded: isExpanding }); }); }); } })(wp.customize);