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_a.js4
-rw-r--r--app/src/main/assets/js/click_a.min.js2
-rw-r--r--app/src/main/assets/js/context_a.js25
-rw-r--r--app/src/main/assets/js/context_a.min.js17
4 files changed, 33 insertions, 15 deletions
diff --git a/app/src/main/assets/js/click_a.js b/app/src/main/assets/js/click_a.js
index 27b09a7e..81b12fd7 100644
--- a/app/src/main/assets/js/click_a.js
+++ b/app/src/main/assets/js/click_a.js
@@ -20,8 +20,6 @@ if (!window.hasOwnProperty('frost_click_a')) {
if (url.includes('photoset_token')) return;
-
-
if (!prevented) {
console.log('Click Intercept', url);
Frost.loadUrl(url);
@@ -45,7 +43,7 @@ if (!window.hasOwnProperty('frost_click_a')) {
document.addEventListener('click', _frostAClick, true);
document.addEventListener('touchstart', function _frostStart(e) {
- setTimeout(_frostPreventClick, 500);
+ setTimeout(_frostPreventClick, 400);
}, true);
document.addEventListener('touchend', function _frostEnd(e) {
diff --git a/app/src/main/assets/js/click_a.min.js b/app/src/main/assets/js/click_a.min.js
index 9f955705..059c1183 100644
--- a/app/src/main/assets/js/click_a.min.js
+++ b/app/src/main/assets/js/click_a.min.js
@@ -15,7 +15,7 @@ e.preventDefault()
console.log("Click prevented"),prevented=!0
}
;document.addEventListener("click",_frostAClick,!0),document.addEventListener("touchstart",function(e){
-setTimeout(_frostPreventClick,500)
+setTimeout(_frostPreventClick,400)
},!0),document.addEventListener("touchend",function(e){
prevented=!1
},!0)
diff --git a/app/src/main/assets/js/context_a.js b/app/src/main/assets/js/context_a.js
index 5e09ffcd..395dfca1 100644
--- a/app/src/main/assets/js/context_a.js
+++ b/app/src/main/assets/js/context_a.js
@@ -1,31 +1,46 @@
//context menu for links
//largely mimics click_a.js
+//we will also bind a listener here to notify the activity not to deal with viewpager scrolls
+//since the long press is also associated witho
if (!window.hasOwnProperty('frost_context_a')) {
console.log('frost_context_a frost_click_a');
window.frost_context_a = true;
- var _frostAContext = function(e) {
+ var longClick = false;
+ var _frostAContext = function(e) {
+ Frost.longClick(true);
+ longClick = true;
/*
* Commonality; check for valid target
*/
- var element = e.target || e.srcElement;
+ var element = e.target || e.currentTarget || e.srcElement;
+ if (!element) return;
if (element.tagName !== 'A') element = element.parentNode;
//Notifications is two layers under
if (element.tagName !== 'A') element = element.parentNode;
if (element.tagName === 'A' && element.getAttribute('href') !== '#') {
var url = element.getAttribute('href');
+ if (!url) return;
if (url.includes('photoset_token')) return;
+ var text = element.parentNode.innerText;
-
- console.log('Context Intercept', url);
- Frost.contextMenu(url);
+ // console.log('Context Intercept', element.tagName, element.id, element.className)
+ console.log('Context Content', url, text);
+ Frost.contextMenu(url, text);
e.stopPropagation();
e.preventDefault();
}
}
document.addEventListener('contextmenu', _frostAContext, true);
+
+ document.addEventListener('touchend', function _frostEnd(e) {
+ if (longClick) {
+ Frost.longClick(false);
+ longClick = false;
+ }
+ }, true);
}
diff --git a/app/src/main/assets/js/context_a.min.js b/app/src/main/assets/js/context_a.min.js
index dc68cb3b..82f89e8b 100644
--- a/app/src/main/assets/js/context_a.min.js
+++ b/app/src/main/assets/js/context_a.min.js
@@ -1,15 +1,20 @@
if(!window.hasOwnProperty("frost_context_a")){
console.log("frost_context_a frost_click_a"),
window.frost_context_a=!0
-;var _frostAContext=function(t){
-var e=t.target||t.srcElement
-;if("A"!==e.tagName&&(e=e.parentNode),"A"!==e.tagName&&(e=e.parentNode),
-"A"===e.tagName&&"#"!==e.getAttribute("href")){
+;var longClick=!1,_frostAContext=function(t){
+Frost.longClick(!0),longClick=!0
+;var e=t.target||t.currentTarget||t.srcElement
+;if(e&&("A"!==e.tagName&&(e=e.parentNode),
+"A"!==e.tagName&&(e=e.parentNode),"A"===e.tagName&&"#"!==e.getAttribute("href"))){
var o=e.getAttribute("href")
;if(o.includes("photoset_token"))return
-;console.log("Context Intercept",o),Frost.contextMenu(o),
+;var n=e.parentNode.innerText
+;console.log("Context Content",o,n),Frost.contextMenu(o,n),
t.stopPropagation(),t.preventDefault()
}
}
-;document.addEventListener("contextmenu",_frostAContext,!0)
+;document.addEventListener("contextmenu",_frostAContext,!0),document.addEventListener("touchend",function(t){
+longClick&&(Frost.longClick(!1),
+longClick=!1)
+},!0)
} \ No newline at end of file