aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/assets/js')
-rw-r--r--app/src/main/assets/js/click-debugger.js13
-rw-r--r--app/src/main/assets/js/click-debugger.min.js6
-rw-r--r--app/src/main/assets/js/click_a.js6
-rw-r--r--app/src/main/assets/js/click_a.min.js12
-rw-r--r--app/src/main/assets/js/media.js31
-rw-r--r--app/src/main/assets/js/media.min.js21
6 files changed, 83 insertions, 6 deletions
diff --git a/app/src/main/assets/js/click-debugger.js b/app/src/main/assets/js/click-debugger.js
new file mode 100644
index 00000000..702a62c9
--- /dev/null
+++ b/app/src/main/assets/js/click-debugger.js
@@ -0,0 +1,13 @@
+//for desktop only
+var _frostAContext = function(e) {
+ /*
+ * Commonality; check for valid target
+ */
+ var element = e.target || e.currentTarget || e.srcElement;
+ if (!element) return;
+ console.log("Clicked element:");
+ console.log(element.tagName);
+ console.log(element.className);
+}
+
+document.addEventListener('contextmenu', _frostAContext, true);
diff --git a/app/src/main/assets/js/click-debugger.min.js b/app/src/main/assets/js/click-debugger.min.js
new file mode 100644
index 00000000..0f986b07
--- /dev/null
+++ b/app/src/main/assets/js/click-debugger.min.js
@@ -0,0 +1,6 @@
+var _frostAContext=function(e){
+var t=e.target||e.currentTarget||e.srcElement
+;t&&(console.log("Clicked element:"),
+console.log(t.tagName),console.log(t.className))
+}
+;document.addEventListener("contextmenu",_frostAContext,!0); \ No newline at end of file
diff --git a/app/src/main/assets/js/click_a.js b/app/src/main/assets/js/click_a.js
index 24a08f56..2f5d759f 100644
--- a/app/src/main/assets/js/click_a.js
+++ b/app/src/main/assets/js/click_a.js
@@ -12,6 +12,7 @@ if (!window.hasOwnProperty('frost_click_a')) {
* Commonality; check for valid target
*/
var element = e.target || e.srcElement;
+
if (element.tagName !== 'A') element = element.parentNode;
//Notifications is two layers under
if (element.tagName !== 'A') element = element.parentNode;
@@ -41,11 +42,14 @@ if (!window.hasOwnProperty('frost_click_a')) {
document.addEventListener('click', _frostAClick, true);
+ var clickTimeout;
+
document.addEventListener('touchstart', function _frostStart(e) {
- setTimeout(_frostPreventClick, 400);
+ clickTimeout = setTimeout(_frostPreventClick, 400);
}, true);
document.addEventListener('touchend', function _frostEnd(e) {
prevented = false;
+ clearTimeout(clickTimeout);
}, true);
}
diff --git a/app/src/main/assets/js/click_a.min.js b/app/src/main/assets/js/click_a.min.js
index 2033fd31..a0df6912 100644
--- a/app/src/main/assets/js/click_a.min.js
+++ b/app/src/main/assets/js/click_a.min.js
@@ -5,16 +5,18 @@ window.frost_click_a=!0
var t=e.target||e.srcElement
;if("A"!==t.tagName&&(t=t.parentNode),"A"!==t.tagName&&(t=t.parentNode),
"A"===t.tagName&&!prevented){
-var n=t.getAttribute("href")
-;console.log("Click Intercept",n),"undefined"!=typeof Frost&&Frost.loadUrl(n)&&(e.stopPropagation(),
+var o=t.getAttribute("href")
+;console.log("Click Intercept",o),"undefined"!=typeof Frost&&Frost.loadUrl(o)&&(e.stopPropagation(),
e.preventDefault())
}
},_frostPreventClick=function(){
console.log("Click prevented"),prevented=!0
}
-;document.addEventListener("click",_frostAClick,!0),document.addEventListener("touchstart",function(e){
-setTimeout(_frostPreventClick,400)
+;document.addEventListener("click",_frostAClick,!0)
+;var clickTimeout
+;document.addEventListener("touchstart",function(e){
+clickTimeout=setTimeout(_frostPreventClick,400)
},!0),document.addEventListener("touchend",function(e){
-prevented=!1
+prevented=!1,clearTimeout(clickTimeout)
},!0)
} \ No newline at end of file
diff --git a/app/src/main/assets/js/media.js b/app/src/main/assets/js/media.js
new file mode 100644
index 00000000..852a1e8c
--- /dev/null
+++ b/app/src/main/assets/js/media.js
@@ -0,0 +1,31 @@
+// we will media events
+if (!window.hasOwnProperty('frost_media')) {
+ console.log('Registering frost_media');
+ window.frost_media = true;
+
+ var _frostMediaClick = function(e) {
+
+ /*
+ * Commonality; check for valid target
+ */
+ var element = e.target || e.srcElement;
+ if (!element.hasAttribute("data-sigil") || !element.getAttribute("data-sigil").includes("playInlineVideo")) return;
+ console.log("Found inline video");
+ element = element.parentNode;
+ if (!element.hasAttribute("data-store")) return;
+ var dataStore;
+ try {
+ dataStore = JSON.parse(element.getAttribute("data-store"));
+ } catch (e) {
+ return;
+ }
+ if (!dataStore.src) return;
+ console.log("Inline video", dataStore.src);
+ if (typeof Frost !== 'undefined') Frost.loadVideo(dataStore.src);
+ e.stopPropagation();
+ e.preventDefault();
+ return;
+ }
+
+ document.addEventListener('click', _frostMediaClick, true);
+}
diff --git a/app/src/main/assets/js/media.min.js b/app/src/main/assets/js/media.min.js
new file mode 100644
index 00000000..c965f515
--- /dev/null
+++ b/app/src/main/assets/js/media.min.js
@@ -0,0 +1,21 @@
+if(!window.hasOwnProperty("frost_media")){
+console.log("Registering frost_media"),
+window.frost_media=!0
+;var _frostMediaClick=function(t){
+var e=t.target||t.srcElement
+;if(e.hasAttribute("data-sigil")&&e.getAttribute("data-sigil").includes("playInlineVideo")&&(console.log("Found inline video"),
+e=e.parentNode,
+e.hasAttribute("data-store"))){
+var i
+;try{
+i=JSON.parse(e.getAttribute("data-store"))
+}catch(t){
+return
+}
+i.src&&(console.log("Inline video",i.src),"undefined"!=typeof Frost&&Frost.loadVideo(i.src),
+t.stopPropagation(),
+t.preventDefault())
+}
+}
+;document.addEventListener("click",_frostMediaClick,!0)
+} \ No newline at end of file