on master help sign in
*
f91f45eDevine Lu Linvega
scripts/hallway.js+5−8
@@ -92,9 +92,7 @@ function Hallway (sites) {
92
92
93 this.findMention = function (found) {
93 this.findMention = function (found) {
94 const mention = Object.keys(feeds).filter(user => found.indexOf(feeds[user].path) > -1)
94 const mention = Object.keys(feeds).filter(user => found.indexOf(feeds[user].path) > -1)
95− return mention.length === 1
96− ? ` <span class='user'>@${mention[0]}</span>`
95+ return mention.length === 1 ? ` <span class='user'>@${mention[0]}</span>` : ` <span class='user'>${found}</span>`
97− : ` <span class='user'>${found}</span>`
98 }
96 }
99
97
100 this.templateEntry = function (entry) {
98 this.templateEntry = function (entry) {
@@ -161,9 +159,8 @@ function Hallway (sites) {
161
159
162 function timeAgo (dateParam) {
160 function timeAgo (dateParam) {
163 const date = typeof dateParam === 'object' ? dateParam : new Date(dateParam)
161 const date = typeof dateParam === 'object' ? dateParam : new Date(dateParam)
164− const DAY_IN_MS = 86400000 // 24 * 60 * 60 * 1000
165 const today = new Date()
162 const today = new Date()
166− const yesterday = new Date(today - DAY_IN_MS)
163+ const yesterday = new Date(today - 86400000)
167 const seconds = Math.round((today - date) / 1000)
164 const seconds = Math.round((today - date) / 1000)
168 const minutes = Math.round(seconds / 60)
165 const minutes = Math.round(seconds / 60)
169 const isToday = today.toDateString() === date.toDateString()
166 const isToday = today.toDateString() === date.toDateString()
@@ -185,10 +182,10 @@ function Hallway (sites) {
185
182
186 return `${Math.floor(minutes / 1440)} days ago`
183 return `${Math.floor(minutes / 1440)} days ago`
187 }
184 }
185+}
188
186
189− function escapeHtml (unsafe) {
187+function escapeHtml (unsafe) {
190− return unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;')
188+ return unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;')
191− }
192}
189}
193
190
194function filter (name) {
191function filter (name) {