Files: 59ec50547ac8f97c3f287fc4854692b515223939 / modules / like.js
736 bytesRaw
1 | |
2 | var h = require('hyperscript') |
3 | var u = require('../util') |
4 | |
5 | exports.message_link = [] |
6 | |
7 | exports.message_content = function (msg, sbot) { |
8 | if(msg.value.content.type !== 'vote') return |
9 | var link = msg.value.content.vote.link |
10 | return h('div', msg.value.content.vote.value > 0 ? 'yup' : 'nah', |
11 | u.decorate(exports.message_link, link, function (d, e, v) { return d(e, v, sbot) }) |
12 | ) |
13 | } |
14 | |
15 | exports.message_action = function (msg, sbot) { |
16 | if(msg.value.content.type !== 'vote') |
17 | return h('a', {href: '#', onclick: function () { |
18 | var yup = { |
19 | type: 'vote', |
20 | vote: { link: msg.key, value: 1, expression: 'yup' } |
21 | } |
22 | //TODO: actually publish... |
23 | |
24 | alert(JSON.stringify(yup, null, 2)) |
25 | }}, 'yup') |
26 | |
27 | } |
28 |
Built with git-ssb-web