27 lines
712 B
JavaScript
Vendored
27 lines
712 B
JavaScript
Vendored
$('.select-media').on('click', e => {
|
|
e.preventDefault()
|
|
let $this = $(e.currentTarget),
|
|
$input = $this.siblings('input'),
|
|
$preview = $this.siblings('.preview'),
|
|
$clearButton = $this.siblings('.clear-media')
|
|
|
|
app.methods.media(true, $input.get(0), true, (data) => {
|
|
let media = data.medias[0]
|
|
$preview.empty().append(
|
|
$('<img>').attr('src', media.url)
|
|
)
|
|
$clearButton.show()
|
|
})
|
|
})
|
|
|
|
$('.clear-media').on('click', e => {
|
|
e.preventDefault()
|
|
let $this = $(e.currentTarget),
|
|
$input = $this.siblings('input'),
|
|
$preview = $this.siblings('.preview')
|
|
|
|
$input.val(null)
|
|
$preview.empty()
|
|
$this.hide()
|
|
})
|