- Added util.js

- Fixed modal showing on addTorrent call
This commit is contained in:
Dennis Rönn 2020-09-15 21:14:02 +02:00
parent b0537d74c2
commit edd306be1b
3 changed files with 11 additions and 1 deletions

View file

@ -222,6 +222,7 @@
</div>
</div>
<script src="https://cdn.jsdelivr.net/gh/halfmoonui/halfmoon@1.0.4/js/halfmoon.min.js"></script>
<script src="util.js"></script>
<script src="animeHandler.js"></script>
<script src="playerHandler.js"></script>
<script src="https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js" defer></script>

View file

@ -52,7 +52,7 @@ function addTorrent(magnet) {
if (client.torrents.length >= maxTorrents) {
client.remove(client.torrents[0].infoHash)
}
halfmoon.toggleModal("tsearch")
halfmoon.hideModal("tsearch")
document.location.href = "#player"
client.add(magnet, async function (torrent) {
video.src = ""

9
app/util.js Normal file
View file

@ -0,0 +1,9 @@
halfmoon.showModal = id => {
const t = document.getElementById(id)
t && t.classList.add("show")
}
halfmoon.hideModal = id => {
const t = document.getElementById(id)
t && t.classList.remove("show")
}