aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/media.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/assets/js/media.js')
-rw-r--r--app/src/main/assets/js/media.js41
1 files changed, 25 insertions, 16 deletions
diff --git a/app/src/main/assets/js/media.js b/app/src/main/assets/js/media.js
index f1a5ac3c..5ec7f472 100644
--- a/app/src/main/assets/js/media.js
+++ b/app/src/main/assets/js/media.js
@@ -1,31 +1,40 @@
-// we will media events
-if (!window.hasOwnProperty('frost_media')) {
- console.log('Registering frost_media');
- window.frost_media = true;
+"use strict";
- var _frostMediaClick = function(e) {
+(function () {
+ // we will handle media events
+ var _frostMediaClick;
+ _frostMediaClick = function _frostMediaClick(e) {
/*
* Commonality; check for valid target
*/
- var element = e.target || e.srcElement;
- if (!element.hasAttribute("data-sigil") || !element.getAttribute("data-sigil").toLowerCase().includes("inlinevideo")) return;
+ var dataStore, element;
+ element = e.target || e.srcElement;
+ if (!element.hasAttribute("data-sigil") || !element.getAttribute("data-sigil").toLowerCase().includes("inlinevideo")) {
+ return;
+ }
console.log("Found inline video");
element = element.parentNode;
- if (!element.hasAttribute("data-store")) return;
- var dataStore;
+ if (!element.hasAttribute("data-store")) {
+ return;
+ }
+ dataStore = void 0;
try {
dataStore = JSON.parse(element.getAttribute("data-store"));
- } catch (e) {
+ } catch (error) {
+ e = error;
+ return;
+ }
+ if (!dataStore.src) {
return;
}
- if (!dataStore.src) return;
console.log("Inline video " + dataStore.src);
- if (typeof Frost !== 'undefined') Frost.loadVideo(dataStore.src, dataStore.animatedGifVideo);
+ if (typeof Frost !== "undefined" && Frost !== null) {
+ Frost.loadVideo(dataStore.src, dataStore.animatedGifVideo);
+ }
e.stopPropagation();
e.preventDefault();
- return;
- }
+ };
- document.addEventListener('click', _frostMediaClick, true);
-}
+ document.addEventListener("click", _frostMediaClick, true);
+}).call(undefined); \ No newline at end of file