Remove prefixed fullscreen properties/methods from the MOZCENTRAL builds
The unprefixed version of the fullscreen API has been enabled for quite some time in Firefox, see below, hence we can (slightly) clean-up the relevant code. - https://developer.mozilla.org/en-us/docs/Web/API/Document/fullscreenEnabled#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen#browser_compatibility
This commit is contained in:
parent
59f938d073
commit
1c802e0e6c
32
web/app.js
32
web/app.js
@ -657,26 +657,22 @@ const PDFViewerApplication = {
|
||||
},
|
||||
|
||||
get supportsFullscreen() {
|
||||
let support;
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
support =
|
||||
document.fullscreenEnabled === true ||
|
||||
document.mozFullScreenEnabled === true;
|
||||
} else {
|
||||
const doc = document.documentElement;
|
||||
support = !!(
|
||||
doc.requestFullscreen ||
|
||||
doc.mozRequestFullScreen ||
|
||||
doc.webkitRequestFullScreen
|
||||
);
|
||||
return shadow(this, "supportsFullscreen", document.fullscreenEnabled);
|
||||
}
|
||||
const doc = document.documentElement;
|
||||
let support = !!(
|
||||
doc.requestFullscreen ||
|
||||
doc.mozRequestFullScreen ||
|
||||
doc.webkitRequestFullScreen
|
||||
);
|
||||
|
||||
if (
|
||||
document.fullscreenEnabled === false ||
|
||||
document.mozFullScreenEnabled === false ||
|
||||
document.webkitFullscreenEnabled === false
|
||||
) {
|
||||
support = false;
|
||||
}
|
||||
if (
|
||||
document.fullscreenEnabled === false ||
|
||||
document.mozFullScreenEnabled === false ||
|
||||
document.webkitFullscreenEnabled === false
|
||||
) {
|
||||
support = false;
|
||||
}
|
||||
return shadow(this, "supportsFullscreen", support);
|
||||
},
|
||||
|
@ -86,14 +86,22 @@ class PDFPresentationMode {
|
||||
this._setSwitchInProgress();
|
||||
this._notifyStateChange();
|
||||
|
||||
if (this.container.requestFullscreen) {
|
||||
this.container.requestFullscreen();
|
||||
} else if (this.container.mozRequestFullScreen) {
|
||||
this.container.mozRequestFullScreen();
|
||||
} else if (this.container.webkitRequestFullscreen) {
|
||||
this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
if (this.container.requestFullscreen) {
|
||||
this.container.requestFullscreen();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
if (this.container.requestFullscreen) {
|
||||
this.container.requestFullscreen();
|
||||
} else if (this.container.mozRequestFullScreen) {
|
||||
this.container.mozRequestFullScreen();
|
||||
} else if (this.container.webkitRequestFullscreen) {
|
||||
this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this.args = {
|
||||
@ -148,6 +156,9 @@ class PDFPresentationMode {
|
||||
}
|
||||
|
||||
get isFullscreen() {
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
return !!document.fullscreenElement;
|
||||
}
|
||||
return !!(
|
||||
document.fullscreenElement ||
|
||||
document.mozFullScreen ||
|
||||
@ -468,8 +479,8 @@ class PDFPresentationMode {
|
||||
this.fullscreenChangeBind = this._fullscreenChange.bind(this);
|
||||
|
||||
window.addEventListener("fullscreenchange", this.fullscreenChangeBind);
|
||||
window.addEventListener("mozfullscreenchange", this.fullscreenChangeBind);
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
window.addEventListener("mozfullscreenchange", this.fullscreenChangeBind);
|
||||
window.addEventListener(
|
||||
"webkitfullscreenchange",
|
||||
this.fullscreenChangeBind
|
||||
@ -482,11 +493,11 @@ class PDFPresentationMode {
|
||||
*/
|
||||
_removeFullscreenChangeListeners() {
|
||||
window.removeEventListener("fullscreenchange", this.fullscreenChangeBind);
|
||||
window.removeEventListener(
|
||||
"mozfullscreenchange",
|
||||
this.fullscreenChangeBind
|
||||
);
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
window.removeEventListener(
|
||||
"mozfullscreenchange",
|
||||
this.fullscreenChangeBind
|
||||
);
|
||||
window.removeEventListener(
|
||||
"webkitfullscreenchange",
|
||||
this.fullscreenChangeBind
|
||||
|
Loading…
Reference in New Issue
Block a user