/** * Main jQuery media file for the plugin. * * @since 1.0.0 * * @package CS Media Plugin * @author Fox */ jQuery(document).ready(function($){ "use strict"; // Item var item; // Prepare the variable that holds our custom media manager. var tgm_media_frame; // new frame; tgm_media_frame = wp.media.frames.tgm_media_frame = wp.media({ className: 'media-frame tgm-media-frame', frame: 'select', multiple: false, title: 'Select Background Image', library: { type: 'image' }, button: { text: 'SELECT' } }); // Bind to our click event in order to open up the new media experience. $(document.body).on('click', '.images-field ul li i.add', function(e){ "use strict"; item = $(this); tgm_media_frame.open(); return; }); //Edit $(document.body).on('click', '.images-field ul li i.edit', function(e){ "use strict"; item = $(this); tgm_media_frame.open(); return; }); // Remove $(document.body).on('click', '.images-field ul li i.remove', function(e){ "use strict"; var li = $(this).parent(); var ul = li.parent(); li.remove(); //ul.append('