Files: 4cda013d06b86a002895df3cbed747f6baf1085c / modules_basic / about.js
922 bytesRaw
1 | |
2 | var h = require('hyperscript') |
3 | |
4 | function idLink (id) { |
5 | return h('a', {href:'#'+id}, id) |
6 | } |
7 | |
8 | function asLink (ln) { |
9 | return 'string' === typeof ln ? ln : ln.link |
10 | } |
11 | |
12 | //var blob_url = require('../plugs').first(exports.blob_url = []) |
13 | |
14 | exports.needs = { |
15 | blob_url: 'first' |
16 | } |
17 | |
18 | exports.gives = 'message_content' |
19 | |
20 | exports.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