summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2017-05-05 17:29:26 -0400
committerYury German <blueknight@gentoo.org>2017-05-05 17:29:26 -0400
commita751233efc6e756083926dfaeaf6eefe718b5f76 (patch)
tree83373c83696d56ab1f0a91615236b2e7b7674477 /plugins/jetpack/modules/theme-tools
parentUpdate wordpress-mobile-pack 2.2.10 (diff)
downloadblogs-gentoo-a751233efc6e756083926dfaeaf6eefe718b5f76.tar.gz
blogs-gentoo-a751233efc6e756083926dfaeaf6eefe718b5f76.tar.bz2
blogs-gentoo-a751233efc6e756083926dfaeaf6eefe718b5f76.zip
Update Aksimet v3.3.1, Jetpack v 4.9, Public Post Preview v 2.6.0
Diffstat (limited to 'plugins/jetpack/modules/theme-tools')
-rw-r--r--plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.js101
-rw-r--r--plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.min.js2
-rw-r--r--plugins/jetpack/modules/theme-tools/social-links.php6
3 files changed, 41 insertions, 68 deletions
diff --git a/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.js b/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.js
index e9f31ba8..7e95b3fb 100644
--- a/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.js
+++ b/plugins/jetpack/modules/theme-tools/responsive-videos/responsive-videos.js
@@ -1,98 +1,67 @@
( function( $ ) {
- /**
- * A function to help debouncing.
- */
- var debounce = function( func, wait ) {
+ var resizeTimer;
- var timeout, args, context, timestamp;
+ function responsiveVideos() {
- 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;
+ var _this, videoWidth, videoHeight, videoRatio, videoWrapper, videoMargin, containerWidth;
- video_element = $( this );
- video_margin = 0;
+ _this = $( this );
+ videoMargin = 0;
- if ( video_element.parents( '.jetpack-video-wrapper' ).prev( 'p' ).css( 'text-align' ) === 'center' ) {
- video_margin = '0 auto';
+ if ( _this.parents( '.jetpack-video-wrapper' ).prev( 'p' ).css( 'text-align' ) === 'center' ) {
+ videoMargin = '0 auto';
}
- if ( ! video_element.attr( 'data-ratio' ) ) {
- video_element
+ 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' : video_margin
+ 'margin' : videoMargin
} );
}
- 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();
+ videoWidth = _this.attr( 'data-width' );
+ videoHeight = _this.attr( 'data-height' );
+ videoRatio = _this.attr( 'data-ratio' );
+ videoWrapper = _this.parent();
+ containerWidth = videoWrapper.width();
- if ( video_ratio === 'Infinity' ) {
- video_width = '100%';
+ if ( videoRatio === 'Infinity' ) {
+ videoWidth = '100%';
}
- video_element
+ _this
.removeAttr( 'height' )
.removeAttr( 'width' );
- if ( video_width > container_width ) {
- video_element
- .width( container_width )
- .height( container_width * video_ratio );
+ if ( videoWidth > containerWidth ) {
+ _this
+ .width( containerWidth )
+ .height( containerWidth * videoRatio );
} else {
- video_element
- .width( video_width )
- .height( video_height );
+ _this
+ .width( videoWidth )
+ .height( videoHeight );
}
} );
}
- /**
- * 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 );
+ $( 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 );
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 ee468c33..ff419935 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 +1 @@
-!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);
+!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); \ No newline at end of file
diff --git a/plugins/jetpack/modules/theme-tools/social-links.php b/plugins/jetpack/modules/theme-tools/social-links.php
index 671f58f6..90cf0258 100644
--- a/plugins/jetpack/modules/theme-tools/social-links.php
+++ b/plugins/jetpack/modules/theme-tools/social-links.php
@@ -122,7 +122,7 @@ class Social_Links {
'priority' => 35,
) );
- foreach ( $this->services as $service ) {
+ foreach ( array_keys( $this->publicize->get_services() ) as $service ) {
$choices = $this->get_customize_select( $service );
if ( empty( $choices ) ) {
@@ -203,6 +203,10 @@ class Social_Links {
'' => __( '&mdash; Select &mdash;', 'jetpack' )
);
+ if ( isset( $this->links[ $service ] ) ) {
+ $choices[ $this->links[ $service ] ] = $this->links[ $service ];
+ }
+
$connected_services = $this->publicize->get_services( 'connected' );
if ( isset( $connected_services[ $service ] ) ) {
foreach ( $connected_services[ $service ] as $c ) {