git ssb

16+

Dominic / patchbay



Tree: b1fc586afe1b02db034fa275db35c84c915ff42f

Files: b1fc586afe1b02db034fa275db35c84c915ff42f / modules_basic / about.js

922 bytesRaw
1
2var h = require('hyperscript')
3
4function idLink (id) {
5 return h('a', {href:'#'+id}, id)
6}
7
8function asLink (ln) {
9 return 'string' === typeof ln ? ln : ln.link
10}
11
12//var blob_url = require('../plugs').first(exports.blob_url = [])
13
14exports.needs = {
15 blob_url: 'first'
16}
17
18exports.gives = 'message_content'
19
20exports.create = function (api) {
21
22 return function (msg) {
23 if(msg.value.content.type !== 'about') return
24
25 if(!msg.value.content.image && !msg.value.content.name)
26 return
27
28 var about = msg.value.content
29 var id = msg.value.content.about
30 return h('p',
31 about.about === msg.value.author
32 ? h('span', 'self-identifies ')
33 : h('span', 'identifies ', idLink(id)),
34 ' as ',
35 h('a', {href:"#"+about.about},
36 about.name || null,
37 about.image
38 ? h('img.avatar--fullsize', {src: api.blob_url(about.image)})
39 : null
40 )
41 )
42
43 }
44
45}
46
47
48
49

Built with git-ssb-web