summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/infinite-scroll/infinity.js')
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.js b/plugins/jetpack/modules/infinite-scroll/infinity.js
index 010b7148..e1a508e4 100644
--- a/plugins/jetpack/modules/infinite-scroll/infinity.js
+++ b/plugins/jetpack/modules/infinite-scroll/infinity.js
@@ -486,6 +486,14 @@ Scroller.prototype.checkViewportOnLoad = function( ev ) {
ev.data.self.ensureFilledViewport();
}
+function fullscreenState() {
+ return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement
+ ? 1
+ : 0;
+}
+
+var previousFullScrenState = fullscreenState();
+
/**
* Identify archive page that corresponds to majority of posts shown in the current browser window.
*/
@@ -496,7 +504,20 @@ Scroller.prototype.determineURL = function () {
windowSize = windowBottom - windowTop,
setsInView = [],
setsHidden = [],
- pageNum = false;
+ pageNum = false,
+ currentFullScreenState = fullscreenState();
+
+ // xor - check if the state has changed
+ if ( previousFullScrenState ^ currentFullScreenState ) {
+ // If we just switched to/from fullscreen,
+ // don't do the div clearing/caching or the
+ // URL setting. Doing so can break video playback
+ // if the video goes to fullscreen.
+
+ previousFullScrenState = currentFullScreenState;
+ return;
+ }
+ previousFullScrenState = currentFullScreenState;
// Find out which sets are in view
$( '.' + self.wrapperClass ).each( function() {