aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-08 16:28:38 -0700
committerGitHub <noreply@github.com>2017-08-08 16:28:38 -0700
commit1e2a2d77169b5de968e29873e13a78a0d8c94a18 (patch)
tree6a9883f82205fb63ef3831996793631d6d878d5b /app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
parent397cc1f54725aee6fb542b08f965389272469309 (diff)
downloadfrost-1.4.1.1.tar.gz
frost-1.4.1.1.tar.bz2
frost-1.4.1.1.zip
Misc (#128)v1.4.2v1.4.1.1
* Update null * Attempt to improve transparent theme backgrounds * Update menu * Move injections to visible method and reduce offset * Update searchview and logging * Clean temp strings and add network states * Move console blacklist to web state * Change some logs to info
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
index fb4e5bf7..f63f4fdc 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
@@ -56,13 +56,17 @@ class SearchWebView(context: Context, val contract: SearchContract) : WebView(co
addJavascriptInterface(SearchJSI(), "Frost")
searchSubject.debounce(300, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.newThread())
.map {
- Jsoup.parse(it).select("a:not([rel*='keywords(']):not([href=#])[rel]").map {
+ val doc = Jsoup.parse(it)
+ L.d(doc.getElementById("main-search_input")?.html())
+ val searchQuery = doc.getElementById("main-search-input")?.text() ?: "Null input"
+ L.d("Search query", searchQuery)
+ doc.select("a:not([rel*='keywords(']):not([href=#])[rel]").map {
element ->
//split text into separate items
- L.v("Search element ${element.attr("href")}")
+ L.v("Search element", element.attr("href"))
val texts = element.select("div").map { it.text() }.filter { !it.isNullOrBlank() }
val pair = Pair(texts, element.attr("href"))
- L.v("Search element potential $pair")
+ L.v("Search element potential", pair.toString())
pair
}.filter { it.first.isNotEmpty() }
}
@@ -124,6 +128,9 @@ class SearchWebView(context: Context, val contract: SearchContract) : WebView(co
searchSubject.onComplete()
contract.searchOverlayDispose()
}
+ 2 -> {
+ L.v("Search emission received")
+ }
}
}
}