@@ -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)
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` }, '')
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])
73 return a.sort(compare)
71 return a.sort(compare)
76 this.templateEntry = function (entry) {
74 this.templateEntry = function (entry) {
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>`)
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>`)
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) {
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})..`)
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)