on master help sign in
Implemented mentions
commit111d52eeabd6c4e9cde8f0bd9a89adc569b304ab authorDevine Lu Linvega <aliceffekt@gmail.com> dateTue 2 Jul 2019, 09:26 (7 years ago) parentef51406
2 files changed+10
links/main.css+1 scripts/hallway.js+9
links/main.css+1
@@ -17,6 +17,7 @@ body #hallway .entry .date:after { content: ")" }
1717body #hallway .entry .author { font-family: 'input_mono_medium'; position: absolute;left: 60px; }
1818body #hallway .entry .author:after { content:":"; }
1919body #hallway .entry .body { max-width: 400px }
20+body #hallway .entry .body a { text-decoration: underline; }
2021
2122/* Portal */
2223
scripts/hallway.js+9
@@ -47,6 +47,15 @@ function Hallway (sites) {
4747 const diff = (now - then)
4848 const date = Math.floor(diff / 86400000)
4949
50+ // Find mention
51+ if (entry.body.indexOf('@<') > -1) {
52+ const data = entry.body.split('@<').pop().split('>')[0]
53+ const mention = data.split(' ')
54+ const name = mention[0]
55+ const path = mention[1]
56+ entry.body = entry.body.replace(`@<${data}>`, `<a href='${path}'>${name}</a>`)
57+ }
58+
5059 return `<li class='entry'><span class='date'>${ago(date)}</span> <span class='author'>${entry.author}</span> <span class='body'>${entry.body}</span></li>`
5160 }
5261