Browse Source

condense reply text into a ↳ symbol -- also render text of message that is being replied to

master
Ev Bogue 3 years ago
parent
commit
edf8b1193d
  1. 12
      bog.js
  2. 2
      css/style.css
  3. 22
      render.js

12
bog.js

@ -94,6 +94,18 @@ async function get (key) {
}
}
async function getTitle (key) {
var log = await localforage.getItem('log')
if (log != null) {
for (var i = log.length - 1; i >= 0; --i) {
if (log[i].key === key) {
return log[i].text.substring(0, 15) + '…'
}
}
}
}
// bog.getImage
function getImage (id, keys, classList) {

2
css/style.css

@ -9,7 +9,7 @@ body {
}
p {
margin-top: 1ex;
margin-top: .5ex;
margin-bottom: 1ex;
font-size: 1em;
}

22
render.js

@ -138,14 +138,26 @@ function render (msg, keys, preview) {
}
if (msg.type == 'post') {
message.appendChild(getHeader(msg, keys))
var mini = h('span', [' '])
message.appendChild(getHeader(msg, keys, mini))
console.log(getTitle(msg.reply))
if (msg.reply) {
message.firstChild.appendChild(h('span', [
're: ',
h('a', {href: '#' + msg.reply}, [msg.reply.substring(0, 10) + '...'])
]))
getTitle(msg.reply).then(title => {
if (!title) {
title = msg.reply.substring(0, 15) + '…'
}
mini.appendChild(h('span', [
'↳ ',
h('a', {href: '#' + msg.reply}, [title])
]))
})
}
message.appendChild(h('div',{id: 'content:' + msg.key, innerHTML: marked(msg.text)}))
var buttons = h('div')
if (!preview) {

Loading…
Cancel
Save