diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-08 03:03:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-08 03:03:55 -0400 |
commit | b10a745c7f0f46f4f014e1ba7fa71172d7442b83 (patch) | |
tree | ef2516b69fb04ec0f565c5bb569fd5d80b7bd262 /app/src/main/assets/js/context_a.js | |
parent | 6adfc496374eb88919f70a240eb15a726d2c18e0 (diff) | |
download | frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.tar.gz frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.tar.bz2 frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.zip |
Dev-1.1.7 (#39) - feature overload + context menuv1.2
* Address some crashlytics issues
* Add text scaling
* Kau fixes and cleanup
* WIP formatter
* Create in house url formatter
* Update context menu
* Update themes
* Test proguard without R
* Implement sharing and clean up context menu
* Disable viewpager swipe on long press
* Test keeping lib strings
* Update changelog and proguard
Diffstat (limited to 'app/src/main/assets/js/context_a.js')
-rw-r--r-- | app/src/main/assets/js/context_a.js | 25 |
1 files changed, 20 insertions, 5 deletions
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); } |