Featured Video Plus - Version 2.2.1

Version Description

Download this release

Release Info

Developer a.hoereth
Plugin Icon 128x128 Featured Video Plus
Version 2.2.1
Comparing to
See all releases

Code changes from version 2.2.0 to 2.2.1

CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
  # Changelog #
2
 
 
 
 
 
 
 
 
3
  ## 2.2.0: 2015-07-20 ##
4
  * Shortcodes can now be used as featured content (e.g. `[gallery]`).
5
  * Added fine tuned autoplay options.
1
  # Changelog #
2
 
3
+ ## 2.2.1: 2015-09-08 ##
4
+ * Now compatible with infinite scroll! ([*](https://wordpress.org/support/topic/vimeo-thrumbnails-not-work), [*](https://wordpress.org/support/topic/video-embedding-issue-when-using-infinite-scroll), [*](https://wordpress.org/support/topic/featured-video-plus-jetpack-infinite-scroll-video-width-problem))
5
+ * Fix bad overlay sizing when loading from cache. ([*](https://wordpress.org/support/topic/video-shrinking-on-2nd-play))
6
+ * Fix local video responsiveness in recent WordPress videos.
7
+ * The `has_post_video` function is now pluggable.
8
+ * The `get_the_post_video_url` function post id argument is now optional ([*](https://wordpress.org/support/topic/video-url)).
9
+
10
  ## 2.2.0: 2015-07-20 ##
11
  * Shortcodes can now be used as featured content (e.g. `[gallery]`).
12
  * Added fine tuned autoplay options.
featured-video-plus.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Featured Video Plus
4
  Plugin URI: http://yrnxt.com/wordpress/featured-video-plus/
5
  Description: Add Featured Videos to your posts and pages.
6
- Version: 2.2.0
7
  Author: Alexander Höreth
8
  Author URI: http://yrnxt.com
9
  Text Domain: featured-video-plus
@@ -32,7 +32,7 @@ License: GPL2
32
  // ********************
33
  // CONSTANTS
34
  if ( ! defined( 'FVP_VERSION' ) ) {
35
- define( 'FVP_VERSION', '2.2.0' );
36
  }
37
 
38
  $pathinfo = pathinfo( dirname( plugin_basename( __FILE__ ) ) );
3
  Plugin Name: Featured Video Plus
4
  Plugin URI: http://yrnxt.com/wordpress/featured-video-plus/
5
  Description: Add Featured Videos to your posts and pages.
6
+ Version: 2.2.1
7
  Author: Alexander Höreth
8
  Author URI: http://yrnxt.com
9
  Text Domain: featured-video-plus
32
  // ********************
33
  // CONSTANTS
34
  if ( ! defined( 'FVP_VERSION' ) ) {
35
+ define( 'FVP_VERSION', '2.2.1' );
36
  }
37
 
38
  $pathinfo = pathinfo( dirname( plugin_basename( __FILE__ ) ) );
js/frontend.js CHANGED
@@ -10,6 +10,7 @@ var initFeaturedVideoPlus;
10
  var loadBg = 'url(\'' + fvpdata.loadicon + '\')';
11
  var bgState;
12
  var cache = {};
 
13
 
14
 
15
  /**
@@ -69,7 +70,11 @@ var initFeaturedVideoPlus;
69
  // preload images
70
  if (bgState === undefined) {
71
  [fvpdata.playicon, fvpdata.loadicon].forEach(function(val) {
72
- $('body').append( $('<img/>', { src: val }).hide() );
 
 
 
 
73
  });
74
  }
75
 
@@ -87,6 +92,7 @@ var initFeaturedVideoPlus;
87
 
88
  // Is the overlay displayed currently?
89
  if (0 === $img.siblings('.fvp-loader').length) {
 
90
  // Copy classes and css styles onto the play icon overlay.
91
  $loader.addClass($img.attr('class')).css({
92
  height: $img.height(),
@@ -94,7 +100,8 @@ var initFeaturedVideoPlus;
94
  margin: $img.css('margin')
95
  });
96
 
97
- // Fade out image and insert overlay.
 
98
  $img.animate({ opacity: fvpdata.opacity }).before($loader);
99
  } else if (bgState !== loadBg) {
100
  $img.animate({ opacity: 1 });
@@ -173,12 +180,16 @@ var initFeaturedVideoPlus;
173
  } else {
174
  // From cache
175
  $('#DOMWindow').html( cache[id] );
 
176
  $(window).trigger('scroll');
177
  }
178
  }
179
 
180
 
181
- initFeaturedVideoPlus = function() {
 
 
 
182
  // remove wrapping anchors
183
  // doing this twice with a 1 second delay to fix wrapped local video posters
184
  unwrap();
@@ -190,7 +201,9 @@ var initFeaturedVideoPlus;
190
  sizeLocal();
191
 
192
  // add hover effect and preload icons
193
- $('.fvp-overlay, .fvp-dynamic').hover(hover, hover);
 
 
194
  triggerPlayLoad();
195
 
196
  // on-demand video insertion click handler
@@ -198,8 +211,18 @@ var initFeaturedVideoPlus;
198
 
199
  // overlay click handler
200
  $('.fvp-overlay').click(overlayTrigger);
 
 
 
 
 
 
 
 
 
201
  };
202
 
 
203
  // Initialization after DOM is completly loaded.
204
  $(document).ready(function() {
205
  // Wordaround for chrome bug
10
  var loadBg = 'url(\'' + fvpdata.loadicon + '\')';
11
  var bgState;
12
  var cache = {};
13
+ var initTimeout;
14
 
15
 
16
  /**
70
  // preload images
71
  if (bgState === undefined) {
72
  [fvpdata.playicon, fvpdata.loadicon].forEach(function(val) {
73
+ $('body').append($('<img/>', {
74
+ src: val,
75
+ alt: 'preload image',
76
+ style: 'display: none;'
77
+ }));
78
  });
79
  }
80
 
92
 
93
  // Is the overlay displayed currently?
94
  if (0 === $img.siblings('.fvp-loader').length) {
95
+
96
  // Copy classes and css styles onto the play icon overlay.
97
  $loader.addClass($img.attr('class')).css({
98
  height: $img.height(),
100
  margin: $img.css('margin')
101
  });
102
 
103
+ // Set icon to play icon, fade out image and insert overlay.
104
+ $loader.css({ backgroundImage: (bgState = playBg) });
105
  $img.animate({ opacity: fvpdata.opacity }).before($loader);
106
  } else if (bgState !== loadBg) {
107
  $img.animate({ opacity: 1 });
180
  } else {
181
  // From cache
182
  $('#DOMWindow').html( cache[id] );
183
+ sizeLocal();
184
  $(window).trigger('scroll');
185
  }
186
  }
187
 
188
 
189
+ /**
190
+ * Initialize the plugins JS functionality.
191
+ */
192
+ function init() {
193
  // remove wrapping anchors
194
  // doing this twice with a 1 second delay to fix wrapped local video posters
195
  unwrap();
201
  sizeLocal();
202
 
203
  // add hover effect and preload icons
204
+ $('.fvp-overlay, .fvp-dynamic')
205
+ .off('mouseenter').on('mouseenter', hover)
206
+ .off('mouseleave').on('mouseleave', hover);
207
  triggerPlayLoad();
208
 
209
  // on-demand video insertion click handler
211
 
212
  // overlay click handler
213
  $('.fvp-overlay').click(overlayTrigger);
214
+ }
215
+
216
+
217
+ /**
218
+ * Debounced version of the init function.
219
+ */
220
+ initFeaturedVideoPlus = function() {
221
+ clearTimeout(initTimeout);
222
+ initTimeout = setTimeout(init, 50);
223
  };
224
 
225
+
226
  // Initialization after DOM is completly loaded.
227
  $(document).ready(function() {
228
  // Wordaround for chrome bug
js/frontend.min.js CHANGED
@@ -1 +1 @@
1
- var initFeaturedVideoPlus;!function(a){"use strict";function t(){a(".has-post-video a>.featured-video-plus,.has-post-video a>.fvp-dynamic,.has-post-video a>.fvp-overlay,.has-post-video a>.wp-video,.has-post-video a>.wp-video-shortcode").unwrap(),a(".has-post-video .post-thumbnail>.post-thumbnail").removeClass("post-thumbnail"),a("a.post-thumbnail:empty").not(".fvp-dynamic, .fvp-overlay").remove()}function e(){fvpdata.fitvids&&a(".featured-video-plus.fvp-responsive").fitVids({customSelector:["iframe","object","embed"]})}function i(){if(fvpdata.width&&!fvpdata.fitvids){a(".fvp-local .wp-video").css({width:fvpdata.width,height:"auto"});var t=a(".fvp-local .wp-video .wp-video-shortcode");t.attr({width:fvpdata.width,height:fvpdata.width/t.attr("width")*t.attr("heigth")})}}function o(){void 0===p&&[fvpdata.playicon,fvpdata.loadicon].forEach(function(t){a("body").append(a("<img/>",{src:t}).hide())}),p=p===s?v:s,c.css({backgroundImage:p})}function d(t){var e=a(t.currentTarget).children("img");0===e.siblings(".fvp-loader").length?(c.addClass(e.attr("class")).css({height:e.height(),width:e.width(),margin:e.css("margin")}),e.animate({opacity:fvpdata.opacity}).before(c)):p!==v&&(e.animate({opacity:1}),c.remove())}function n(i){i.preventDefault();var d=a(i.currentTarget),n=parseInt(d.attr("data-id"),10);o(),a.post(fvpdata.ajaxurl,{action:"fvp_get_embed",fvp_nonce:fvpdata.nonce,id:n},function(a){if(a.success){var i=d.parent();d.replaceWith(a.data),i.find(".wp-audio-shortcode, .wp-video-shortcode").mediaelementplayer(),e(),t()}o()})}function r(t){t.preventDefault();var e=a(t.currentTarget),o=parseInt(e.attr("data-id"),10);e.openDOMWindow({eventType:null,windowPadding:0,borderSize:0,windowBGColor:"transparent",overlayOpacity:100*fvpdata.opacity,width:"100%",height:"100%"}),a("#DOMWindow").css({backgroundImage:v}),f[o]?(a("#DOMWindow").html(f[o]),a(window).trigger("scroll")):a.post(fvpdata.ajaxurl,{action:"fvp_get_embed",fvp_nonce:fvpdata.nonce,id:o},function(t){t.success&&(f[o]=t.data,a("#DOMWindow").html(t.data),i(),a(window).trigger("scroll"))})}var p,c=a("<div />").addClass("fvp-loader"),s="url('"+fvpdata.playicon+"')",v="url('"+fvpdata.loadicon+"')",f={};initFeaturedVideoPlus=function(){t(),setTimeout(t,1e3),e(),i(),a(".fvp-overlay, .fvp-dynamic").hover(d,d),o(),a(".fvp-dynamic").click(n),a(".fvp-overlay").click(r)},a(document).ready(function(){window.chrome&&a(".featured-video-plus iframe").each(function(){this.src=this.src}),initFeaturedVideoPlus()})}(jQuery);
1
+ var initFeaturedVideoPlus;!function(a){"use strict";function t(){a(".has-post-video a>.featured-video-plus,.has-post-video a>.fvp-dynamic,.has-post-video a>.fvp-overlay,.has-post-video a>.wp-video,.has-post-video a>.wp-video-shortcode").unwrap(),a(".has-post-video .post-thumbnail>.post-thumbnail").removeClass("post-thumbnail"),a("a.post-thumbnail:empty").not(".fvp-dynamic, .fvp-overlay").remove()}function e(){fvpdata.fitvids&&a(".featured-video-plus.fvp-responsive").fitVids({customSelector:["iframe","object","embed"]})}function i(){if(fvpdata.width&&!fvpdata.fitvids){a(".fvp-local .wp-video").css({width:fvpdata.width,height:"auto"});var t=a(".fvp-local .wp-video .wp-video-shortcode");t.attr({width:fvpdata.width,height:fvpdata.width/t.attr("width")*t.attr("heigth")})}}function o(){void 0===p&&[fvpdata.playicon,fvpdata.loadicon].forEach(function(t){a("body").append(a("<img/>",{src:t,alt:"preload image",style:"display: none;"}))}),p=p===f?l:f,v.css({backgroundImage:p})}function d(t){var e=a(t.currentTarget).children("img");0===e.siblings(".fvp-loader").length?(v.addClass(e.attr("class")).css({height:e.height(),width:e.width(),margin:e.css("margin")}),v.css({backgroundImage:p=f}),e.animate({opacity:fvpdata.opacity}).before(v)):p!==l&&(e.animate({opacity:1}),v.remove())}function n(i){i.preventDefault();var d=a(i.currentTarget),n=parseInt(d.attr("data-id"),10);o(),a.post(fvpdata.ajaxurl,{action:"fvp_get_embed",fvp_nonce:fvpdata.nonce,id:n},function(a){if(a.success){var i=d.parent();d.replaceWith(a.data),i.find(".wp-audio-shortcode, .wp-video-shortcode").mediaelementplayer(),e(),t()}o()})}function r(t){t.preventDefault();var e=a(t.currentTarget),o=parseInt(e.attr("data-id"),10);e.openDOMWindow({eventType:null,windowPadding:0,borderSize:0,windowBGColor:"transparent",overlayOpacity:100*fvpdata.opacity,width:"100%",height:"100%"}),a("#DOMWindow").css({backgroundImage:l}),u[o]?(a("#DOMWindow").html(u[o]),i(),a(window).trigger("scroll")):a.post(fvpdata.ajaxurl,{action:"fvp_get_embed",fvp_nonce:fvpdata.nonce,id:o},function(t){t.success&&(u[o]=t.data,a("#DOMWindow").html(t.data),i(),a(window).trigger("scroll"))})}function s(){t(),setTimeout(t,1e3),e(),i(),a(".fvp-overlay, .fvp-dynamic").off("mouseenter").on("mouseenter",d).off("mouseleave").on("mouseleave",d),o(),a(".fvp-dynamic").click(n),a(".fvp-overlay").click(r)}var p,c,v=a("<div />").addClass("fvp-loader"),f="url('"+fvpdata.playicon+"')",l="url('"+fvpdata.loadicon+"')",u={};initFeaturedVideoPlus=function(){clearTimeout(c),c=setTimeout(s,50)},a(document).ready(function(){window.chrome&&a(".featured-video-plus iframe").each(function(){this.src=this.src}),initFeaturedVideoPlus()})}(jQuery);
js/jquery.fitvids.js CHANGED
@@ -1,7 +1,6 @@
1
- /*global jQuery */
2
  /*jshint browser:true */
3
  /*!
4
- * FitVids 1.1
5
  *
6
  * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
7
  * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
@@ -9,9 +8,9 @@
9
  *
10
  */
11
 
12
- (function( $ ){
13
 
14
- "use strict";
15
 
16
  $.fn.fitVids = function( options ) {
17
  var settings = {
@@ -23,7 +22,7 @@
23
  // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
24
  var head = document.head || document.getElementsByTagName('head')[0];
25
  var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
26
- var div = document.createElement('div');
27
  div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
28
  head.appendChild(div.childNodes[1]);
29
  }
@@ -34,12 +33,12 @@
34
 
35
  return this.each(function(){
36
  var selectors = [
37
- "iframe[src*='player.vimeo.com']",
38
- "iframe[src*='youtube.com']",
39
- "iframe[src*='youtube-nocookie.com']",
40
- "iframe[src*='kickstarter.com'][src*='video.html']",
41
- "object",
42
- "embed"
43
  ];
44
 
45
  if (settings.customSelector) {
@@ -53,10 +52,10 @@
53
  }
54
 
55
  var $allVideos = $(this).find(selectors.join(','));
56
- $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
57
  $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
58
 
59
- $allVideos.each(function(){
60
  var $this = $(this);
61
  if($this.parents(ignoreList).length > 0) {
62
  return; // Disable FitVids on this video.
@@ -71,10 +70,10 @@
71
  width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
72
  aspectRatio = height / width;
73
  if(!$this.attr('id')){
74
- var videoID = 'fitvid' + Math.floor(Math.random()*999999);
75
  $this.attr('id', videoID);
76
  }
77
- $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
78
  $this.removeAttr('height').removeAttr('width');
79
  });
80
  });
 
1
  /*jshint browser:true */
2
  /*!
3
+ * FitVids master-2015-08
4
  *
5
  * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
6
  * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
8
  *
9
  */
10
 
11
+ ;(function( $ ){
12
 
13
+ 'use strict';
14
 
15
  $.fn.fitVids = function( options ) {
16
  var settings = {
22
  // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
23
  var head = document.head || document.getElementsByTagName('head')[0];
24
  var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
25
+ var div = document.createElement("div");
26
  div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
27
  head.appendChild(div.childNodes[1]);
28
  }
33
 
34
  return this.each(function(){
35
  var selectors = [
36
+ 'iframe[src*="player.vimeo.com"]',
37
+ 'iframe[src*="youtube.com"]',
38
+ 'iframe[src*="youtube-nocookie.com"]',
39
+ 'iframe[src*="kickstarter.com"][src*="video.html"]',
40
+ 'object',
41
+ 'embed'
42
  ];
43
 
44
  if (settings.customSelector) {
52
  }
53
 
54
  var $allVideos = $(this).find(selectors.join(','));
55
+ $allVideos = $allVideos.not('object object'); // SwfObj conflict patch
56
  $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
57
 
58
+ $allVideos.each(function(count){
59
  var $this = $(this);
60
  if($this.parents(ignoreList).length > 0) {
61
  return; // Disable FitVids on this video.
70
  width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
71
  aspectRatio = height / width;
72
  if(!$this.attr('id')){
73
+ var videoID = 'fitvid' + count;
74
  $this.attr('id', videoID);
75
  }
76
+ $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
77
  $this.removeAttr('height').removeAttr('width');
78
  });
79
  });
js/jquery.fitvids.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){"use strict";t.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var r=document.head||document.getElementsByTagName("head")[0],a=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}",d=document.createElement("div");d.innerHTML='<p>x</p><style id="fit-vids-style">'+a+"</style>",r.appendChild(d.childNodes[1])}return e&&t.extend(i,e),this.each(function(){var e=["iframe[src*='player.vimeo.com']","iframe[src*='youtube.com']","iframe[src*='youtube-nocookie.com']","iframe[src*='kickstarter.com'][src*='video.html']","object","embed"];i.customSelector&&e.push(i.customSelector);var r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);var a=t(this).find(e.join(","));a=a.not("object object"),a=a.not(r),a.each(function(){var e=t(this);if(!(e.parents(r).length>0||"embed"===this.tagName.toLowerCase()&&e.parent("object").length||e.parent(".fluid-width-video-wrapper").length)){e.css("height")||e.css("width")||!isNaN(e.attr("height"))&&!isNaN(e.attr("width"))||(e.attr("height",9),e.attr("width",16));var i="object"===this.tagName.toLowerCase()||e.attr("height")&&!isNaN(parseInt(e.attr("height"),10))?parseInt(e.attr("height"),10):e.height(),a=isNaN(parseInt(e.attr("width"),10))?e.width():parseInt(e.attr("width"),10),d=i/a;if(!e.attr("id")){var o="fitvid"+Math.floor(999999*Math.random());e.attr("id",o)}e.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*d+"%"),e.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto);
1
+ !function(t){"use strict";t.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var r=document.head||document.getElementsByTagName("head")[0],a=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}",d=document.createElement("div");d.innerHTML='<p>x</p><style id="fit-vids-style">'+a+"</style>",r.appendChild(d.childNodes[1])}return e&&t.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);var a=t(this).find(e.join(","));a=a.not("object object"),a=a.not(r),a.each(function(e){var i=t(this);if(!(i.parents(r).length>0||"embed"===this.tagName.toLowerCase()&&i.parent("object").length||i.parent(".fluid-width-video-wrapper").length)){i.css("height")||i.css("width")||!isNaN(i.attr("height"))&&!isNaN(i.attr("width"))||(i.attr("height",9),i.attr("width",16));var a="object"===this.tagName.toLowerCase()||i.attr("height")&&!isNaN(parseInt(i.attr("height"),10))?parseInt(i.attr("height"),10):i.height(),d=isNaN(parseInt(i.attr("width"),10))?i.width():parseInt(i.attr("width"),10),o=a/d;if(!i.attr("id")){var h="fitvid"+e;i.attr("id",h)}i.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*o+"%"),i.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto);
php/class-frontend.php CHANGED
@@ -46,7 +46,7 @@ class FVP_Frontend extends Featured_Video_Plus {
46
  'jquery.fitvids',
47
  FVP_URL . "js/jquery.fitvids$min.js",
48
  array( 'jquery' ),
49
- '1.1',
50
  false
51
  );
52
 
@@ -145,29 +145,49 @@ class FVP_Frontend extends Featured_Video_Plus {
145
  $single_replace = is_single() &&
146
  ! empty( $options['single_replace'] ) && $options['single_replace'];
147
 
 
148
  if ( ( 'manual' === $mode ) ||
149
  ( ! self::check_conditions( $conditions ) ) ||
150
  ( ! has_post_video( $post_id ) )
151
  ) {
152
  return $html;
 
 
153
 
154
- } elseif ( 'dynamic' === $mode && ! $single_replace ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  return sprintf(
156
- '<a href="#" data-id="%1$s" class="fvp-dynamic post-thumbnail">%2$s</a>',
157
  $post_id,
158
- $html
 
159
  );
 
160
 
161
- } elseif ( 'overlay' === $mode && ! $single_replace ) {
 
162
  return sprintf(
163
- '<a href="#" data-id="%1$s" class="fvp-overlay post-thumbnail">%2$s</a>' .
164
- '<div id="fvp-cache-%1$s" style="display: none;"></div>',
165
  $post_id,
166
- $html
 
167
  );
168
  }
169
 
170
- return get_the_post_video( $post_id, $size );
 
171
  }
172
 
173
 
46
  'jquery.fitvids',
47
  FVP_URL . "js/jquery.fitvids$min.js",
48
  array( 'jquery' ),
49
+ 'master-2015-08',
50
  false
51
  );
52
 
145
  $single_replace = is_single() &&
146
  ! empty( $options['single_replace'] ) && $options['single_replace'];
147
 
148
+ // Don't show a video.
149
  if ( ( 'manual' === $mode ) ||
150
  ( ! self::check_conditions( $conditions ) ) ||
151
  ( ! has_post_video( $post_id ) )
152
  ) {
153
  return $html;
154
+ }
155
+
156
 
157
+ // Playicon with onload JavaScript for initalizing FVP JS functionality
158
+ // which has to be done from here because of infinite scroll plugins.
159
+ $onload = '<img class="playicon onload" ' .
160
+ 'src="'. FVP_URL . 'img/playicon.png" ' .
161
+ 'alt="Featured Video Play Icon" ' .
162
+ 'onload="(function() {' .
163
+ "('initFeaturedVideoPlus' in this) && ".
164
+ "('function' === typeof initFeaturedVideoPlus) && ".
165
+ "initFeaturedVideoPlus();" .
166
+ '})();" ' .
167
+ '/>';
168
+
169
+ // Show the video on-click - lazy load.
170
+ if ( 'dynamic' === $mode && ! $single_replace ) {
171
  return sprintf(
172
+ '<a href="#" data-id="%s" class="fvp-dynamic post-thumbnail">%s</a>%s',
173
  $post_id,
174
+ $html,
175
+ $onload
176
  );
177
+ }
178
 
179
+ // Show the video on-click in an overlay.
180
+ if ( 'overlay' === $mode && ! $single_replace ) {
181
  return sprintf(
182
+ '<a href="#" data-id="%s" class="fvp-overlay post-thumbnail">%s</a>%s',
 
183
  $post_id,
184
+ $html,
185
+ $onload
186
  );
187
  }
188
 
189
+ // Replace the featured image with the video.
190
+ return get_the_post_video( $post_id, $size ) . $onload;
191
  }
192
 
193
 
php/functions.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  /**
4
  * Checks if post has a featured video
5
  *
@@ -18,6 +19,7 @@ function has_post_video( $post_id = null ) {
18
 
19
  return true;
20
  }
 
21
 
22
 
23
  /**
@@ -107,7 +109,7 @@ function get_the_post_video_image( $post_id = null, $size = null ) {
107
  * @param {int} $post_id
108
  * @return {string/boolean} url or false
109
  */
110
- function get_the_post_video_url( $post_id ) {
111
  $post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
112
 
113
  $meta = get_post_meta( $post_id, '_fvp_video', true );
1
  <?php
2
 
3
+ if ( ! function_exists('has_post_video') ) :
4
  /**
5
  * Checks if post has a featured video
6
  *
19
 
20
  return true;
21
  }
22
+ endif;
23
 
24
 
25
  /**
109
  * @param {int} $post_id
110
  * @return {string/boolean} url or false
111
  */
112
+ function get_the_post_video_url( $post_id = null ) {
113
  $post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
114
 
115
  $meta = get_post_meta( $post_id, '_fvp_video', true );
readme.txt CHANGED
@@ -9,8 +9,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  Requires at least: 3.7
12
- Tested up to: 4.2.2
13
- Stable tag: 2.2.0
14
 
15
  Add Featured Videos to your posts and pages. Works like magic with most themes which use Featured Images. Local Media, YouTube, Vimeo and many more.
16
 
@@ -107,6 +107,13 @@ Yes, please! Check out the public [Featured Video Plus Translation Project](http
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
110
  = 2.2.0: 2015-07-20 =
111
  * Shortcodes can now be used as featured content (e.g. `[gallery]`).
112
  * Added fine tuned autoplay options.
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  Requires at least: 3.7
12
+ Tested up to: 4.3
13
+ Stable tag: 2.2.1
14
 
15
  Add Featured Videos to your posts and pages. Works like magic with most themes which use Featured Images. Local Media, YouTube, Vimeo and many more.
16
 
107
 
108
  == Changelog ==
109
 
110
+ = 2.2.1: 2015-09-08 =
111
+ * Now compatible with infinite scroll! ([*](https://wordpress.org/support/topic/vimeo-thrumbnails-not-work), [*](https://wordpress.org/support/topic/video-embedding-issue-when-using-infinite-scroll), [*](https://wordpress.org/support/topic/featured-video-plus-jetpack-infinite-scroll-video-width-problem))
112
+ * Fix bad overlay sizing when loading from cache. ([*](https://wordpress.org/support/topic/video-shrinking-on-2nd-play))
113
+ * Fix local video responsiveness in recent WordPress videos.
114
+ * The `has_post_video` function is now pluggable.
115
+ * The `get_the_post_video_url` function post id argument is now optional ([*](https://wordpress.org/support/topic/video-url)).
116
+
117
  = 2.2.0: 2015-07-20 =
118
  * Shortcodes can now be used as featured content (e.g. `[gallery]`).
119
  * Added fine tuned autoplay options.
styles/frontend.css CHANGED
@@ -2,6 +2,10 @@
2
  width: auto !important;
3
  height: auto !important;
4
  }
 
 
 
 
5
  .featured-video-plus.fvp-responsive .mejs-container {
6
  width: 100% !important;
7
  height: auto !important;
@@ -74,3 +78,6 @@
74
  .featured-video-plus.fvp-responsive.fvp-spotify .fluid-width-video-wrapper {
75
  padding-top: 100% !important;
76
  }
 
 
 
2
  width: auto !important;
3
  height: auto !important;
4
  }
5
+ .featured-video-plus.fvp-responsive .wp-video video {
6
+ width: 100% !important;
7
+ height: auto !important;
8
+ }
9
  .featured-video-plus.fvp-responsive .mejs-container {
10
  width: 100% !important;
11
  height: auto !important;
78
  .featured-video-plus.fvp-responsive.fvp-spotify .fluid-width-video-wrapper {
79
  padding-top: 100% !important;
80
  }
81
+ .onload.playicon {
82
+ display: none;
83
+ }