mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-20 23:42:05 +00:00
chore: types
This commit is contained in:
parent
fcb4af670c
commit
a506a06688
5 changed files with 29 additions and 11 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "4.4.13",
|
||||
"version": "4.4.14",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||
"main": "build/main.js",
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@
|
|||
$: checkAvail(current)
|
||||
let hasNext = false
|
||||
let hasLast = false
|
||||
function checkAvail () {
|
||||
function checkAvail (current) {
|
||||
if ((media?.media?.nextAiringEpisode?.episode - 1 || media?.media?.episodes) > media?.episode) {
|
||||
hasNext = true
|
||||
} else if (videos.indexOf(current) !== videos.length - 1) {
|
||||
|
|
@ -339,9 +339,10 @@
|
|||
}
|
||||
}
|
||||
function updatePiPState (paused) {
|
||||
if (!document.pictureInPictureElement || document.pictureInPictureElement.id) return
|
||||
if (paused) document.pictureInPictureElement.pause()
|
||||
else document.pictureInPictureElement.play()
|
||||
const element = /** @type {HTMLVideoElement | undefined} */ (document.pictureInPictureElement)
|
||||
if (!element || element.id) return
|
||||
if (paused) element.pause()
|
||||
else element.play()
|
||||
}
|
||||
$: updatePiPState(paused)
|
||||
function togglePopout () {
|
||||
|
|
@ -647,7 +648,7 @@
|
|||
function getBufferHealth (time) {
|
||||
for (let index = video.buffered.length; index--;) {
|
||||
if (time < video.buffered.end(index) && time >= video.buffered.start(index)) {
|
||||
return parseInt(video.buffered.end(index) - time)
|
||||
return (video.buffered.end(index) - time) | 0
|
||||
}
|
||||
}
|
||||
return 0
|
||||
|
|
@ -681,7 +682,7 @@
|
|||
]
|
||||
function isChapterSkippable (chapter) {
|
||||
for (const [name, regex] of skippableChaptersRx) {
|
||||
if (regex.test(chapter.text)) {
|
||||
if (/** @type {RegExp} */ (regex).test(chapter.text)) {
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
update()
|
||||
}
|
||||
function getStatusText () {
|
||||
function getStatusText (media) {
|
||||
if (media.mediaListEntry) {
|
||||
const { status } = media.mediaListEntry
|
||||
if (status === 'PLANNING') return 'Remove From List'
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
}
|
||||
return 'Play'
|
||||
}
|
||||
async function play () {
|
||||
async function play (media) {
|
||||
let ep = 1
|
||||
if (media.mediaListEntry) {
|
||||
const { status, progress } = media.mediaListEntry
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
src={'https://www.youtube.com/embed/' + $url}
|
||||
frameborder='0'
|
||||
title='trailer'
|
||||
allowfullscreen='allowfullscreen'
|
||||
allowfullscreen
|
||||
class='w-full h-full position-absolute rounded top-0 left-0' />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
19
types.d.ts
vendored
19
types.d.ts
vendored
|
|
@ -1,9 +1,22 @@
|
|||
export {}
|
||||
|
||||
type Track = {
|
||||
selected: boolean
|
||||
enabled: boolean
|
||||
id: string
|
||||
kind: string
|
||||
label: string
|
||||
language: string
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
IPC: any;
|
||||
IPC: any
|
||||
port: MessagePort
|
||||
version: {
|
||||
platform: string
|
||||
arch: string
|
||||
}
|
||||
}
|
||||
interface EventTarget {
|
||||
on: (type: string, callback: (any) => void, options?: boolean | {}) => void
|
||||
|
|
@ -13,4 +26,8 @@ declare global {
|
|||
removeListener: (type: string, callback: (any) => void) => void
|
||||
off: (type: string, callback: (any) => void) => void
|
||||
}
|
||||
interface HTMLMediaElement {
|
||||
videoTracks: Track[]
|
||||
audioTracks: Track[]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue