Update vd.js

This commit is contained in:
Thomas Forgione 2020-10-05 00:02:20 +02:00
parent cff8164bcd
commit 00b68959e5
1 changed files with 20 additions and 5 deletions

View File

@ -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;