proxitok/scripts/home.js

33 lines
1 KiB
JavaScript
Raw Normal View History

2022-01-08 10:03:57 -05:00
const goToUser = e => {
e.preventDefault()
const formData = new FormData(e.target)
const username = formData.get('username')
window.location.href = `./@${username}`
}
2022-01-08 10:03:57 -05:00
const goToTag = e => {
e.preventDefault()
const formData = new FormData(e.target)
const tag = formData.get('tag')
window.location.href = `./tag/${tag}`
}
2022-01-08 10:03:57 -05:00
const goToVideo = e => {
e.preventDefault()
const formData = new FormData(e.target)
const video_id = formData.get('video_id')
window.location.href = `./video/${video_id}`
}
2022-01-17 15:11:40 -05:00
const goToMusic = e => {
e.preventDefault()
const formData = new FormData(e.target)
const video_id = formData.get('music_id')
window.location.href = `./music/${video_id}`
}
document.getElementById('username_form').addEventListener('submit', goToUser, false)
document.getElementById('tag_form').addEventListener('submit', goToTag, false)
2022-01-08 10:03:57 -05:00
document.getElementById('video_form').addEventListener('submit', goToVideo, false)
2022-01-17 15:11:40 -05:00
document.getElementById('music_form').addEventListener('submit', goToMusic, false)