wp-media-picker.js
function( attachment ) {
			var self = this;

			self._attachment = attachment;

			self._open_button.text( self.options.label_replace );
			self._remove_button.show();

			var preview_content = '';
			if ( 'video' === attachment.type ) {
				// for video attachments, show the video player, optionally with the poster
				var poster = '';
				if ( attachment.image && attachment.image.src !== attachment.icon ) {
					poster = attachment.image.src;
				}
				preview_content += '<video class="wp-video-shortcode" preload="metadata"' + ( poster ? ' poster="' + poster + '"' : '' ) + ' controls><source type="' + attachment.mime + '" src="' + attachment.url + '" /></video>';
			} else if ( 'audio' === attachment.type ) {
				// for audio attachments, show the audio player, with either the cover or the mime type icon
				if ( attachment.image && attachment.image.src && attachment.image.src !== attachment.icon ) {
					preview_content += '<img class="wp-audio-cover" src="' + attachment.image.src + '" alt="' + attachment.filename + '" />';
				} else {
					preview_content += '<div class="mime-type-icon"><img src="' + attachment.icon + '" /><span>' + attachment.filename + '</span></div>';
				}
				preview_content += '<audio class="wp-audio-shortcode" width="100%" preload="none" controls><source type="' + attachment.mime + '" src="' + attachment.url + '" /></audio>';
			} else {
				var src = 'image' === attachment.type ? attachment.url : undefined;
				if ( attachment.sizes ) {
					if ( attachment.sizes.large ) {
						src = attachment.sizes.large.url;
					} else if ( attachment.sizes.full ) {
						src = attachment.sizes.full.url;
					}
				}

				if ( src ) {
					preview_content += '<img src="' + src + '" alt="' + attachment.alt + '" />';
				} else {
					preview_content += '<div class="mime-type-icon"><img src="' + attachment.icon + '" /><span>' + attachment.filename + '</span></div>';
				}
			}

			if ( 0 <= preview_content.search( '<img ' ) ) {
				self._content.addClass( 'size-auto' );
			} else {
				self._content.removeClass( 'size-auto' );
			}

			self._content.show().html( preview_content );
		}
function( attachment ) {
			var self = this;

			self._attachment = attachment;

			self._open_button.text( self.options.label_replace );
			self._remove_button.show();

			var preview_content = '';
			if ( 'video' === attachment.type ) {
				// for video attachments, show the video player, optionally with the poster
				var poster = '';
				if ( attachment.image && attachment.image.src !== attachment.icon ) {
					poster = attachment.image.src;
				}
				preview_content += '<video class="wp-video-shortcode" preload="metadata"' + ( poster ? ' poster="' + poster + '"' : '' ) + ' controls><source type="' + attachment.mime + '" src="' + attachment.url + '" /></video>';
			} else if ( 'audio' === attachment.type ) {
				// for audio attachments, show the audio player, with either the cover or the mime type icon
				if ( attachment.image && attachment.image.src && attachment.image.src !== attachment.icon ) {
					preview_content += '<img class="wp-audio-cover" src="' + attachment.image.src + '" alt="' + attachment.filename + '" />';
				} else {
					preview_content += '<div class="mime-type-icon"><img src="' + attachment.icon + '" /><span>' + attachment.filename + '</span></div>';
				}
				preview_content += '<audio class="wp-audio-shortcode" width="100%" preload="none" controls><source type="' + attachment.mime + '" src="' + attachment.url + '" /></audio>';
			} else {
				var src = 'image' === attachment.type ? attachment.url : undefined;
				if ( attachment.sizes ) {
					if ( attachment.sizes.large ) {
						src = attachment.sizes.large.url;
					} else if ( attachment.sizes.full ) {
						src = attachment.sizes.full.url;
					}
				}

				if ( src ) {
					preview_content += '<img src="' + src + '" alt="' + attachment.alt + '" />';
				} else {
					preview_content += '<div class="mime-type-icon"><img src="' + attachment.icon + '" /><span>' + attachment.filename + '</span></div>';
				}
			}

			if ( 0 <= preview_content.search( '<img ' ) ) {
				self._content.addClass( 'size-auto' );
			} else {
				self._content.removeClass( 'size-auto' );
			}

			self._content.show().html( preview_content );
		}
function ( attachment ) { var self = this ; self . _attachment = attachment ; self . _open_button . text ( self . options . label_replace ) ; self . _remove_button . show ( ) ; var preview_content = '' ; if ( 'video' === attachment . type ) { // for video attachments, show the video player, optionally with the poster var poster = '' ; if ( attachment . image && attachment . image . src !== attachment . icon ) { poster = attachment . image . src ; } preview_content += '<video class="wp-video-shortcode" preload="metadata"' + ( poster ? ' poster="' + poster + '"' : '' ) + ' controls><source type="' + attachment . mime + '" src="' + attachment . url + '" /></video>' ; } else if ( 'audio' === attachment . type ) { // for audio attachments, show the audio player, with either the cover or the mime type icon if ( attachment . image && attachment . image . src && attachment . image . src !== attachment . icon ) { preview_content += '<img class="wp-audio-cover" src="' + attachment . image . src + '" alt="' + attachment . filename + '" />' ; } else { preview_content += '<div class="mime-type-icon"><img src="' + attachment . icon + '" /><span>' + attachment . filename + '</span></div>' ; } preview_content += '<audio class="wp-audio-shortcode" width="100%" preload="none" controls><source type="' + attachment . mime + '" src="' + attachment . url + '" /></audio>' ; } else { var src = 'image' === attachment . type ? attachment . url : undefined ; if ( attachment . sizes ) { if ( attachment . sizes . large ) { src = attachment . sizes . large . url ; } else if ( attachment . sizes . full ) { src = attachment . sizes . full . url ; } } if ( src ) { preview_content += '<img src="' + src + '" alt="' + attachment . alt + '" />' ; } else { preview_content += '<div class="mime-type-icon"><img src="' + attachment . icon + '" /><span>' + attachment . filename + '</span></div>' ; } } if ( 0 <= preview_content . search ( '<img ' ) ) { self . _content . addClass ( 'size-auto' ) ; } else { self . _content . removeClass ( 'size-auto' ) ; } self . _content . show ( ) . html ( preview_content ) ; }
Creates the preview content markup for a given attachment.

@since 0.1.0

@param {object} attachment WordPress attachment data.

@returns {void}
Creates the preview content markup for a given attachment .