Patching system, video by id

This commit is contained in:
Pablo Ferreiro 2022-01-08 16:03:57 +01:00
parent 38fa75402b
commit c6b0f1e812
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
19 changed files with 305 additions and 60 deletions

View file

@ -21,10 +21,8 @@ const isModalActive = () => modal.classList.contains('is-active')
const toggleButton = (id, force) => document.getElementById(id) ? document.getElementById(id).toggleAttribute('disabled', force) : alert('That button does not exist')
// -- MODAL -- //
const swapData = ({ video_url, video_width, video_height, desc, video_download, music_title, music_url }) => {
const swapData = ({ video_url, desc, video_download, music_title, music_url }) => {
video.src = video_url
video.width = video_width
video.height = video_height
item_title.innerText = desc
download_button.href = video_download
audio_title.innerText = music_title

View file

@ -1,16 +1,24 @@
const goToUser = (e) => {
const goToUser = e => {
e.preventDefault()
const formData = new FormData(e.target)
const username = formData.get('username')
window.location.href = `./@${username}`
}
const goToTag = (e) => {
const goToTag = e => {
e.preventDefault()
const formData = new FormData(e.target)
const tag = formData.get('tag')
window.location.href = `./tag/${tag}`
}
const goToVideo = e => {
e.preventDefault()
const formData = new FormData(e.target)
const video_id = formData.get('video_id')
window.location.href = `./video/${video_id}`
}
document.getElementById('username_form').addEventListener('submit', goToUser, false)
document.getElementById('tag_form').addEventListener('submit', goToTag, false)
document.getElementById('video_form').addEventListener('submit', goToVideo, false)