git ssb

3+

ev / decent



Commit a62e4a2e1d9e88e5b8d4d104be51aae9b17f1003

add simple ssb-fulltext search bar

Ev Bogue committed on 10/15/2017, 4:32:09 AM
Parent: b502b03d07f95afd0a2441270de7f0d8e37309ea

Files changed

client/modules/app.jschanged
client/modules/search.jschanged
client/style.csschanged
client/style.css.jsonchanged
package-lock.jsonchanged
package.jsonchanged
client/modules/app.jsView
@@ -31,17 +31,27 @@
3131 }
3232
3333 document.body.appendChild(screen)
3434
35 + var search = h('input')
36 +
3537 document.body.appendChild(h('div.navbar',
3638 h('div.internal',
3739 h('li', h('a', {href: '#' + id}, api.avatar_image(id, 'tiny'))),
3840 h('li', h('a', {href: '#' + id}, api.avatar_name(id))),
3941 h('li', h('a', {href: '#'}, 'Public')),
4042 h('li', h('a', {href: '#Direct'}, 'Direct')),
4143 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 + )
4454 )
4555 ))
4656 }
4757 }
client/modules/search.jsView
@@ -69,9 +69,9 @@
6969 }
7070
7171 exports.create = function (api) {
7272 return function (path) {
73- if(path[0] === '?' || '##') {
73 + if(path[0] === '?') {
7474 console.log('SEARCHING for ' + path)
7575 var queryStr = path
7676 if (queryStr[0] === '?') {
7777 queryStr = queryStr.substring(1).trim()
@@ -109,13 +109,13 @@
109109 highlight(el, createOrRegExp(query))
110110 return el
111111 }
112112
113- pull(
113 + /*pull(
114114 api.sbot_log({old: false}),
115115 pull.filter(matchesQuery),
116116 Scroller(div, content, renderMsg, true, false)
117- )
117 + )*/
118118
119119 pull(
120120 u.next(api.sbot_fulltext_search, {query: queryStr, reverse: true, limit: 500, live: false}),
121121 fallback(function (err) {
client/style.cssView
@@ -265,22 +265,12 @@
265265 }
266266
267267 /* searchprompt */
268268
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;
275271 }
276272
277-.header__search {
278- position: absolute;
279- bottom: .5em;
280- left: .5em;
281-}
282-
283273 .header__profile {
284274 margin: .7em;
285275 }
286276
client/style.css.jsonView
@@ -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.jsonView
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.jsonView
@@ -1,7 +1,7 @@
11 {
22 "name": "decent",
3- "version": "3.6.0",
3 + "version": "3.7.0",
44 "description": "A decent(tralized) network for communication and development",
55 "scripts": {
66 "start": "node decent server",
77 "build": "node client/scripts/style.js && mkdir -p build && browserify client/index.js | indexhtmlify > build/index.html",

Built with git-ssb-web