aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEv Bogue <ev@evbogue.com>2019-07-29 09:35:17 -0500
committerEv Bogue <ev@evbogue.com>2019-07-29 09:35:17 -0500
commit52561b0bbbdcd41401265ed37c667ff2402f90b7 (patch)
tree316861cca8e696b7fba43052852b7e77b34aa923
parentb274bd838dca5f36d08a2cf0b4946d5e3cb7174d (diff)
implement search
-rw-r--r--app.js2
-rw-r--r--views.js17
2 files changed, 19 insertions, 0 deletions
diff --git a/app.js b/app.js
index c15f2f2..9d6a1aa 100644
--- a/app.js
+++ b/app.js
@@ -57,6 +57,8 @@ function route (keys) {
pubs()
} else if (src[0] === '@') {
profilePage(src, keys)
+ } else if (src[0] === '?') {
+ searchPage(src, keys)
} else if (src[0] === '%') {
threadPage(src, keys)
} else {
diff --git a/views.js b/views.js
index 56cee4a..ed1a5e0 100644
--- a/views.js
+++ b/views.js
@@ -95,6 +95,23 @@ function profilePage (src, keys) {
})
}
+function searchPage (src, keys) {
+ var search = src.substring(1).replace("%20"," ")
+ console.log(search)
+ scroller.appendChild(composer(keys))
+ bog().then(log => {
+ if (log) {
+ log.forEach(function (msg) {
+ if (msg.text) {
+ if (msg.text.includes(search)) {
+ scroller.appendChild(render(msg, keys))
+ }
+ }
+ })
+ }
+ })
+}
+
function publicPage (keys) {
localforage.getItem('subscriptions').then(function (subs) {