From 00b68959e5d4520cf78f8592a78677183b18991a Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 5 Oct 2020 00:02:20 +0200 Subject: [PATCH] Update vd.js --- js/vd.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/js/vd.js b/js/vd.js index 5c91dff..fe8e758 100644 --- a/js/vd.js +++ b/js/vd.js @@ -277,7 +277,12 @@ const vd = (function() { }); player._oldRequestFullscreen = player.requestFullscreen; - player.requestFullscreen = () => { + player.requestFullscreen = function() { + var player = document.getElementById(this.id()); + if (player === null) { + return; + } + player = typeof player.player === "function" ? player.player() : player.player; player._oldRequestFullscreen(...arguments); setTimeout(() => { if (screen.orientation) { @@ -287,7 +292,12 @@ const vd = (function() { }; player._oldExitFullscreen = player.exitFullscreen; - player.exitFullscreen = () => { + player.exitFullscreen = function() { + var player = document.getElementById(this.id()); + if (player === null) { + return; + } + player = typeof player.player === "function" ? player.player() : player.player; player._oldExitFullscreen(...arguments); setTimeout(() => { if (screen.orientation) { @@ -333,10 +343,15 @@ const vd = (function() { // F -> toggle fullscreen case 70: e.preventDefault(); - if (player.isFullscreen()) { - player.exitFullscreen(); + let p = document.getElementById(player.id()); + if (p === null) { + break; + } + p = typeof p.player === "function" ? p.player() : p.player; + if (p.isFullscreen()) { + p.exitFullscreen(); } else { - player.requestFullscreen(); + p.requestFullscreen(); } break;