Add upstream
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
.jetpack-video-wrapper {
|
||||
margin-bottom: 1.6em;
|
||||
}
|
||||
|
||||
.jetpack-video-wrapper > embed,
|
||||
.jetpack-video-wrapper > iframe,
|
||||
.jetpack-video-wrapper > object,
|
||||
.jetpack-video-wrapper > .wp-video {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
( function( $ ) {
|
||||
var resizeTimer;
|
||||
|
||||
function responsiveVideos() {
|
||||
$( '.jetpack-video-wrapper' )
|
||||
.find( 'embed, iframe, object' )
|
||||
.each( function() {
|
||||
var _this, videoWidth, videoHeight, videoRatio, videoWrapper, videoMargin, containerWidth;
|
||||
|
||||
_this = $( this );
|
||||
videoMargin = 0;
|
||||
|
||||
if (
|
||||
_this
|
||||
.parents( '.jetpack-video-wrapper' )
|
||||
.prev( 'p' )
|
||||
.css( 'text-align' ) === 'center'
|
||||
) {
|
||||
videoMargin = '0 auto';
|
||||
}
|
||||
|
||||
if ( ! _this.attr( 'data-ratio' ) ) {
|
||||
_this
|
||||
.attr( 'data-ratio', this.height / this.width )
|
||||
.attr( 'data-width', this.width )
|
||||
.attr( 'data-height', this.height )
|
||||
.css( {
|
||||
display: 'block',
|
||||
margin: videoMargin,
|
||||
} );
|
||||
}
|
||||
|
||||
videoWidth = _this.attr( 'data-width' );
|
||||
videoHeight = _this.attr( 'data-height' );
|
||||
videoRatio = _this.attr( 'data-ratio' );
|
||||
videoWrapper = _this.parent();
|
||||
containerWidth = videoWrapper.width();
|
||||
|
||||
if ( videoRatio === 'Infinity' ) {
|
||||
videoWidth = '100%';
|
||||
}
|
||||
|
||||
_this.removeAttr( 'height' ).removeAttr( 'width' );
|
||||
|
||||
if ( videoWidth > containerWidth ) {
|
||||
_this.width( containerWidth ).height( containerWidth * videoRatio );
|
||||
} else {
|
||||
_this.width( videoWidth ).height( videoHeight );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
$( document ).ready( function() {
|
||||
$( window )
|
||||
.on( 'load.jetpack', responsiveVideos )
|
||||
.on( 'resize.jetpack', function() {
|
||||
clearTimeout( resizeTimer );
|
||||
resizeTimer = setTimeout( responsiveVideos, 500 );
|
||||
} )
|
||||
.on( 'post-load.jetpack', responsiveVideos )
|
||||
.resize();
|
||||
} );
|
||||
} )( jQuery );
|
||||
1
wp-content/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js
vendored
Normal file
1
wp-content/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(t){function a(){t(".jetpack-video-wrapper").find("embed, iframe, object").each(function(){var a,e,i,r,h,d,o;a=t(this),d=0,"center"===a.parents(".jetpack-video-wrapper").prev("p").css("text-align")&&(d="0 auto"),a.attr("data-ratio")||a.attr("data-ratio",this.height/this.width).attr("data-width",this.width).attr("data-height",this.height).css({display:"block",margin:d}),e=a.attr("data-width"),i=a.attr("data-height"),r=a.attr("data-ratio"),h=a.parent(),o=h.width(),"Infinity"===r&&(e="100%"),a.removeAttr("height").removeAttr("width"),e>o?a.width(o).height(o*r):a.width(e).height(i)})}var e;t(document).ready(function(){t(window).on("load.jetpack",a).on("resize.jetpack",function(){clearTimeout(e),e=setTimeout(a,500)}).on("post-load.jetpack",a).resize()})}(jQuery);
|
||||
Reference in New Issue
Block a user