mirror of https://github.com/vtrois/kratos
1 line
450 B
JavaScript
1 line
450 B
JavaScript
jQuery(document).ready(function($){$(document).on("click","button[class*='upload_']",function(e){e.preventDefault();var $button=$(this);if(file_frame){file_frame.open();return}var file_frame=wp.media.frames.file_frame=wp.media({library:{type:'image'},multiple:false});file_frame.on('select',function(){var attachment=file_frame.state().get('selection').first().toJSON();$button.siblings('input').val(attachment.url).change();});file_frame.open()})}); |