Skip to content

Commit

Permalink
fix(ClipsModal): linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroSuero committed May 3, 2024
1 parent 9a316b0 commit 63960e7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/ClipsModal.astro
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@
const $clipContainer = $$(".clip-container")
const $clipDialog = $(".clip-dialog") as HTMLDialogElement
const $closeButton = $(".close-dialog")
const $ytFrame = $(".yt-iframe")
const ytFrameCopy = $ytFrame
let $ytFrame = $(".yt-iframe")
const ytFrameCopy = $ytFrame

if (!$clipDialog) return

$clipDialog.addEventListener("close", () => {
if ($ytFrame !== null) {
$ytFrame.setAttribute("src", "")
} else {
ytFrameCopy.setAttribute("src", "")
ytFrameCopy?.setAttribute("src", "")
}
})

Expand All @@ -81,7 +81,7 @@
if ($ytFrame !== null) {
$ytFrame.remove()
} else {
ytFrameCopy.remove()
ytFrameCopy?.remove()
}
})

Expand All @@ -95,12 +95,14 @@
const currentTarget = event.currentTarget as HTMLElement
const { url } = currentTarget.dataset
if (!url) return
$ytFrame = document.querySelector(".yt-iframe") as HTMLIFrameElement
$ytFrame = $(".yt-iframe") as HTMLIFrameElement
if ($ytFrame !== null) {
$ytFrame.setAttribute("src", `${url}&autoplay=1`)
} else {
$clipDialog?.querySelector("div")?.prepend(ytFrameCopy)
ytFrameCopy.setAttribute("src", `${url}&autoplay=1`)
if (ytFrameCopy) {
$clipDialog?.querySelector("div")?.prepend(ytFrameCopy)
ytFrameCopy.setAttribute("src", `${url}&autoplay=1`)
}
}
$clipDialog.showModal()
})
Expand Down

0 comments on commit 63960e7

Please sign in to comment.