Add link to FAQ section in 'Could not open file.' error.
This commit is contained in:
parent
39eccf1457
commit
193eaba1b2
@ -355,12 +355,17 @@ QR =
|
|||||||
return unless file and /^(image|video)\//.test(file.type)
|
return unless file and /^(image|video)\//.test(file.type)
|
||||||
isVideo = /^video\//.test file
|
isVideo = /^video\//.test file
|
||||||
el = $.el (if isVideo then 'video' else 'img')
|
el = $.el (if isVideo then 'video' else 'img')
|
||||||
$.on el, 'error', -> QR.error 'Could not open file.'
|
$.on el, 'error', -> QR.openError()
|
||||||
$.on el, (if isVideo then 'loadeddata' else 'load'), ->
|
$.on el, (if isVideo then 'loadeddata' else 'load'), ->
|
||||||
e.target.getContext('2d').drawImage el, 0, 0
|
e.target.getContext('2d').drawImage el, 0, 0
|
||||||
URL.revokeObjectURL el.src
|
URL.revokeObjectURL el.src
|
||||||
el.src = URL.createObjectURL file
|
el.src = URL.createObjectURL file
|
||||||
|
|
||||||
|
openError: ->
|
||||||
|
div = $.el 'div'
|
||||||
|
$.extend div, <%= html('Could not open file. [<a href="' + meta.faq + '#error-reading-metadata" target="_blank">More info</a>]') %>
|
||||||
|
QR.error div
|
||||||
|
|
||||||
setFile: (e) ->
|
setFile: (e) ->
|
||||||
{file, name, source} = e.detail
|
{file, name, source} = e.detail
|
||||||
file.name = name if name?
|
file.name = name if name?
|
||||||
|
|||||||
@ -38,6 +38,7 @@ QR.oekaki =
|
|||||||
QR.handleFiles [snapshot]
|
QR.handleFiles [snapshot]
|
||||||
QR.oekaki.edit()
|
QR.oekaki.edit()
|
||||||
video.currentTime = currentTime
|
video.currentTime = currentTime
|
||||||
|
$.on video, 'error', -> QR.openError()
|
||||||
video.src = URL.createObjectURL blob
|
video.src = URL.createObjectURL blob
|
||||||
else
|
else
|
||||||
blob.name = post.file.name
|
blob.name = post.file.name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user