Files: e79b60cf3dad85b6ef8589856a512ebd338c257f / modules / about.js
970 bytesRaw
1 | var h = require('hyperscript') |
2 | var blobUrl = require('./helpers').bloburl |
3 | var markdown = require('./helpers').markdown |
4 | |
5 | exports.needs = { |
6 | avatar_name: 'first', |
7 | avatar_link: 'first' |
8 | } |
9 | |
10 | exports.gives = { |
11 | message_content_mini: true |
12 | } |
13 | |
14 | exports.create = function (api) { |
15 | exports.message_content_mini = function (msg) { |
16 | var about = msg.value.content |
17 | var id = msg.value.content.about |
18 | if (msg.value.content.type == 'description') { |
19 | return h('span', markdown('**Description:** ' + about.description)) |
20 | } |
21 | if (msg.value.content.type == 'loc') { |
22 | return h('span', h('strong', 'Location: '), about.loc) |
23 | } |
24 | if (msg.value.content.type == 'about') { |
25 | if (msg.value.content.name) { |
26 | return h('span', 'identifies as ', about.name) |
27 | } |
28 | if (msg.value.content.image) { |
29 | return h('span', 'identifies as ', h('img.avatar--thumbnail', {src: blobUrl(about.image)})) |
30 | } |
31 | } else { return } |
32 | } |
33 | return exports |
34 | } |
35 |
Built with git-ssb-web