From 0db54b76a98437be9f11867a23b11970565e950b Mon Sep 17 00:00:00 2001 From: ShadowKyogre Date: Fri, 4 Sep 2015 18:07:16 -0700 Subject: [PATCH] Add Javascript bookmarklets support. Also make searches like like "webkit android 4.4.2 broken" actually searchable and local files viewable. --- AndroidManifest.xml | 7 +++++++ src/org/tint/utils/UrlUtils.java | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ccd73bb..cbe7664 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -43,6 +43,7 @@ + @@ -69,6 +70,12 @@ + + + + + + diff --git a/src/org/tint/utils/UrlUtils.java b/src/org/tint/utils/UrlUtils.java index 84d5a47..9e531e4 100644 --- a/src/org/tint/utils/UrlUtils.java +++ b/src/org/tint/utils/UrlUtils.java @@ -34,7 +34,11 @@ public class UrlUtils { */ public static boolean isUrl(String url) { return - url.contains(".") || + (url.contains(".") && !url.contains(" ")) || /* actually check if it begins with the proper protocol */ + url.startsWith("http://") || + url.startsWith("https://") || + url.startsWith("file://") || + url.startsWith("javascript:") || url.equals(Constants.URL_ABOUT_BLANK) || url.equals(Constants.URL_ABOUT_START) || url.equals(Constants.URL_ABOUT_TUTORIAL); @@ -76,6 +80,7 @@ public static String checkUrl(String url) { if ((!url.startsWith("http://")) && (!url.startsWith("https://")) && (!url.startsWith("file://")) && + (!url.startsWith("javascript:")) && //add bookmarklet support (!url.startsWith(Constants.URL_ABOUT_BLANK)) && (!url.startsWith(Constants.URL_ABOUT_START)) && (!url.startsWith(Constants.URL_ABOUT_TUTORIAL))) {