diff options
Diffstat (limited to 'public/assets/js/lib/views/index')
| -rw-r--r-- | public/assets/js/lib/views/index/lastlog.js | 2 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/threadbox.js | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/public/assets/js/lib/views/index/lastlog.js b/public/assets/js/lib/views/index/lastlog.js index 02b3cca..7a738b7 100644 --- a/public/assets/js/lib/views/index/lastlog.js +++ b/public/assets/js/lib/views/index/lastlog.js @@ -29,7 +29,7 @@ var LastLog = View.extend({ parse: function(user){ if (Date.now()/1000 - user.lastseen > 86400 * 5 *10) return '' var t = this.template - .replace(/{{username}}/g, user.username) + .replace(/{{username}}/g, sanitize(user.username)) .replace(/{{age}}/g, get_age(user.lastseen) ) .replace(/{{age_class}}/g, carbon_date(user.lastseen) ) .trim() diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js index e3a5193..34974b7 100644 --- a/public/assets/js/lib/views/index/threadbox.js +++ b/public/assets/js/lib/views/index/threadbox.js @@ -40,9 +40,18 @@ var ThreadBox = View.extend({ }) Object.keys(keywords).sort().forEach((keyword) => { this.appendKeyword({ keyword }) - this.appendThreads(keywords[keyword].sort( (a,b) => { - return a.title.localeCompare(b.title) // b.lastmodified - a.lastmodified - })) + switch (data.sort) { + case 'date': + this.appendThreads(keywords[keyword].sort( (a,b) => { + return b.lastmodified - a.lastmodified + })) + break + default: + this.appendThreads(keywords[keyword].sort( (a,b) => { + return a.title.localeCompare(b.title) + })) + break + } }) } if (is_mobile || window.innerWidth < 700) { |
