mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-11 18:46:03 +09:00
Update backstretch script to 2.1.17
This commit is contained in:
+58
-32
@@ -56,7 +56,7 @@
|
||||
options = $.extend( obj.options, options );
|
||||
|
||||
// Remove the old instance
|
||||
if ( obj.hasOwnProperty('destroy') ) {
|
||||
if ( typeof obj === 'object' && 'destroy' in obj ) {
|
||||
obj.destroy( true );
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,8 @@
|
||||
var cssBackgroundImage = $this.css( 'background-image' );
|
||||
if ( cssBackgroundImage && cssBackgroundImage !== 'none' ) {
|
||||
images = [ { url: $this.css( 'backgroundImage' ).replace( /url\(|\)|"|'/g, "" ) } ];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$.error( 'No images were supplied for Backstretch, or element must have a CSS-defined background image.' );
|
||||
}
|
||||
}
|
||||
@@ -251,11 +252,13 @@
|
||||
|
||||
if ( typeof url === 'string' ) {
|
||||
url = url.replace( /{{(width|height)}}/g, templateReplacer );
|
||||
} else if (url instanceof Array) {
|
||||
}
|
||||
else if ( url instanceof Array ) {
|
||||
for ( var i = 0; i < url.length; i++ ) {
|
||||
if ( url[ i ].src ) {
|
||||
url[ i ].src = replaceTagsInUrl( url[ i ].src, templateReplacer );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
url[ i ] = replaceTagsInUrl( url[ i ], templateReplacer );
|
||||
}
|
||||
}
|
||||
@@ -285,7 +288,8 @@
|
||||
images[ i ] = widthInsertSort( images[ i ] );
|
||||
var chosen = selectBest( containerWidth, containerHeight, images[ i ] );
|
||||
chosenImages.push( chosen );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// In case a new image was pushed in, process it:
|
||||
if ( typeof images[ i ] === 'string' ) {
|
||||
images[ i ] = { url: images[ i ] };
|
||||
@@ -392,7 +396,8 @@
|
||||
|
||||
continue;
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
image = new Image();
|
||||
image.src = sources[ i ].url;
|
||||
@@ -401,7 +406,8 @@
|
||||
|
||||
if ( image.complete ) {
|
||||
loaded();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$( image ).on( 'load error', loaded );
|
||||
}
|
||||
|
||||
@@ -562,12 +568,10 @@
|
||||
/**
|
||||
* Start-Option (Index)
|
||||
*/
|
||||
if (this.options.start >= this.images.length)
|
||||
{
|
||||
if ( this.options.start >= this.images.length ) {
|
||||
this.options.start = this.images.length - 1;
|
||||
}
|
||||
if (this.options.start < 0)
|
||||
{
|
||||
if ( this.options.start < 0 ) {
|
||||
this.options.start = 0;
|
||||
}
|
||||
|
||||
@@ -686,7 +690,8 @@
|
||||
complete: fadeInNew,
|
||||
easing: options.easing || undefined
|
||||
} );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fadeInNew();
|
||||
}
|
||||
|
||||
@@ -801,7 +806,9 @@
|
||||
var bgCSS = { left: 0, top: 0, right: 'auto', bottom: 'auto' }
|
||||
|
||||
, boxWidth = this.isBody ? this.$root.width() : this.$root.innerWidth()
|
||||
, boxHeight = this.isBody ? ( window.innerHeight ? window.innerHeight : this.$root.height() ) : this.$root.innerHeight()
|
||||
, boxHeight = this.isBody
|
||||
? ( window.innerHeight ? window.innerHeight : this.$root.height() )
|
||||
: this.$root.innerHeight()
|
||||
|
||||
, naturalWidth = this.$itemWrapper.data( 'width' )
|
||||
, naturalHeight = this.$itemWrapper.data( 'height' )
|
||||
@@ -825,18 +832,22 @@
|
||||
if ( boxRatio > ratio ) {
|
||||
width = Math.floor( boxHeight * ratio );
|
||||
height = boxHeight;
|
||||
} else if (boxRatio < ratio) {
|
||||
}
|
||||
else if ( boxRatio < ratio ) {
|
||||
width = boxWidth;
|
||||
height = Math.floor( boxWidth / ratio );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
width = boxWidth;
|
||||
height = boxHeight;
|
||||
}
|
||||
}
|
||||
} else if (scale === 'fill') {
|
||||
}
|
||||
else if ( scale === 'fill' ) {
|
||||
width = boxWidth;
|
||||
height = boxHeight;
|
||||
} else { // 'cover'
|
||||
}
|
||||
else { // 'cover'
|
||||
width = Math.max( boxHeight * ratio, boxWidth );
|
||||
height = Math.max( width / ratio, boxHeight );
|
||||
}
|
||||
@@ -864,7 +875,8 @@
|
||||
} );
|
||||
this.$container.trigger( evt, this );
|
||||
|
||||
} catch(err) {
|
||||
}
|
||||
catch ( err ) {
|
||||
// IE7 seems to trigger resize before the image is loaded.
|
||||
// This try/catch block is a hack to let it fail gracefully.
|
||||
}
|
||||
@@ -904,7 +916,8 @@
|
||||
if ( isVideo ) {
|
||||
that.videoWrapper = new VideoWrapper( selectedImage );
|
||||
that.$item = that.videoWrapper.$video.css( 'pointer-events', 'none' );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
that.$item = $( '<img />' );
|
||||
}
|
||||
|
||||
@@ -915,7 +928,8 @@
|
||||
that.$itemWrapper.css( {
|
||||
'display': 'none'
|
||||
} );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
that.$itemWrapper.css( styles.itemWrapper );
|
||||
that.$item.css( styles.item );
|
||||
}
|
||||
@@ -982,7 +996,8 @@
|
||||
// Avoid transition on first show or if there's no transitionDuration value
|
||||
$wrapper.show();
|
||||
bringInNextImage();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
performTransition( {
|
||||
'new': $wrapper,
|
||||
@@ -1102,7 +1117,8 @@
|
||||
// It's a video - playing until end
|
||||
this.$item.on( 'ended.cycle', $.proxy( callNext, this ) );
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Cycling according to specified duration
|
||||
this._cycleTimeout = setTimeout( $.proxy( callNext, this ), duration );
|
||||
}
|
||||
@@ -1215,7 +1231,8 @@
|
||||
if ( window[ 'YT' ] ) {
|
||||
that._initYoutube();
|
||||
$video.trigger( 'initsuccess' );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$( window ).one( 'youtube_api_load', function () {
|
||||
that._initYoutube();
|
||||
$video.trigger( 'initsuccess' );
|
||||
@@ -1253,7 +1270,8 @@
|
||||
|
||||
if ( !$video[ 0 ].canPlayType || !sources.length ) {
|
||||
$video.trigger( 'initerror' );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$video.trigger( 'initsuccess' );
|
||||
}
|
||||
|
||||
@@ -1377,7 +1395,8 @@
|
||||
that.$video.trigger( 'play' );
|
||||
that.ytPlayer.playVideo();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
that.video.play();
|
||||
}
|
||||
|
||||
@@ -1393,7 +1412,8 @@
|
||||
if ( that.ytReady ) {
|
||||
that.ytPlayer.pauseVideo();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
that.video.pause();
|
||||
}
|
||||
|
||||
@@ -1410,7 +1430,8 @@
|
||||
that.ytPlayer.pauseVideo();
|
||||
that.ytPlayer.seekTo( 0 );
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
that.video.pause();
|
||||
that.video.currentTime = 0;
|
||||
}
|
||||
@@ -1437,7 +1458,8 @@
|
||||
if ( that.ytReady ) {
|
||||
return that.ytPlayer.getCurrentTime();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return that.video.currentTime;
|
||||
}
|
||||
|
||||
@@ -1451,7 +1473,8 @@
|
||||
if ( that.ytReady ) {
|
||||
that.ytPlayer.seekTo( seconds, true );
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
that.video.currentTime = seconds;
|
||||
}
|
||||
|
||||
@@ -1465,7 +1488,8 @@
|
||||
if ( that.ytReady ) {
|
||||
return that.ytPlayer.getDuration();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return that.video.duration;
|
||||
}
|
||||
|
||||
@@ -1496,7 +1520,8 @@
|
||||
if ( 'matchMedia' in window ) {
|
||||
if ( window.matchMedia( "(orientation: portrait)" ).matches ) {
|
||||
return 'portrait';
|
||||
} else if (window.matchMedia("(orientation: landscape)").matches) {
|
||||
}
|
||||
else if ( window.matchMedia( "(orientation: landscape)" ).matches ) {
|
||||
return 'landscape';
|
||||
}
|
||||
}
|
||||
@@ -1550,7 +1575,8 @@
|
||||
|
||||
return !(
|
||||
// iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
|
||||
((platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534) ||
|
||||
( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf(
|
||||
"iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
|
||||
|
||||
// Opera Mini
|
||||
( window.operamini && ( {} ).toString.call( window.operamini ) === "[object OperaMini]" ) ||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -56,7 +56,7 @@ class DisplayFeaturedImageGenesisEnqueue {
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
$minify = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
wp_register_script( 'backstretch', plugins_url( "/js/backstretch{$minify}.js", dirname( __FILE__ ) ), array( 'jquery' ), '2.1.16', true );
|
||||
wp_register_script( 'backstretch', plugins_url( "/js/backstretch{$minify}.js", dirname( __FILE__ ) ), array( 'jquery' ), '2.1.17', true );
|
||||
wp_enqueue_script(
|
||||
'displayfeaturedimage-backstretch-set',
|
||||
plugins_url( "/js/backstretch-set{$minify}.js", dirname( __FILE__ ) ),
|
||||
|
||||
Reference in New Issue
Block a user