Files: f6391d5b5450e27f0c7a8dba7d82a53c4ad2634a / modules_basic / avatar-name.js
666 bytesRaw
1 | var h = require('hyperscript') |
2 | |
3 | exports.needs = { signifier: 'first' } |
4 | |
5 | exports.gives = 'avatar_name' |
6 | |
7 | exports.create = function (api) { |
8 | |
9 | return function name (id) { |
10 | var n = h('span', id ? id.substring(0, 10) : "") |
11 | |
12 | //choose the most popular name for this person. |
13 | //for anything like this you'll see I have used sbot.links2 |
14 | //which is the ssb-links plugin. as you'll see the query interface |
15 | //is pretty powerful! |
16 | //TODO: "most popular" name is easily gameable. |
17 | //must come up with something better than this. |
18 | |
19 | api.signifier(id, function (_, names) { |
20 | if(names.length) n.textContent = names[0].name |
21 | }) |
22 | |
23 | return n |
24 | } |
25 | |
26 | } |
27 | |
28 |
Built with git-ssb-web