git ssb

1+

punkmonk.termux / mvd



forked from ev / mvd

Commit ff143e8934ce10479fb7f2a1a8a3b5eaea7447cd

make a stab at hashtag search

Ev Bogue committed on 7/28/2018, 1:22:21 AM
Parent: 7e5eace0de85841889751468a862dd2c55f447bc

Files changed

index.jschanged
tools.jschanged
views.jschanged
index.jsView
@@ -54,9 +54,12 @@
5454 h('li', h('a', {href: '#key' }, 'Key')),
5555 h('li.right', h('a', {href: '#about'}, '?')),
5656 h('form.search', {
5757 onsubmit: function (e) {
58- window.location.hash = '?' + search.value
58+ if (search.value[0] == '#')
59+ window.location.hash = '#' + search.value
60+ else
61+ window.location.hash = '?' + search.value
5962 e.preventDefault()
6063 }},
6164 search
6265 )
tools.jsView
@@ -388,9 +388,9 @@
388388 var config = require('./config')()
389389
390390 module.exports.markdown = function (msg, md) {
391391 return {innerHTML: markdown.block(msg, {toUrl: function (url, image) {
392- if(url[0] == '%' || url[0] == '@') return '#' + url
392+ if(url[0] == '%' || url[0] == '@' || url[0] == '#') return '#' + url
393393 if(!image) return url
394394 if(url[0] !== '&') return url
395395 return config.blobsUrl + url
396396 }})}
views.jsView
@@ -472,19 +472,20 @@
472472 }
473473
474474 function search (src) {
475475 console.log('search' + src)
476-
476+
477477 var content = h('div.content')
478478 var screen = document.getElementById('screen')
479479 screen.appendChild(hyperscroll(content))
480-
480+
481481 pull(
482- sbot.search.query({query: src}),
482+ sbot.search.query({query: src, limit: 100}),
483483 pull.drain(function (search) {
484484 content.appendChild(render(search))
485485 })
486486 )
487+
487488 }
488489
489490 function hash () {
490491 return window.location.hash.substring(1)
@@ -506,11 +507,13 @@
506507 } else if (src == 'private') {
507508 privateStream()
508509 } else if (src == 'key') {
509510 keyPage()
510- } else if (src[0] == '?') {
511- search(src.substr(1).split('%20').join(' '))
512- //search(src.substring(1, 1000))
511+ } else if (src[0] == '?' || (src[0] == '#')) {
512+ if (src[0] == '#')
513+ search(src.split('%20').join(' '))
514+ else
515+ search(src.substr(1).split('%20').join(' '))
513516 } else {
514517 everythingStream()
515518 checkInvite()
516519 }

Built with git-ssb-web