diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render-msg.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 50dc6de..91e7386 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -298,6 +298,7 @@ RenderMsg.prototype.message = function (cb) { case 'poll': return this.poll(cb) case 'position': if (this.c.version === 'v1') return this.pollPosition(cb) case 'scat_message': return this.scat(cb) + case 'share': return this.share(cb) default: return this.object(cb) } } @@ -1798,3 +1799,25 @@ RenderMsg.prototype.scat = function (cb) { h('q', String(this.c.text)) ], cb) } + +RenderMsg.prototype.share = function (cb) { + var self = this + var share = self.c.share || {} + self.link(share.link, function (err, link) { + self.wrapMini([ + 'shares ', + share.content === 'blog' ? 'blog ' + : share.content ? [h('code', String(share.content)), ' '] + : '', + link || String(share.link), + share.url ? [ + ' at ', + h('small', h('a', {href: self.toUrl(share.url)}, share.url)) + ] : '', + share.text ? [ + ': ', + h('q', String(share.text)) + ] : '' + ], cb) + }) +} |