Reputation: 2999
I need to modify the output of the new Wordpress 3.5 Media Manager after it has loaded all of the items to browse in the library and gallery views but I cannot for the life of me find an event that I can bind to...
Does anybody know if there is something like a 'wpMediaEditorLoaded' event triggered when all the images have been loaded or something similar that I could use?
Upvotes: 0
Views: 171
Reputation: 2999
I found I could use this
wp.media.view.Attachments.prototype.on('ready',function(){
//this runs once for each tab in the media editor so unbind previous versions
jQuery(document).unbind('ajaxComplete', mediaLibraryLoaded);
jQuery(document).bind('ajaxComplete', mediaLibraryLoaded);
});
var mediaLibraryLoaded = function(e, xhr, options) {
jQuery(document).unbind('ajaxComplete', mediaLibraryLoaded);
//do stuff here
}
Upvotes: 0