diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-16 12:21:12 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-16 12:21:12 -0700 |
commit | 87e7e132a060e235d434a9ef44ae0363d7ef660b (patch) | |
tree | ba78c3240c6e4c0bf4ad43692f8625bc7f964a75 /app/src/main/assets/js | |
parent | b9ea80d5b5a06d050ce2c7ca46ed597f4cb499ff (diff) | |
download | frost-87e7e132a060e235d434a9ef44ae0363d7ef660b.tar.gz frost-87e7e132a060e235d434a9ef44ae0363d7ef660b.tar.bz2 frost-87e7e132a060e235d434a9ef44ae0363d7ef660b.zip |
Add url formatter
Diffstat (limited to 'app/src/main/assets/js')
-rw-r--r-- | app/src/main/assets/js/menu_click.js | 4 | ||||
-rw-r--r-- | app/src/main/assets/js/menu_click.min.js | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/assets/js/menu_click.js b/app/src/main/assets/js/menu_click.js index 82041b0e..403689eb 100644 --- a/app/src/main/assets/js/menu_click.js +++ b/app/src/main/assets/js/menu_click.js @@ -1,11 +1,11 @@ // we will handle click events console.log('Registering menu click'); -document.addEventListener('click', function(e) { +document.addEventListener('click', function _menuClick(e) { var element = e.target || e.srcElement; if (element.tagName !== 'A') element = element.parentNode; if (element.tagName === 'A' && element.getAttribute('href') !== '#') { - var url = element.href; + var url = element.getAttribute('href'); console.log('Click Intercept'); console.log(url); Frost.loadUrl(url); diff --git a/app/src/main/assets/js/menu_click.min.js b/app/src/main/assets/js/menu_click.min.js index 4d508f71..60671265 100644 --- a/app/src/main/assets/js/menu_click.min.js +++ b/app/src/main/assets/js/menu_click.min.js @@ -1,8 +1,9 @@ console.log("Registering menu click"),document.addEventListener("click",function(e){ var t=e.target||e.srcElement ;if("A"!==t.tagName&&(t=t.parentNode),"A"===t.tagName&&"#"!==t.getAttribute("href")){ -var o=t.href -;console.log("Click Intercept"),console.log(o),Frost.loadUrl(o),e.stopPropagation(), +var o=t.getAttribute("href") +;console.log("Click Intercept"),console.log(o),Frost.loadUrl(o), +e.stopPropagation(), e.preventDefault() } },!0);
\ No newline at end of file |