on master help sign in
*
492cd0bDevine Lu Linvega
scripts/hallway.js+6−11
@@ -27,16 +27,6 @@ function Hallway (sites) {
27
27
28 // Entries
28 // Entries
29
29
30− function compare (a, b) {
31− if (a.date < b.date) {
32− return -1
33− }
34− if (a.date > b.date) {
35− return 1
36− }
37− return 0
38− }
39−
40 this.sortEntries = function () {
30 this.sortEntries = function () {
41 const a = []
31 const a = []
42 for (const id in feeds) {
32 for (const id in feeds) {
@@ -46,7 +36,7 @@ function Hallway (sites) {
46 a.push(entry)
36 a.push(entry)
47 }
37 }
48 }
38 }
49− return a.sort(compare)
39+ return a.sort(compare).reverse()
50 }
40 }
51
41
52 this.templateEntry = function (entry) {
42 this.templateEntry = function (entry) {
@@ -98,6 +88,10 @@ function Hallway (sites) {
98
88
99 // Utils
89 // Utils
100
90
91+ function compare (a, b) {
92+ return a.date < b.date ? -1 : a.date > b.date ? 1 : 0
93+ }
94+
101 function parseFeed (author, feed) {
95 function parseFeed (author, feed) {
102 const lines = feed.split('\n')
96 const lines = feed.split('\n')
103 const entries = []
97 const entries = []
@@ -138,6 +132,7 @@ function Hallway (sites) {
138 } else if (isYesterday) {
132 } else if (isYesterday) {
139 return 'yesterday'
133 return 'yesterday'
140 }
134 }
135+
141 return `${Math.floor(minutes / 1440)} days ago`
136 return `${Math.floor(minutes / 1440)} days ago`
142 }
137 }
143}
138}