blob: 810c09b7e491706fddbf8349bc392c416d197937 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# we will handle media events
_frostMediaClick = (e) ->
###
# Commonality; check for valid target
###
element = e.target or e.srcElement
if !element.hasAttribute("data-sigil") or !element.getAttribute("data-sigil").toLowerCase().includes("inlinevideo")
return
console.log "Found inline video"
element = element.parentNode
if !element.hasAttribute("data-store")
return
dataStore = undefined
try
dataStore = JSON.parse(element.getAttribute("data-store"))
catch e
return
if !dataStore.src
return
console.log "Inline video #{dataStore.src}"
Frost?.loadVideo dataStore.src, dataStore.animatedGifVideo
e.stopPropagation()
e.preventDefault()
return
document.addEventListener "click", _frostMediaClick, true
|