jQuery(document).ready(function($) { const cats = []; var ccat; var ccat1; var scat; function Always_CheckValue(value,arr){ var status = 'hasnot'; for(var i=0; i' ); placeholder.addClass('hidden'); // Send the attachment id to our hidden input imgIdInput.val( attachment.url ).trigger('change'); }); // Finally, open the modal on click frame.open(); }); // DELETE IMAGE LINK $('.customize-control-repeater').on( 'click', '.theme-image-delete', function( event ){ event.preventDefault(); var imgContainer = $(this).closest('.theme-attachment-panel').find( '.thumbnail-image'), placeholder = $(this).closest('.theme-attachment-panel').find( '.placeholder'), imgIdInput = $(this).siblings('.upload-id'); // Clear out the preview image imgContainer.find('img').remove(); placeholder.removeClass('hidden'); // Delete the image id from the hidden input imgIdInput.val( '' ).trigger('change'); }); $("#customize-theme-controls").on("click", ".always-repeater-field-remove",function(){ if( typeof $(this).parent() != 'undefined'){ $(this).closest('.always-repeater-field-control').slideUp('normal', function(){ $(this).remove(); always_refresh_repeater_values(); }); } return false; }); $('.wp-picker-clear').click(function(){ always_refresh_repeater_values(); }); $('#customize-theme-controls').on('click', '.always-repeater-field-close', function(){ $(this).closest('.always-repeater-fields').slideUp(); $(this).closest('.always-repeater-field-control').toggleClass('expanded'); }); /*Drag and drop to change order*/ $(".always-repeater-field-control-wrap").sortable({ axis: 'y', orientation: "vertical", update: function( event, ui ) { always_refresh_repeater_values(); } }); $("#customize-theme-controls").on('keyup change', '[data-name]',function(){ always_refresh_repeater_values(); return false; }); $("#customize-theme-controls").on('change', 'input[type="checkbox"][data-name]',function(){ if($(this).is(":checked")){ $(this).val('yes'); }else{ $(this).val('no'); } always_refresh_repeater_values(); return false; }); });