mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 14:16:22 +00:00
11 lines
368 B
JavaScript
11 lines
368 B
JavaScript
document.addEventListener('turbolinks:load', () => {
|
|
document.querySelectorAll('input[type=file]').forEach(file => {
|
|
if (!file.dataset.preview) return
|
|
|
|
file.addEventListener('change', event => {
|
|
if (file.files.length === 0) return
|
|
|
|
document.querySelector('#' + file.dataset.preview).src = window.URL.createObjectURL(file.files[0])
|
|
})
|
|
})
|
|
})
|