aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/click_a.js
blob: a960c4f2b52af8ee1f52aa0e4159902d79d9a7c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// we will handle click events
console.log('Registering frost_a click');

var _frostAClick = function(e) {
  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;
  if (element.tagName === 'A' && element.getAttribute('href') !== '#') {
    var url = element.getAttribute('href');
    console.log('Click Intercept', url);
    Frost.loadUrl(url);
    e.stopPropagation();
    e.preventDefault();
  }
}

document.addEventListener('click', _frostAClick, true);