2020-01-24 04:23:26 +13:00
|
|
|
export function makeid(length: number) {
|
|
|
|
let result = ''
|
|
|
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
|
|
const charactersLength = characters.length
|
2021-03-29 08:44:43 +13:00
|
|
|
for (let i = 0; i < length; i++) {
|
2020-01-24 04:23:26 +13:00
|
|
|
result += characters.charAt(Math.floor(Math.random() * charactersLength))
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|
2021-12-05 09:50:08 +13:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|