X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/af50974463450c98503e763a7836a50e260461a9..refs/tags/wordpress-4.4:/wp-includes/media-template.php diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 758c7f5c..8d7c758c 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -50,9 +50,14 @@ function wp_underscore_audio_template() { function wp_underscore_video_template() { $video_types = wp_get_video_extensions(); ?> -<# var w_rule = h_rule = '', +<# var w_rule = '', classes = [], w, h, settings = wp.media.view.settings, - isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/); + isYouTube = isVimeo = false; + + if ( ! _.isEmpty( data.model.src ) ) { + isYouTube = data.model.src.match(/youtube|youtu\.be/); + isVimeo = -1 !== data.model.src.indexOf('vimeo'); + } if ( settings.contentWidth && data.model.width >= settings.contentWidth ) { w = settings.contentWidth; @@ -64,18 +69,24 @@ function wp_underscore_video_template() { h = Math.ceil( ( data.model.height * w ) / data.model.width ); } else { h = data.model.height; - } + } if ( w ) { w_rule = 'width: ' + w + 'px; '; } - if ( h ) { - h_rule = 'height: ' + h + 'px;'; + + if ( isYouTube ) { + classes.push( 'youtube-video' ); + } + + if ( isVimeo ) { + classes.push( 'vimeo-video' ); } + #> -
+
<# if ( data.buttons.check ) { #> -
+ <# } #> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; @@ -477,22 +490,21 @@ function wp_print_media_templates() { + +