From 6af9c17efebea201fb6d719024158cdd9e63991e Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 9 Jan 2022 17:44:46 +0000 Subject: [PATCH] Added a primitive like/react menu. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3745 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/cory/index.json | 2 +- apps/cory/index/tf-message.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/apps/cory/index.json b/apps/cory/index.json index 43312926..d08d7ed8 100644 --- a/apps/cory/index.json +++ b/apps/cory/index.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&F1q+r6zHWzbJE9t2rjrhupV2xCIFyJNabXkbGWjHTQQ=.sha256","index.html":"&O8+Vr4YHP8NIORZzM3Ee9tyLXr2xCETT2Eva0rO5ebA=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&ox9wj2+P3BhqokfHPI3ZMpSYNpNhl91K5R6Z4GbWxCA=.sha256","tf.js":"&rUCI1QKOoyWcFegV72DfG/P7HykmkX4DcvWV87hCeBM=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&F1q+r6zHWzbJE9t2rjrhupV2xCIFyJNabXkbGWjHTQQ=.sha256","index.html":"&O8+Vr4YHP8NIORZzM3Ee9tyLXr2xCETT2Eva0rO5ebA=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&eS1jLx23k9mytvuDdxHu/NPblvlmp8HY46uvCP7GtVY=.sha256","tf.js":"&rUCI1QKOoyWcFegV72DfG/P7HykmkX4DcvWV87hCeBM=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}} \ No newline at end of file diff --git a/apps/cory/index/tf-message.js b/apps/cory/index/tf-message.js index d961bec3..54126c80 100644 --- a/apps/cory/index/tf-message.js +++ b/apps/cory/index/tf-message.js @@ -20,7 +20,25 @@ Vue.component('tf-message', { 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: ` @@ -63,6 +81,16 @@ Vue.component('tf-message', { {{vote + (votes[message.id][vote].length > 1 ? ' (' + votes[message.id][vote].length + ')' : '')}} + + + + Like + + + thumb_up + + + `, }); \ No newline at end of file