
//全屏
function requestFullScreen(element?: any) {
    var de = document?.querySelector(element) || document?.documentElement;
    if (de?.requestFullscreen) {
        de?.requestFullscreen();
    } else if (de.mozRequestFullScreen) {
        de?.mozRequestFullScreen();
    } else if (de?.webkitRequestFullScreen) {
        de?.webkitRequestFullScreen();
    }
}
//退出全屏
function exitFullScreen(element?: any) {

    if (document?.exitFullscreen) {
        document?.exitFullscreen();
    } else if (document?.mozCancelFullScreen) {
        document?.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
        document?.webkitExitFullscreen();
    } else if (document.msExitFullscreen) {
        document?.msExitFullscreen();
    }
}
//判断是否全屏
function isFull() {
    if (document?.fullscreenElement || document?.webkitFullscreenElement || document?.mozFullScreenElement || document?.msFullscreenElement) {
        return true
    }
    return false
}

function quanpin(el: any) {
    if (document?.fullscreenElement || document?.webkitFullscreenElement || document?.mozFullScreenElement || document?.msFullscreenElement) {
        exitFullScreen()
        localStorage.setItem('isFell','0')
    } else {
        if (el?.requestFullscreen) {
            el?.requestFullscreen();
        } else if (el?.mozRequestFullScreen) {
            el?.mozRequestFullScreen();
        } else if (el?.webkitRequestFullScreen) {
            el?.webkitRequestFullScreen();
        }
       
        localStorage.setItem('isFell','1')
    }
}
export { requestFullScreen, exitFullScreen, isFull, quanpin }