on master help sign in
Improved sidebar
commit45c2363131d369ecb0c7dedbe67de658debdc589 authorDevine Lu Linvega <aliceffekt@gmail.com> dateWed 3 Jul 2019, 17:14 (7 years ago) parent569c815
2 files changed+8−15
links/main.css+5 scripts/hallway.js+3−15
links/main.css+5
@@ -14,6 +14,11 @@ body div p.readme { max-width:500px; }
1414body #hallway #entries { width: calc(100vw - 300px) !important; }
1515body #hallway #sidebar { position: absolute;top: 0px;right: 0px;padding: 0px 15px;width: 200px; }
1616
17+body #hallway #sidebar > * { border-bottom: 0px; line-height: 15px; padding-bottom: 0px }
18+body #hallway #sidebar > * li { text-transform: lowercase; }
19+body #hallway #sidebar > * li span.right { color:#555; float:right; }
20+body #hallway #sidebar > * li span.right:after { content: " msgs"; }
21+
1722body #hallway .entry { line-height: 16px; display: block; position: relative; padding-left:140px; margin-bottom: 5px;border-bottom: 1px solid #333;padding-bottom: 5px; }
1823body #hallway .entry .date { color: #555;display: block;float:right; margin-left:20px;}
1924body #hallway .entry .author { font-family: 'input_mono_medium'; position: absolute;left: 0px; }
scripts/hallway.js+3−15
@@ -21,21 +21,9 @@ function Hallway (sites) {
2121 const channels = this.findChannels(entries)
2222 const users = this.findUsers(entries)
2323
24− let _entries = ''
25− for (const id in entries) {
26− const entry = entries[id]
27− _entries += `${this.templateEntry(entry)}\n`
28− }
29−
30− let _channels = ''
31− for (const id in channels) {
32− _channels += `<li>${id} ${channels[id]}</li>\n`
33− }
34−
35− let _users = ''
36− for (const id in users) {
37− _users += `<li>${id} ${users[id]}</li>\n`
38− }
24+ let _entries = entries.reduce((acc, val, id) => { return acc + this.templateEntry(val) + '\n' }, '')
25+ let _channels = Object.keys(channels).reduce((acc, val, id) => { return acc + `<li>${val} <span class='right'>${channels[val]}</span></li>\n` }, '')
26+ let _users = Object.keys(users).reduce((acc, val, id) => { return acc + `<li>${val} <span class='right'>${users[val]}</span></li>\n` }, '')
3927
4028 this.el.innerHTML = `
4129 <ul id='entries'>