some stupid turnary operator cleanup

This commit is contained in:
ThaUnknown 2020-12-19 23:27:21 +01:00
parent d17d75e052
commit ad04397f84
3 changed files with 7 additions and 7 deletions

View file

@ -415,7 +415,7 @@ function btnnext() {
}
function autoNext() {
updateBar(video.currentTime / video.duration * 100)
settings.player6 ? btnnext() : ""
if (settings.player6) btnnext()
}
// volume shit

View file

@ -48,7 +48,7 @@ function subStream(stream) { // subtitle parsing with seeking support
}
})
playerData.subtitleStream.on('file', file => {
file.mimetype == ("application/x-truetype-font" || "application/font-woff") ? playerData.fonts.push(window.URL.createObjectURL(new Blob([file.data], { type: file.mimetype }))) : ""
if (file.mimetype == ("application/x-truetype-font" || "application/font-woff")) playerData.fonts.push(window.URL.createObjectURL(new Blob([file.data], { type: file.mimetype })))
})
stream.pipe(playerData.subtitleStream)
}
@ -105,7 +105,7 @@ function postDownload(file) { // parse subtitles fully after a download is finis
playState = !video.paused
video.src = url
video.currentTime = time
playState ? video.play() : ""
if (playState) video.play()
}, 5000);
})
}

View file

@ -6,9 +6,9 @@ let client = new WebTorrent({ maxConns: settings.torrent6 }),
}
window.onbeforeunload = () => { //cleanup shit before unloading to free RAM/drive
if (!settings.torrent8) {
client.torrents[0] ? client.torrents[0].store.destroy() : ""
if (client.torrents[0]) client.torrents[0].store.destroy()
}
client.torrents[0] ? client.torrents[0].destroy() : ""
if (client.torrents[0]) client.torrents[0].destroy()
client.destroy()
cleanupVideo()
if (playerData.fonts) {
@ -77,7 +77,7 @@ async function addTorrent(magnet, media, episode) {
if (settings.torrent8 && settings.torrent5) {
client.remove(client.torrents[0].infoHash)
} else {
client.torrents[0].store ? client.torrents[0].store.destroy() : ""
if (client.torrents[0].store) client.torrents[0].store.destroy()
client.torrents[0].destroy()
}
}
@ -117,7 +117,7 @@ async function addTorrent(magnet, media, episode) {
alertType: "alert-danger",
fillType: ""
});
client.torrents[0].store ? client.torrents[0].store.destroy() : ""
if (client.torrents[0].store) client.torrents[0].store.destroy()
client.torrents[0].destroy()
}