git ssb

16+

Dominic / patchbay



Commit 98e148d13e4dcd1d5688c01b61c83da5039c4d4d

Merge branch 'more-render' of ssb://%s9mSFATE4RGyJx9wgH22lBrvD4CgUQW4yeguSWWjtqc=.sha256

Dominic Tarr committed on 12/1/2016, 7:42:14 AM
Parent: b3578789d421c2917e2f144cc3f72f86062ae753
Parent: 7bfc8ffe94be45777d9884bcd5c9db880dcc2d97

Files changed

modules_basic/index.jschanged
modules_basic/message.jschanged
modules_basic/private.jschanged
modules_basic/pub.jsadded
style.csschanged
modules_basic/index.jsView
@@ -17,8 +17,9 @@
1717 "message.js": require('./message.js'),
1818 "names.js": require('./names.js'),
1919 "post.js": require('./post.js'),
2020 "private.js": require('./private.js'),
21 + "pub.js": require('./pub.js'),
2122 "public.js": require('./public.js'),
2223 "relationships.js": require('./relationships.js'),
2324 "search-box.js": require('./search-box.js'),
2425 "setup.js": require('./setup'),
modules_basic/message.jsView
@@ -13,25 +13,31 @@
1313 var message_link = plugs.first(exports.message_link = [])
1414
1515 var sbot_links = plugs.first(exports.sbot_links = [])
1616
17-exports.message_render = function (msg, sbot) {
18- var elMini = message_content_mini(msg)
19- if (elMini) {
20- var div = h('div.message.message--mini',
21- h('div.row',
22- h('div',
23- avatar_link(msg.value.author, avatar_name(msg.value.author)),
24- h('span.message_content', elMini)),
25- h('div.message_meta.row', message_meta(msg))
26- )
17 +function mini(msg, el) {
18 + var div = h('div.message.message--mini',
19 + h('div.row',
20 + h('div',
21 + avatar_link(msg.value.author, avatar_name(msg.value.author)),
22 + h('span.message_content', el)),
23 + h('div.message_meta.row', message_meta(msg))
2724 )
28- div.setAttribute('tabindex', '0')
29- return div
30- }
25 + )
26 + div.setAttribute('tabindex', '0')
27 + return div
28 +}
3129
30 +function message_content_mini_fallback(msg) {
31 + return h('code', msg.value.content.type)
32 +}
33 +
34 +exports.message_render = function (msg, sbot) {
35 + var el = message_content_mini(msg)
36 + if(el) return mini(msg, el)
37 +
3238 var el = message_content(msg)
33- if(!el) return
39 + if(!el) return mini(msg, message_content_mini_fallback(msg))
3440
3541 var links = []
3642 for(var k in CACHE) {
3743 var _msg = CACHE[k]
modules_basic/private.jsView
@@ -11,8 +11,9 @@
1111 var message_unbox = plugs.first(exports.message_unbox = [])
1212 var sbot_log = plugs.first(exports.sbot_log = [])
1313 var sbot_whoami = plugs.first(exports.sbot_whoami = [])
1414 var avatar_image_link = plugs.first(exports.avatar_image_link = [])
15 +var emoji_url = plugs.first(exports.emoji_url = [])
1516
1617 function unbox () {
1718 return pull(
1819 pull.filter(function (msg) {
@@ -90,7 +91,15 @@
9091 return avatar_image_link('string' == typeof id ? id : id.link, 'thumbnail')
9192 }))
9293 }
9394
95 +exports.message_content_mini = function (msg, sbot) {
96 + if (typeof msg.value.content === 'string') {
97 + var icon = emoji_url('lock')
98 + return icon
99 + ? h('img', {className: 'emoji', src: icon})
100 + : 'PRIVATE'
101 + }
102 +}
94103
95104
96105
modules_basic/pub.jsView
@@ -1,0 +1,18 @@
1 +var h = require('hyperscript')
2 +var plugs = require('../plugs')
3 +var avatar_name = plugs.first(exports.avatar_name = [])
4 +var avatar_link = plugs.first(exports.avatar_link = [])
5 +
6 +exports.message_content = function (msg, sbot) {
7 + var c = msg.value.content
8 + if (c.type === 'pub') {
9 + var address = c.address || {}
10 + return [
11 + h('p', 'announced an address for ',
12 + avatar_link(address.key, avatar_name(address.key)), ':'),
13 + h('blockquote',
14 + h('code', address.host + ':' + address.port)
15 + )
16 + ]
17 + }
18 +}
style.cssView
@@ -263,9 +263,9 @@
263263
264264 .emoji {
265265 height: 1em;
266266 width: 1em;
267- vertical-align: middle;
267 + vertical-align: top;
268268 }
269269
270270
271271 /* -- suggest box */

Built with git-ssb-web