git ssb

0+

ev / 0qc



Commit e4ce6bb40173e08028c870d5b637e13128c98c83

finish star/unstar via backlinks button and message render

Ev Bogue committed on 3/11/2019, 4:44:04 PM
Parent: 4bf3b04a19f8c1aab58a1ebe30fb7f9d6d6d1cd2

Files changed

index.jschanged
render.jschanged
index.jsView
@@ -21,9 +21,9 @@
2121 else {
2222 var currentScreen = document.getElementById('screen')
2323 var opts = {}
2424 opts.type = 'post'
25- var composer = h('div.content#composer', h('div.message', compose(opts)))
25 + var composer = h('div.content#composer', h('div.message', h('div.messageContent', compose(opts))))
2626 if (currentScreen.firstChild.firstChild) {
2727 currentScreen.firstChild.insertBefore(composer, currentScreen.firstChild.firstChild)
2828 } else {
2929 currentScreen.firstChild.appendChild(composer)
render.jsView
@@ -40,32 +40,40 @@
4040 }),
4141 pull.drain(function (data) {
4242 if (data.sync) {
4343 } else {
44- var subMessageExists = (document.getElementById(data.key.substring(0, 44)) !== null)
45-
46- if (!subMessageExists) {
47- //console.log(data)
48- if (data.value.content.type == 'vote') {
49- if (msg.key == data.value.content.vote.link) {
50- console.log(data)
51- if (data.value.content.vote.value == 1)
52- var link = h('span', ' ', h('img.emoji', {src: config.emojiUrl + 'star.png'}), ' ', h('a', {href: '#' + data.value.content.vote.link}, tools.messageLink(data.value.content.vote.link)))
53- if (data.value.author == id) {
54- var gotIt = document.getElementById('votebutton:' + msg.key.substring(0,44))
55- if (gotIt != null) {
56- gotIt.parentNode.appendChild(tools.unstar(msg))
57- gotIt.removeChild(gotIt.firstChild)
58- //gotIt.outerHTML = ''
59- }
44 + if (data.value.content.type == 'vote') {
45 + var subMessageExists = (document.getElementById(data.key.substring(0, 44)) !== null)
46 + if (msg.key == data.value.content.vote.link) {
47 + if (data.value.content.vote.value == 1) {
48 + var link = h('span', ' ', h('img.emoji', {src: config.emojiUrl + 'star.png'}), ' ', h('a', {href: '#' + data.value.content.vote.link}, tools.messageLink(data.value.content.vote.link)))
49 + if (!subMessageExists) {
50 + message.appendChild(h('div.submessage', h('div.messageContent', tools.mini(data, link))))
51 + }
52 + if (data.value.author == id) {
53 + var gotIt = document.getElementById('votebutton:' + msg.key.substring(0,44))
54 + if (gotIt != null) {
55 + gotIt.parentNode.appendChild(tools.unstar(msg))
56 + gotIt.parentNode.removeChild(gotIt)
6057 }
61- else if (data.value.content.vote.value == -1)
62- var link = h('span', ' ', h('img.emoji', {src: config.emojiUrl + 'stars.png'}), ' ', h('a', {href: '#' + data.value.content.vote.link}, tools.messageLink(data.value.content.vote.link)))
58 + }
59 + } else if (data.value.content.vote.value == -1) {
60 + var link = h('span', ' ', h('img.emoji', {src: config.emojiUrl + 'stars.png'}), ' ', h('a', {href: '#' + data.value.content.vote.link}, tools.messageLink(data.value.content.vote.link)))
61 + if (!subMessageExists) {
6362 message.appendChild(h('div.submessage', h('div.messageContent', tools.mini(data, link))))
64- } else {
65- //console.log('did not render vote')
63 + }
64 + if (data.value.author == id) {
65 + var gotIt = document.getElementById('votebutton:' + msg.key.substring(0,44))
66 + if (gotIt != null) {
67 + gotIt.parentNode.appendChild(tools.star(msg))
68 + gotIt.parentNode.removeChild(gotIt)
69 + }
70 + }
6671 }
67- } else if (data.value.content.type == 'post') {
72 + }
73 + }
74 + else if (!subMessageExists) {
75 + if (data.value.content.type == 'post') {
6876 if (
6977 (msg.key == data.value.content.root) ||
7078 (msg.value.content.root == data.value.content.root)
7179 ) {

Built with git-ssb-web