aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/menu_click.js
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-16 00:53:10 -0700
committerAllan Wang <me@allanwang.ca>2017-06-16 00:53:10 -0700
commitb9ea80d5b5a06d050ce2c7ca46ed597f4cb499ff (patch)
tree95a8519b719a37dfb791bb6771c940a11e9f7e9e /app/src/main/assets/js/menu_click.js
parentf84a05f8aeb73ce63f77b7cc779845c31427b2b2 (diff)
downloadfrost-b9ea80d5b5a06d050ce2c7ca46ed597f4cb499ff.tar.gz
frost-b9ea80d5b5a06d050ce2c7ca46ed597f4cb499ff.tar.bz2
frost-b9ea80d5b5a06d050ce2c7ca46ed597f4cb499ff.zip
Add listener logic
Diffstat (limited to 'app/src/main/assets/js/menu_click.js')
-rw-r--r--app/src/main/assets/js/menu_click.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/src/main/assets/js/menu_click.js b/app/src/main/assets/js/menu_click.js
index 3e23617a..82041b0e 100644
--- a/app/src/main/assets/js/menu_click.js
+++ b/app/src/main/assets/js/menu_click.js
@@ -1,16 +1,15 @@
// we will handle click events
-document.onclick = function(e) {
- e = e || window.event;
+console.log('Registering menu click');
+document.addEventListener('click', function(e) {
var element = e.target || e.srcElement;
if (element.tagName !== 'A')
element = element.parentNode;
- if (element.tagName === 'A') {
+ if (element.tagName === 'A' && element.getAttribute('href') !== '#') {
var url = element.href;
console.log('Click Intercept');
console.log(url);
- if (url !== "https://m.facebook.com/settings" && url !== "https://m.facebook.com/settings#" && url !== "https://m.facebook.com/settings#!/settings?soft=bookmarks") {
- Frost.loadUrl(url);
- Frost.reloadBaseUrl(false); //reinject base view
- }
+ Frost.loadUrl(url);
+ e.stopPropagation();
+ e.preventDefault();
}
-};
+}, true);