on master help sign in
#
b45dda1Devine Lu Linvega
links/main.css+3−2
@@ -14,18 +14,19 @@ body div p.readme { max-width:500px; }
14body #hallway #entries { width: calc(100vw - 300px) !important; }
14body #hallway #entries { width: calc(100vw - 300px) !important; }
15body #hallway #sidebar { position: absolute;top: 0px;right: 0px;padding: 0px 15px;width: 200px; }
15body #hallway #sidebar { position: absolute;top: 0px;right: 0px;padding: 0px 15px;width: 200px; }
16
16
17−body #hallway #sidebar > * { border-bottom: 0px; line-height: 15px; padding-bottom: 0px }
17+body #hallway #sidebar > * { border-bottom: 0px; line-height: 16px; padding-bottom: 0px }
18body #hallway #sidebar > * li { text-transform: lowercase; }
18body #hallway #sidebar > * li { text-transform: lowercase; }
19body #hallway #sidebar > * li span.right { color:#555; float:right; }
19body #hallway #sidebar > * li span.right { color:#555; float:right; }
20body #hallway #sidebar > * li span.right:after { content: " msgs"; }
20body #hallway #sidebar > * li span.right:after { content: " msgs"; }
21
21
22body #hallway .entry { line-height: 16px; display: block; position: relative; padding-left:140px; }
22body #hallway .entry { line-height: 16px; display: block; position: relative; padding-left:140px; }
23−body #hallway .entry .date { color: #555;display: block;float:right; margin-left:20px;}
23+body #hallway .entry .date { color: #555;display: block;float:right; margin-left:20px; padding-bottom: 16px;}
24body #hallway .entry .author { font-family: 'input_mono_medium'; position: absolute;left: 0px; }
24body #hallway .entry .author { font-family: 'input_mono_medium'; position: absolute;left: 0px; }
25body #hallway .entry .author:after { content:":"; }
25body #hallway .entry .author:after { content:":"; }
26body #hallway .entry .body { display: block;border-bottom: 1px solid #333;padding-bottom: 10px;margin-bottom: 10px; }
26body #hallway .entry .body { display: block;border-bottom: 1px solid #333;padding-bottom: 10px;margin-bottom: 10px; }
27body #hallway .entry .body a { text-decoration: underline; }
27body #hallway .entry .body a { text-decoration: underline; }
28body #hallway .entry .body .channel { display: inline-block;border-radius: 1px;font-family: 'input_mono_medium';color: #777; }
28body #hallway .entry .body .channel { display: inline-block;border-radius: 1px;font-family: 'input_mono_medium';color: #777; }
29+body #hallway .entry .body .user { display: inline-block;border-radius: 1px;font-family: 'input_mono_medium';color: #777; }
29body #hallway .entry.highlight .author { color:#555; }
30body #hallway .entry.highlight .author { color:#555; }
30body #hallway .entry:hover .author { color:#ccc; }
31body #hallway .entry:hover .author { color:#ccc; }
31body #hallway .entry:hover .date { color:#ccc; }
32body #hallway .entry:hover .date { color:#ccc; }
scripts/hallway.js+9−16
@@ -21,9 +21,9 @@ function Hallway (sites) {
21 const channels = this.findChannels(entries)
21 const channels = this.findChannels(entries)
22 const users = this.findUsers(entries)
22 const users = this.findUsers(entries)
23
23
24− let _entries = entries.reduce((acc, val, id) => { return acc + this.templateEntry(val) + '\n' }, '')
24+ const _entries = entries.filter((val,id) => { return id < 50 }).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` }, '')
25+ const _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` }, '')
26+ const _users = Object.keys(users).reduce((acc, val, id) => { return acc + `<li>${val} <span class='right'>${users[val]}</span></li>\n` }, '')
27
27
28 this.el.innerHTML = `
28 this.el.innerHTML = `
29 <ul id='entries'>
29 <ul id='entries'>
@@ -64,28 +64,22 @@ function Hallway (sites) {
64 this.findEntries = function (feeds) {
64 this.findEntries = function (feeds) {
65 const a = []
65 const a = []
66 for (const id in feeds) {
66 for (const id in feeds) {
67− const feed = feeds[id]
68− for (const i in feed.content) {
67+ for (const i in feeds[id].content) {
69− const entry = feed.content[i]
68+ a.push(feeds[id].content[i])
70− a.push(entry)
71 }
69 }
72 }
70 }
73 return a.sort(compare)
71 return a.sort(compare)
74 }
72 }
75
73
76 this.templateEntry = function (entry) {
74 this.templateEntry = function (entry) {
77− // Find mention
78− if (entry.body.indexOf('@<') > -1) {
75+ if (entry.body.substr(0, 1) === '@') {
79− const data = entry.body.split('@<').pop().split('>')[0]
80− const mention = data.split(' ')
76+ const user = entry.body.split(' ')[0]
81− const name = mention[0]
82− const path = mention[1]
83− entry.body = entry.body.replace(`@<${data}>`, `<a href='${path}'>@${name}</a>`)
77+ entry.body = entry.body.replace(user, `<span class='user'>${user.toLowerCase()}</span>`)
84 }
78 }
85
79
86 if (entry.body.substr(0, 1) === '/') {
80 if (entry.body.substr(0, 1) === '/') {
87 const channel = entry.body.split(' ')[0]
81 const channel = entry.body.split(' ')[0]
88− entry.body = entry.body.replace(channel, `<span class='channel'>${channel}</span>`)
82+ entry.body = entry.body.replace(channel, `<span class='channel'>${channel.toLowerCase()}</span>`)
89 }
83 }
90
84
91 const filter = window.location.hash.substr(1).replace(/\+/g, ' ').toLowerCase()
85 const filter = window.location.hash.substr(1).replace(/\+/g, ' ').toLowerCase()
@@ -116,7 +110,6 @@ function Hallway (sites) {
116
110
117 this.fetchFeed = function (id, feed) {
111 this.fetchFeed = function (id, feed) {
118 console.log(`Fetching ${id}(${feed.path})..`)
112 console.log(`Fetching ${id}(${feed.path})..`)
119−
120 fetch(feed.path, { cache: 'no-store' }).then(x => x.text()).then((content) => {
113 fetch(feed.path, { cache: 'no-store' }).then(x => x.text()).then((content) => {
121 feeds[id].content = parseFeed(id, content)
114 feeds[id].content = parseFeed(id, content)
122 this.refresh(feeds)
115 this.refresh(feeds)