From bc2bb18af7543f2aabb5ce311ed658b1da471cc2 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 27 Aug 2021 17:45:34 +0200 Subject: [PATCH] Simplify the `PDFViewerApplication.supportsFullscreen` getter A lot of the code in this getter has existed ever since the initial PresentationMode-implementation was first added all the way back in PR 1938 (which is nine years ago now). At this point in time however, there's now a simpler way detect if a browser supports the FullScreen API and we should thus be able to simplify this getter; please refer to https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenEnabled#browser_compatibility --- web/app.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/web/app.js b/web/app.js index 5d12b6dda..c2c6b7eae 100644 --- a/web/app.js +++ b/web/app.js @@ -679,21 +679,13 @@ const PDFViewerApplication = { if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { return shadow(this, "supportsFullscreen", document.fullscreenEnabled); } - const doc = document.documentElement; - let support = !!( - doc.requestFullscreen || - doc.mozRequestFullScreen || - doc.webkitRequestFullScreen + return shadow( + this, + "supportsFullscreen", + document.fullscreenEnabled || + document.mozFullScreenEnabled || + document.webkitFullscreenEnabled ); - - if ( - document.fullscreenEnabled === false || - document.mozFullScreenEnabled === false || - document.webkitFullscreenEnabled === false - ) { - support = false; - } - return shadow(this, "supportsFullscreen", support); }, get supportsIntegratedFind() {