From 52561b0bbbdcd41401265ed37c667ff2402f90b7 Mon Sep 17 00:00:00 2001 From: Ev Bogue Date: Mon, 29 Jul 2019 09:35:17 -0500 Subject: implement search --- app.js | 2 ++ views.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) 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) { -- cgit v1.2.3-70-g09d2