Multifile support in WEBM Metadata. #2171

This commit is contained in:
ccd0 2019-07-15 21:48:04 -07:00
parent 976342c4c6
commit 5ddee89c74

View File

@ -7,21 +7,24 @@ Metadata =
cb: @node cb: @node
node: -> node: ->
return unless @file and /webm$/i.test @file.url for file, i in @files when /webm$/i.test file.url
if @isClone if @isClone
el = $ '.webm-title', @file.text el = $ '.webm-title', file.text
else else
el = $.el 'span', el = $.el 'span',
className: 'webm-title' className: 'webm-title'
$.extend el, el.dataset.index = i
<%= html('<a href="javascript:;"></a>') %> $.extend el,
$.add @file.text, [$.tn(' '), el] <%= html('<a href="javascript:;"></a>') %>
$.one el.lastElementChild, 'mouseover focus', Metadata.load if el.children.length is 1 $.add file.text, [$.tn(' '), el]
$.one el.lastElementChild, 'mouseover focus', Metadata.load if el.children.length is 1
return
load: -> load: ->
$.rmClass @parentNode, 'error' $.rmClass @parentNode, 'error'
$.addClass @parentNode, 'loading' $.addClass @parentNode, 'loading'
CrossOrigin.binary Get.postFromNode(@).file.url, (data) => {index} = @parentNode.dataset
CrossOrigin.binary Get.postFromNode(@).files[index].url, (data) =>
$.rmClass @parentNode, 'loading' $.rmClass @parentNode, 'loading'
if data? if data?
title = Metadata.parse data title = Metadata.parse data