Fixed fullscreen for shit browsers

This commit is contained in:
Eduard Urbach 2018-12-08 06:35:42 +09:00
parent 24069ba1c9
commit 24e4906559

View File

@ -28,10 +28,12 @@ function togglePlayVideo(video: HTMLVideoElement) {
export function toggleFullscreen(arn: AnimeNotifier, button: HTMLElement) {
let elementId = button.dataset.id
let element = document.getElementById(elementId)
let requestFullscreen = element.requestFullscreen || element["mozRequestFullScreen"] || element["webkitRequestFullScreen"] || element["msRequestFullscreen"]
let exitFullscreen = document.exitFullscreen || document["mozCancelFullScreen"] || document["webkitExitFullscreen"] || document["msExitFullscreen"]
if(document.fullscreen) {
document.exitFullscreen()
exitFullscreen.call(document)
} else {
element.requestFullscreen()
requestFullscreen.call(element)
}
}