summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js')
-rw-r--r--plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js107
1 files changed, 1 insertions, 106 deletions
diff --git a/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js b/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js
index e315891f..ee468c33 100644
--- a/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js
+++ b/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js
@@ -1,106 +1 @@
-/**
- * This file was unminified in Jetpack 4.0 to address an issue wherein ClamAV
- * was flagging the minified version of this file with a false-positive virus warning.
- *
- * This file will be re-minified in a future Jetpack release once ClamAV corrects their
- * incorrect definition.
- */
-
-( function( $ ) {
-
- /**
- * A function to help debouncing.
- */
- var debounce = function( func, wait ) {
-
- var timeout, args, context, timestamp;
-
- return function() {
-
- context = this;
- args = [].slice.call( arguments, 0 );
- timestamp = new Date();
-
- var later = function() {
-
- var last = ( new Date() ) - timestamp;
-
- if ( last < wait ) {
- timeout = setTimeout( later, wait - last );
- } else {
- timeout = null;
- func.apply( context, args );
- }
-
- };
-
- if ( ! timeout ) {
- timeout = setTimeout( later, wait );
- }
-
- };
-
- };
-
- /**
- * A function to resize videos.
- */
- function responsive_videos() {
-
- $( '.jetpack-video-wrapper' ).find( 'embed, iframe, object' ).each( function() {
- var video_element, video_width, video_height, video_ratio, video_wrapper, video_margin, container_width;
-
- video_element = $( this );
- video_margin = 0;
-
- if ( video_element.parents( '.jetpack-video-wrapper' ).prev( 'p' ).css( 'text-align' ) === 'center' ) {
- video_margin = '0 auto';
- }
-
- if ( ! video_element.attr( 'data-ratio' ) ) {
- video_element
- .attr( 'data-ratio', this.height / this.width )
- .attr( 'data-width', this.width )
- .attr( 'data-height', this.height )
- .css( {
- 'display' : 'block',
- 'margin' : video_margin
- } );
- }
-
- video_width = video_element.attr( 'data-width' );
- video_height = video_element.attr( 'data-height' );
- video_ratio = video_element.attr( 'data-ratio' );
- video_wrapper = video_element.parent();
- container_width = video_wrapper.width();
-
- if ( video_ratio === 'Infinity' ) {
- video_width = '100%';
- }
-
- video_element
- .removeAttr( 'height' )
- .removeAttr( 'width' );
-
- if ( video_width > container_width ) {
- video_element
- .width( container_width )
- .height( container_width * video_ratio );
- } else {
- video_element
- .width( video_width )
- .height( video_height );
- }
-
- } );
-
- }
-
- /**
- * Load responsive_videos().
- * Trigger resize to make sure responsive_videos() is loaded after IS.
- */
- $( window ).load( responsive_videos ).resize( debounce( responsive_videos, 100 ) ).trigger( 'resize' );
- $( document ).on( 'post-load', responsive_videos );
-
-} )( jQuery );
+!function(t){function a(){t(".jetpack-video-wrapper").find("embed, iframe, object").each(function(){var a,e,i,r,h,n,d;a=t(this),n=0,"center"===a.parents(".jetpack-video-wrapper").prev("p").css("text-align")&&(n="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:n}),e=a.attr("data-width"),i=a.attr("data-height"),r=a.attr("data-ratio"),h=a.parent(),d=h.width(),"Infinity"===r&&(e="100%"),a.removeAttr("height").removeAttr("width"),e>d?a.width(d).height(d*r):a.width(e).height(i)})}var e=function(t,a){var e,i,r,h;return function(){r=this,i=[].slice.call(arguments,0),h=new Date;var n=function(){var d=new Date-h;a>d?e=setTimeout(n,a-d):(e=null,t.apply(r,i))};e||(e=setTimeout(n,a))}};t(window).load(a).resize(e(a,100)).trigger("resize"),t(document).on("post-load",a)}(jQuery);