Commit a62e4a2e1d9e88e5b8d4d104be51aae9b17f1003
add simple ssb-fulltext search bar
Ev Bogue committed on 10/15/2017, 4:32:09 AMParent: b502b03d07f95afd0a2441270de7f0d8e37309ea
Files changed
client/modules/app.js | changed |
client/modules/search.js | changed |
client/style.css | changed |
client/style.css.json | changed |
package-lock.json | changed |
package.json | changed |
client/modules/app.js | ||
---|---|---|
@@ -31,17 +31,27 @@ | ||
31 | 31 … | } |
32 | 32 … | |
33 | 33 … | document.body.appendChild(screen) |
34 | 34 … | |
35 … | + var search = h('input') | |
36 … | + | |
35 | 37 … | document.body.appendChild(h('div.navbar', |
36 | 38 … | h('div.internal', |
37 | 39 … | h('li', h('a', {href: '#' + id}, api.avatar_image(id, 'tiny'))), |
38 | 40 … | h('li', h('a', {href: '#' + id}, api.avatar_name(id))), |
39 | 41 … | h('li', h('a', {href: '#'}, 'Public')), |
40 | 42 … | h('li', h('a', {href: '#Direct'}, 'Direct')), |
41 | 43 … | h('li', h('a', {href: '#Mentions'}, 'Mentions')), |
42 | - h('li', h('a', {href: '#Theme'}, 'Theme')), | |
43 | - h('li', h('a', {href: '#Key'}, 'Key')) | |
44 … | + //h('li', h('a', {href: '#Theme'}, 'Theme')), | |
45 … | + h('li', h('a', {href: '#Key'}, 'Key')), | |
46 … | + h('form.search', { onsubmit: function (e) { | |
47 … | + //if (err) throw err | |
48 … | + window.location.hash = '?' + search.value | |
49 … | + e.preventDefault() | |
50 … | + }}, | |
51 … | + search, | |
52 … | + h('button', 'Search') | |
53 … | + ) | |
44 | 54 … | ) |
45 | 55 … | )) |
46 | 56 … | } |
47 | 57 … | } |
client/modules/search.js | ||
---|---|---|
@@ -69,9 +69,9 @@ | ||
69 | 69 … | } |
70 | 70 … | |
71 | 71 … | exports.create = function (api) { |
72 | 72 … | return function (path) { |
73 | - if(path[0] === '?' || '##') { | |
73 … | + if(path[0] === '?') { | |
74 | 74 … | console.log('SEARCHING for ' + path) |
75 | 75 … | var queryStr = path |
76 | 76 … | if (queryStr[0] === '?') { |
77 | 77 … | queryStr = queryStr.substring(1).trim() |
@@ -109,13 +109,13 @@ | ||
109 | 109 … | highlight(el, createOrRegExp(query)) |
110 | 110 … | return el |
111 | 111 … | } |
112 | 112 … | |
113 | - pull( | |
113 … | + /*pull( | |
114 | 114 … | api.sbot_log({old: false}), |
115 | 115 … | pull.filter(matchesQuery), |
116 | 116 … | Scroller(div, content, renderMsg, true, false) |
117 | - ) | |
117 … | + )*/ | |
118 | 118 … | |
119 | 119 … | pull( |
120 | 120 … | u.next(api.sbot_fulltext_search, {query: queryStr, reverse: true, limit: 500, live: false}), |
121 | 121 … | fallback(function (err) { |
client/style.css | ||
---|---|---|
@@ -265,22 +265,12 @@ | ||
265 | 265 … | } |
266 | 266 … | |
267 | 267 … | /* searchprompt */ |
268 | 268 … | |
269 | -.searchprompt { | |
270 | - margin-top: 1px; | |
271 | - margin-bottom: 1px; | |
272 | - float: left; | |
273 | - padding: .5em; | |
274 | - width: 85%; | |
269 … | +.search input { | |
270 … | + margin-left: .5em; | |
275 | 271 … | } |
276 | 272 … | |
277 | -.header__search { | |
278 | - position: absolute; | |
279 | - bottom: .5em; | |
280 | - left: .5em; | |
281 | -} | |
282 | - | |
283 | 273 … | .header__profile { |
284 | 274 … | margin: .7em; |
285 | 275 … | } |
286 | 276 … |
client/style.css.json | ||
---|---|---|
@@ -1,1 +1,1 @@ | ||
1 | -"\n.navbar {\n background: #fff;\n width: 100%;\n position: fixed;\n z-index: 1000;\n margin: 0;\n padding-top: .6em;\n padding-bottom: .2em;\n left: 0; right: 0;\n top: 0;\n}\n\n.navbar .internal {\n max-width: 620px; \n margin-left: auto;\n margin-right: auto;\n}\n\n.navbar li {\n float: left;\n padding-left: 1em;\n list-style-type: none;\n}\n\n* {\n word-wrap: break-word;\n}\n\npre {\n height: auto;\n max-height: 200px;\n overflow: auto;\n background-color: #eeeeee;\n word-break: normal !important;\n word-wrap: normal !important;\n white-space: pre !important;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-size: 1.2em;\n margin-top: .35ex;\n}\n\np {\n margin-top: .35ex;\n}\n\nhr {\n border: solid #eee;\n clear: both;\n border-width: 1px 0 0;\n height: 0;\n margin-bottom: .9em;\n}\n\n.screen {\n width: 100%;\n position: absolute;\n top: 2.5em; bottom: 0;\n left: 0; right: 0;\n overflow-y: hidden;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n min-height:0px;\n}\n\n.row {\n display: flex;\n flex-direction: row;\n min-height:0px;\n}\n\n.end {\n justify-content: flex-end;\n}\n\n.wrap {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n\n.no-shrink {\n flex-shrink: 0;\n}\n\n.expand {\n justify-content: space-between;\n}\n\n.scroll-y {\n overflow-y: auto;\n min-height: 0px;\n}\n\n.scroll-x {\n overflow-x: auto;\n min-width: 0px;\n}\n\npre {\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n\n.wide {\n width: 100%;\n}\n\n/* scrolling feeds, threads */\n\n.scroller {\n width: 100%;\n flex: 1;\n}\n\n.scroller__content {\n width: 100%;\n}\n\n.scroller__wrapper {\n margin-left: auto;\n margin-right: auto;\n}\n\n/* compose */\n\n.compose {\n margin-top: .5em;\n}\n\n.theme {\n height: 20em;\n width: 100%;\n}\n\ntextarea {\n font-size: 1em;\n margin: 0;\n}\n\n/* messages */\n\n.message {\n position: relative;\n flex-basis: 0;\n}\n\n.message_content {\n margin-top: 5px;\n padding-top: 3px;\n}\n\n.message_content--mini div > span {\n display: inline-block;\n}\n\n.message_meta {\n margin-left: auto;\n}\n\n.message_meta > * {\n margin-left: .5ex;\n}\n\n.message_actions {\n float: right;\n}\n\n.message img {\n max-width: 100%;\n}\n\n.message > .title > .avatar {\n margin-left: 0;\n}\n\n.message_content {\n padding: .5ex;\n}\n\n.actions > :not(:last-child) {\n border-right: 2px solid #eee;\n padding-right: 5px;\n}\n\n.emoji {\n height: 1em;\n width: 1em;\n vertical-align: top;\n}\n\n\n/* -- suggest box */\n\n.suggest-box > * {\n display: block;\n}\n\n.suggest-box ul {\n padding: 0;\n list-style-type: none;\n padding-left: 0;\n margin: 0;\n}\n\n.suggest-box .selected {\n background: #ddd;\n}\n\n.suggest-box {\n width: max-content;\n background: white;\n}\n\n/* emoji */\n.suggest-box img {\n height: 20px;\n width: 20px;\n}\n\n/* avatar */\n\n.avatar--profile {\n width: 5em;\n height: 5em;\n float: left;\n margin-right: 5px;\n vertical-align: top;\n}\n\n.avatar--thumbnail {\n width: 2.5em;\n height: 2.5em;\n vertical-align: top;\n margin-right: .5ex;\n}\n\n.avatar--tiny {\n width: 26px;\n height: 26px;\n}\n\n.profile {\n padding: .5ex;\n}\n\n.profile__info {\n margin-left: .5em;\n}\n\n/* lightbox - used in message-confirm */\n\n.lightbox {\n overflow: auto;\n margin-top: 3em;\n margin-bottom: 3em;\n width: 90%;\n max-width: 600px;\n z-index: 5;\n}\n\n/* searchprompt */\n\n.searchprompt {\n margin-top: 1px;\n margin-bottom: 1px;\n float: left;\n padding: .5em;\n width: 85%;\n}\n\n.header__search {\n position: absolute;\n bottom: .5em;\n left: .5em;\n}\n\n.header__profile {\n margin: .7em;\n}\n\n/* TextNodeSearcher highlights */\n\n.highlight {\n background: yellow;\n}\n\n/* avatar editor */\n\n.hypercrop__canvas {\n width: 100%;\n}\n\n/* gitssb */\n\n.git-table-wrapper {\n max-height: 12em;\n overflow: auto;\n word-break: break-all;\n margin: 1em 0;\n}\n\n.git-table-wrapper table {\n width: 100%;\n}\n\n/* --- network status --- */\n\n.status {\n width: 1em;\n height: 1em;\n margin: .5em;\n background: green;\n}\n\n.error {\n background: red;\n}\n\n/* progress bar */\n\n.hyperprogress__bar {\n background: darkgrey;\n}\n.hyperprogress__liquid {\n background: lightblue;\n}\n\n\n" | |
1 … | +"\n.navbar {\n background: #fff;\n width: 100%;\n position: fixed;\n z-index: 1000;\n margin: 0;\n padding-top: .6em;\n padding-bottom: .2em;\n left: 0; right: 0;\n top: 0;\n}\n\n.navbar .internal {\n max-width: 620px; \n margin-left: auto;\n margin-right: auto;\n}\n\n.navbar li {\n float: left;\n padding-left: 1em;\n list-style-type: none;\n}\n\n* {\n word-wrap: break-word;\n}\n\npre {\n height: auto;\n max-height: 200px;\n overflow: auto;\n background-color: #eeeeee;\n word-break: normal !important;\n word-wrap: normal !important;\n white-space: pre !important;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-size: 1.2em;\n margin-top: .35ex;\n}\n\np {\n margin-top: .35ex;\n}\n\nhr {\n border: solid #eee;\n clear: both;\n border-width: 1px 0 0;\n height: 0;\n margin-bottom: .9em;\n}\n\n.screen {\n width: 100%;\n position: absolute;\n top: 2.5em; bottom: 0;\n left: 0; right: 0;\n overflow-y: hidden;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n min-height:0px;\n}\n\n.row {\n display: flex;\n flex-direction: row;\n min-height:0px;\n}\n\n.end {\n justify-content: flex-end;\n}\n\n.wrap {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n\n.no-shrink {\n flex-shrink: 0;\n}\n\n.expand {\n justify-content: space-between;\n}\n\n.scroll-y {\n overflow-y: auto;\n min-height: 0px;\n}\n\n.scroll-x {\n overflow-x: auto;\n min-width: 0px;\n}\n\npre {\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n\n.wide {\n width: 100%;\n}\n\n/* scrolling feeds, threads */\n\n.scroller {\n width: 100%;\n flex: 1;\n}\n\n.scroller__content {\n width: 100%;\n}\n\n.scroller__wrapper {\n margin-left: auto;\n margin-right: auto;\n}\n\n/* compose */\n\n.compose {\n margin-top: .5em;\n}\n\n.theme {\n height: 20em;\n width: 100%;\n}\n\ntextarea {\n font-size: 1em;\n margin: 0;\n}\n\n/* messages */\n\n.message {\n position: relative;\n flex-basis: 0;\n}\n\n.message_content {\n margin-top: 5px;\n padding-top: 3px;\n}\n\n.message_content--mini div > span {\n display: inline-block;\n}\n\n.message_meta {\n margin-left: auto;\n}\n\n.message_meta > * {\n margin-left: .5ex;\n}\n\n.message_actions {\n float: right;\n}\n\n.message img {\n max-width: 100%;\n}\n\n.message > .title > .avatar {\n margin-left: 0;\n}\n\n.message_content {\n padding: .5ex;\n}\n\n.actions > :not(:last-child) {\n border-right: 2px solid #eee;\n padding-right: 5px;\n}\n\n.emoji {\n height: 1em;\n width: 1em;\n vertical-align: top;\n}\n\n\n/* -- suggest box */\n\n.suggest-box > * {\n display: block;\n}\n\n.suggest-box ul {\n padding: 0;\n list-style-type: none;\n padding-left: 0;\n margin: 0;\n}\n\n.suggest-box .selected {\n background: #ddd;\n}\n\n.suggest-box {\n width: max-content;\n background: white;\n}\n\n/* emoji */\n.suggest-box img {\n height: 20px;\n width: 20px;\n}\n\n/* avatar */\n\n.avatar--profile {\n width: 5em;\n height: 5em;\n float: left;\n margin-right: 5px;\n vertical-align: top;\n}\n\n.avatar--thumbnail {\n width: 2.5em;\n height: 2.5em;\n vertical-align: top;\n margin-right: .5ex;\n}\n\n.avatar--tiny {\n width: 26px;\n height: 26px;\n}\n\n.profile {\n padding: .5ex;\n}\n\n.profile__info {\n margin-left: .5em;\n}\n\n/* lightbox - used in message-confirm */\n\n.lightbox {\n overflow: auto;\n margin-top: 3em;\n margin-bottom: 3em;\n width: 90%;\n max-width: 600px;\n z-index: 5;\n}\n\n/* searchprompt */\n\n.search input {\n margin-left: .5em;\n}\n\n.header__profile {\n margin: .7em;\n}\n\n/* TextNodeSearcher highlights */\n\n.highlight {\n background: yellow;\n}\n\n/* avatar editor */\n\n.hypercrop__canvas {\n width: 100%;\n}\n\n/* gitssb */\n\n.git-table-wrapper {\n max-height: 12em;\n overflow: auto;\n word-break: break-all;\n margin: 1em 0;\n}\n\n.git-table-wrapper table {\n width: 100%;\n}\n\n/* --- network status --- */\n\n.status {\n width: 1em;\n height: 1em;\n margin: .5em;\n background: green;\n}\n\n.error {\n background: red;\n}\n\n/* progress bar */\n\n.hyperprogress__bar {\n background: darkgrey;\n}\n.hyperprogress__liquid {\n background: lightblue;\n}\n\n\n" |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 145259 bytes New file size: 145259 bytes |
package.json | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 … | { |
2 | 2 … | "name": "decent", |
3 | - "version": "3.6.0", | |
3 … | + "version": "3.7.0", | |
4 | 4 … | "description": "A decent(tralized) network for communication and development", |
5 | 5 … | "scripts": { |
6 | 6 … | "start": "node decent server", |
7 | 7 … | "build": "node client/scripts/style.js && mkdir -p build && browserify client/index.js | indexhtmlify > build/index.html", |
Built with git-ssb-web