2015-02-22 07:56:27 +01:00
|
|
|
/*globals wp */
|
|
|
|
|
2015-02-09 01:43:50 +01:00
|
|
|
/**
|
|
|
|
* wp.media.view.VideoDetails
|
|
|
|
*
|
2015-02-22 07:28:26 +01:00
|
|
|
* @class
|
2015-02-09 01:43:50 +01:00
|
|
|
* @augments wp.media.view.MediaDetails
|
|
|
|
* @augments wp.media.view.Settings.AttachmentDisplay
|
|
|
|
* @augments wp.media.view.Settings
|
|
|
|
* @augments wp.media.View
|
|
|
|
* @augments wp.Backbone.View
|
|
|
|
* @augments Backbone.View
|
|
|
|
*/
|
|
|
|
var MediaDetails = require( './media-details' ),
|
|
|
|
VideoDetails;
|
|
|
|
|
|
|
|
VideoDetails = MediaDetails.extend({
|
|
|
|
className: 'video-details',
|
|
|
|
template: wp.template('video-details'),
|
|
|
|
|
|
|
|
setMedia: function() {
|
|
|
|
var video = this.$('.wp-video-shortcode');
|
|
|
|
|
|
|
|
if ( video.find( 'source' ).length ) {
|
|
|
|
if ( video.is(':hidden') ) {
|
|
|
|
video.show();
|
|
|
|
}
|
|
|
|
|
2015-02-22 06:38:27 +01:00
|
|
|
if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) {
|
2015-02-09 01:43:50 +01:00
|
|
|
this.media = MediaDetails.prepareSrc( video.get(0) );
|
|
|
|
} else {
|
|
|
|
this.media = video.get(0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
video.hide();
|
|
|
|
this.media = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-02-09 17:01:29 +01:00
|
|
|
module.exports = VideoDetails;
|