
//全屏
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 as any)?.mozCancelFullScreen) {
        (document as any)?.mozCancelFullScreen();
    } else if ((document as any)?.webkitExitFullscreen) {
        (document as any)?.webkitExitFullscreen();
    } else if ((document as any)?.msExitFullscreen) {
        (document as any)?.msExitFullscreen();
    }
}
//判断是否全屏
function isFull() {
    if (document?.fullscreenElement || (document as any)?.webkitFullscreenElement || (document as any)?.mozFullScreenElement || (document as any)?.msFullscreenElement) {
        return true
    }
    return false
}

function quanpin(el: any) {
    if (document?.fullscreenElement || (document as any)?.webkitFullscreenElement || (document as any)?.mozFullScreenElement || (document as any)?.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 }