mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
move elementRequestFullscreen to utils.
This commit is contained in:
parent
7d2c3526b2
commit
da200698dd
@ -186,6 +186,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Ref, Watch, Vue, Prop } from 'vue-property-decorator'
|
import { Component, Ref, Watch, Vue, Prop } from 'vue-property-decorator'
|
||||||
import ResizeObserver from 'resize-observer-polyfill'
|
import ResizeObserver from 'resize-observer-polyfill'
|
||||||
|
import { elementRequestFullscreen } from '~/utils'
|
||||||
|
|
||||||
import Emote from './emote.vue'
|
import Emote from './emote.vue'
|
||||||
import Resolution from './resolution.vue'
|
import Resolution from './resolution.vue'
|
||||||
@ -555,37 +556,15 @@
|
|||||||
this.$accessor.remote.request()
|
this.$accessor.remote.request()
|
||||||
}
|
}
|
||||||
|
|
||||||
_elementRequestFullscreen(el: HTMLElement) {
|
|
||||||
if (typeof el.requestFullscreen === 'function') {
|
|
||||||
el.requestFullscreen()
|
|
||||||
//@ts-ignore
|
|
||||||
} else if (typeof el.webkitRequestFullscreen === 'function') {
|
|
||||||
//@ts-ignore
|
|
||||||
el.webkitRequestFullscreen()
|
|
||||||
//@ts-ignore
|
|
||||||
} else if (typeof el.webkitEnterFullscreen === 'function') {
|
|
||||||
//@ts-ignore
|
|
||||||
el.webkitEnterFullscreen()
|
|
||||||
//@ts-ignore
|
|
||||||
} else if (typeof el.msRequestFullScreen === 'function') {
|
|
||||||
//@ts-ignore
|
|
||||||
el.msRequestFullScreen()
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
requestFullscreen() {
|
requestFullscreen() {
|
||||||
// try to fullscreen player element
|
// try to fullscreen player element
|
||||||
if (this._elementRequestFullscreen(this._player)) {
|
if (elementRequestFullscreen(this._player)) {
|
||||||
this.onResize()
|
this.onResize()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback to fullscreen video itself (on mobile devices)
|
// fallback to fullscreen video itself (on mobile devices)
|
||||||
if (this._elementRequestFullscreen(this._video)) {
|
if (elementRequestFullscreen(this._video)) {
|
||||||
this.onResize()
|
this.onResize()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -7,3 +7,24 @@ export function makeid(length: number) {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function elementRequestFullscreen(el: HTMLElement) {
|
||||||
|
if (typeof el.requestFullscreen === 'function') {
|
||||||
|
el.requestFullscreen()
|
||||||
|
//@ts-ignore
|
||||||
|
} else if (typeof el.webkitRequestFullscreen === 'function') {
|
||||||
|
//@ts-ignore
|
||||||
|
el.webkitRequestFullscreen()
|
||||||
|
//@ts-ignore
|
||||||
|
} else if (typeof el.webkitEnterFullscreen === 'function') {
|
||||||
|
//@ts-ignore
|
||||||
|
el.webkitEnterFullscreen()
|
||||||
|
//@ts-ignore
|
||||||
|
} else if (typeof el.msRequestFullScreen === 'function') {
|
||||||
|
//@ts-ignore
|
||||||
|
el.msRequestFullScreen()
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user