"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; } }, content_raw: function() { try { return JSON.stringify(JSON.parse(this.message.content), null, 2); } catch { return this.message.content; } } }, methods: { markdown: markdown, 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, }, }, }, '*'); } }, show_message: function() { window.parent.postMessage({action: 'setHash', hash: this.message.id}, '*'); }, }, template: `

percent

{{vote + (votes[message.id][vote].length > 1 ? ' (' + votes[message.id][vote].length + ')' : '')}} reply Like thumb_up
`, });