aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-15 19:53:57 -0700
committerGitHub <noreply@github.com>2017-08-15 19:53:57 -0700
commit2eaad9b72746d57c187d2ded7f40d803f88dfcee (patch)
treebab40fa1cd7e9fd4bba8fd59b562207010fc58ba /app/src/main/assets/js
parent19ec9b543e15fe453b576f1b38994b3f8692054f (diff)
downloadfrost-2eaad9b72746d57c187d2ded7f40d803f88dfcee.tar.gz
frost-2eaad9b72746d57c187d2ded7f40d803f88dfcee.tar.bz2
frost-2eaad9b72746d57c187d2ded7f40d803f88dfcee.zip
Enhancement/url redirect manager (#182)
* Initial blacklist * Move js checks to java * Optimize imports and clean up request interceptor
Diffstat (limited to 'app/src/main/assets/js')
-rw-r--r--app/src/main/assets/js/click_a.js15
-rw-r--r--app/src/main/assets/js/click_a.min.js8
2 files changed, 10 insertions, 13 deletions
diff --git a/app/src/main/assets/js/click_a.js b/app/src/main/assets/js/click_a.js
index 9f4ddc38..24a08f56 100644
--- a/app/src/main/assets/js/click_a.js
+++ b/app/src/main/assets/js/click_a.js
@@ -15,17 +15,16 @@ if (!window.hasOwnProperty('frost_click_a')) {
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;
-
-
+ if (element.tagName === 'A') {
if (!prevented) {
+ var url = element.getAttribute('href');
console.log('Click Intercept', url);
- if (typeof Frost !== 'undefined') Frost.loadUrl(url);
+ // if frost is injected, check if loading the url through an overlay works
+ if (typeof Frost !== 'undefined' && Frost.loadUrl(url)) {
+ e.stopPropagation();
+ e.preventDefault();
+ }
}
- e.stopPropagation();
- e.preventDefault();
}
}
diff --git a/app/src/main/assets/js/click_a.min.js b/app/src/main/assets/js/click_a.min.js
index c7870e2f..2033fd31 100644
--- a/app/src/main/assets/js/click_a.min.js
+++ b/app/src/main/assets/js/click_a.min.js
@@ -4,12 +4,10 @@ window.frost_click_a=!0
;var prevented=!1,_frostAClick=function(e){
var t=e.target||e.srcElement
;if("A"!==t.tagName&&(t=t.parentNode),"A"!==t.tagName&&(t=t.parentNode),
-"A"===t.tagName&&"#"!==t.getAttribute("href")){
+"A"===t.tagName&&!prevented){
var n=t.getAttribute("href")
-;if(n.includes("photoset_token"))return
-;prevented||(console.log("Click Intercept",n),
-"undefined"!=typeof Frost&&Frost.loadUrl(n)),
-e.stopPropagation(),e.preventDefault()
+;console.log("Click Intercept",n),"undefined"!=typeof Frost&&Frost.loadUrl(n)&&(e.stopPropagation(),
+e.preventDefault())
}
},_frostPreventClick=function(){
console.log("Click prevented"),prevented=!0