diff --git a/landing/index.html b/landing/index.html
index afc7830..1495873 100644
--- a/landing/index.html
+++ b/landing/index.html
@@ -228,6 +228,9 @@
Settle the score.
// A reaction scene posts the message, then each reaction lands on it and
// plusplus answers in the message's thread (events_processor.go handleReaction).
// Only the strongest reaction counts, so 🏆 after 👏 adds the difference.
+ // A message with both a reply and reactions is typed karma that others pile
+ // onto: reacting to it credits the people it named, not whoever typed it. Both
+ // replies go in its thread so they read in order.
var scenes = [
{
label: 'React',
@@ -278,6 +281,17 @@ Settle the score.
+ applied('Jeff Heaney', 'gained', 3, 15, 18)
}]
},
+ {
+ label: 'Pile on',
+ messages: [{
+ author: mark, time: '11:15 AM',
+ segments: [at('plusplus'), { text: ' ' }, at('johnson'), sym('+', 5)],
+ reply: applied('Alan Johnson', 'gained', 4, 49, 53),
+ reactions: [
+ { emoji: '🔥', reply: applied('Alan Johnson', 'gained', 4, 53, 57) }
+ ]
+ }]
+ },
{
label: 'Capped',
messages: [{
@@ -297,7 +311,7 @@ Settle the score.
+ 'All-time karma leaderboard'
+ '1. Super Hans - 62'
+ '2. Sophie Chapman - 61'
- + '3. Dobby - 37'
+ + '3. Alan Johnson - 57'
+ ''
}]
}
@@ -354,7 +368,7 @@ Settle the score.
if (!row) {
row = document.createElement('div');
row.className = 'slack__reactions';
- body.appendChild(row);
+ body.insertBefore(row, body.querySelector('.slack__thread'));
}
var pill = document.createElement('span');
pill.className = 'slack__reaction slack__reaction--mine';
@@ -441,24 +455,22 @@ Settle the score.
after(380, function () {
resetComposer();
var posted = addUserMsg(m.author, m.time, m.segments);
- if (m.reactions) {
+ var last = mi === messages.length - 1;
+ function next() { playMessages(messages, mi + 1, done); }
+ function react() {
after(900, function () {
- playReactions(posted, m.reactions, 0, function () {
- after(3000, function () { playMessages(messages, mi + 1, done); });
- });
+ playReactions(posted, m.reactions, 0, function () { after(3000, next); });
});
- return;
}
+ if (!m.reply) { react(); return; }
after(600, function () {
- var text = addBotMsg(typingDots);
+ var text = addBotMsg(typingDots, m.reactions && threadOf(posted));
after(1200, function () {
text.innerHTML = m.reply;
tickTotals(text);
toBottom();
- var last = mi === messages.length - 1;
- after(last ? 3000 : 1100, function () {
- playMessages(messages, mi + 1, done);
- });
+ if (m.reactions) { react(); return; }
+ after(last ? 3000 : 1100, next);
});
});
});
@@ -483,14 +495,11 @@ Settle the score.
function renderStatic(scene) {
scene.messages.forEach(function (m) {
var posted = addUserMsg(m.author, m.time, m.segments);
- if (m.reactions) {
- m.reactions.forEach(function (r) {
- addReaction(posted, r.emoji);
- addBotMsg(r.reply, threadOf(posted));
- });
- return;
- }
- addBotMsg(m.reply);
+ if (m.reply) addBotMsg(m.reply, m.reactions && threadOf(posted));
+ (m.reactions || []).forEach(function (r) {
+ addReaction(posted, r.emoji);
+ addBotMsg(r.reply, threadOf(posted));
+ });
});
toBottom();
}