"use strict"; Vue.component('tf-message', { props: ['message', 'messages', 'votes'], data: function() { return { showRaw: false } }, computed: { content_json: function() { try { return JSON.parse(this.message.content); } catch { return undefined; } }, }, methods: { markdown: function(md) { var reader = new commonmark.Parser({safe: true}); var writer = new commonmark.HtmlRenderer(); return writer.render(reader.parse(md)); }, set_reply: function() { g_data.reply_root = this.content_json.root || this.message.id; g_data.reply_branch = this.message.id; }, vote: function(event) { var reaction = event.srcElement.innerText; var message = this.message.id; if (confirm('Are you sure you want to react with ' + reaction + ' to ' + message + '?')) { window.parent.postMessage( { appendMessage: { type: 'vote', vote: { link: message, value: 1, expression: reaction, }, }, }, '*'); } }, }, template: `

{{new Date(message.timestamp)}} {{message.id}}
more_vert View Raw View Message Reply
{{message.content}}
{{mention.name}}
{{content_json.name || 'tildefriends-app'}}
{{content_json.following ? '==>' : '=/=>'}}
{{message.content}}
{{vote + (votes[message.id][vote].length > 1 ? ' (' + votes[message.id][vote].length + ')' : '')}} Like thumb_up
`, });