aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/click_a.js
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-06 19:26:38 -0400
committerGitHub <noreply@github.com>2017-07-06 19:26:38 -0400
commitbb70ed737d98abbd6164b66ac5bd667553b312bd (patch)
tree1899d7adefe3fbf67e6fd26a4da0837898bd6d7a /app/src/main/assets/js/click_a.js
parent2586e947f769740dd8cb8bf8b1dd0473b51e50e4 (diff)
downloadfrost-bb70ed737d98abbd6164b66ac5bd667553b312bd.tar.gz
frost-bb70ed737d98abbd6164b66ac5bd667553b312bd.tar.bz2
frost-bb70ed737d98abbd6164b66ac5bd667553b312bd.zip
Dev 1.1.5 - JS fixes & sharing intents (#32)v1.1.5
* Add sharing intents * Fix up multiple js instances
Diffstat (limited to 'app/src/main/assets/js/click_a.js')
-rw-r--r--app/src/main/assets/js/click_a.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/app/src/main/assets/js/click_a.js b/app/src/main/assets/js/click_a.js
index a960c4f2..aabcd7e3 100644
--- a/app/src/main/assets/js/click_a.js
+++ b/app/src/main/assets/js/click_a.js
@@ -1,18 +1,22 @@
// we will handle click events
-console.log('Registering frost_a click');
+if (!window.hasOwnProperty('frost_click_a')) {
+ console.log('Registering frost_click_a');
+ window.frost_click_a = true;
-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();
+ 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');
+ if (url.includes('photoset_token')) return;
+ console.log('Click Intercept', url);
+ Frost.loadUrl(url);
+ e.stopPropagation();
+ e.preventDefault();
+ }
}
-}
-document.addEventListener('click', _frostAClick, true);
+ document.addEventListener('click', _frostAClick, true);
+}