aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEv Bogue <ev@evbogue.com>2020-01-03 18:42:43 -0600
committerEv Bogue <ev@evbogue.com>2020-01-03 18:42:43 -0600
commitedf8b1193d82e7976c6c819aa1d25d54cc2c1858 (patch)
tree676b2ed0c39c90250c227822be7587fe7ab56dad
parent9f8817829f01391567989697394417474205dace (diff)
condense reply text into a ↳ symbol -- also render text of message that is being replied to
-rw-r--r--bog.js12
-rw-r--r--css/style.css2
-rw-r--r--render.js22
3 files changed, 30 insertions, 6 deletions
diff --git a/bog.js b/bog.js
index 55188e5..d8ee2a8 100644
--- a/bog.js
+++ b/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) {
diff --git a/css/style.css b/css/style.css
index 6e26838..ba2313a 100644
--- a/css/style.css
+++ b/css/style.css
@@ -9,7 +9,7 @@ body {
}
p {
- margin-top: 1ex;
+ margin-top: .5ex;
margin-bottom: 1ex;
font-size: 1em;
}
diff --git a/render.js b/render.js
index 79f839a..aaea0c2 100644
--- a/render.js
+++ b/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) {