aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/media.coffee
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-12-10 14:25:29 -0500
committerGitHub <noreply@github.com>2017-12-10 14:25:29 -0500
commit1d4380cee77fc049a54d280a27dcefa3fa6ff1fd (patch)
tree6aa222b3f88862a46c8ffd0e46bfb94755d54729 /app/src/main/assets/js/media.coffee
parent30eb51a44a271512e27c97aecc02f3a339f572bf (diff)
downloadfrost-1d4380cee77fc049a54d280a27dcefa3fa6ff1fd.tar.gz
frost-1d4380cee77fc049a54d280a27dcefa3fa6ff1fd.tar.bz2
frost-1d4380cee77fc049a54d280a27dcefa3fa6ff1fd.zip
theme (#546)
* Update to coffee and use webstorm * Add chrome as well * Update all * Reinstall android 27
Diffstat (limited to 'app/src/main/assets/js/media.coffee')
-rw-r--r--app/src/main/assets/js/media.coffee29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/src/main/assets/js/media.coffee b/app/src/main/assets/js/media.coffee
new file mode 100644
index 00000000..810c09b7
--- /dev/null
+++ b/app/src/main/assets/js/media.coffee
@@ -0,0 +1,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
+