From 81b5d525ff9f361f7c619c119378420c05c63967 Mon Sep 17 00:00:00 2001 From: 4chenz Date: Wed, 18 Nov 2020 18:27:54 -0700 Subject: [PATCH 1/2] add Posts Per Minute --- src/General/Index.coffee | 3 +++ src/General/Index/NavLinks.html | 1 + 2 files changed, 4 insertions(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index b4c30a727..c98d84208 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -403,6 +403,7 @@ Index = 'creation-date': 'birth' 'reply-count': 'replycount' 'file-count': 'filecount' + 'posts-per-minute': 'activity' processHash: -> # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=483304 @@ -816,6 +817,7 @@ Index = sort: -> {liveThreadIDs, liveThreadData} = Index return unless liveThreadData + tmp_time = new Date().getTime()/1000; sortType = Index.currentSort.replace(/-rev$/, '') Index.sortedThreadIDs = switch sortType when 'lastreply', 'lastlong' @@ -841,6 +843,7 @@ Index = when 'birth' then [liveThreadIDs... ].sort (a, b) -> b - a when 'replycount' then [liveThreadData...].sort((a, b) -> b.replies - a.replies).map (post) -> post.no when 'filecount' then [liveThreadData...].sort((a, b) -> b.images - a.images ).map (post) -> post.no + when 'activity' then [liveThreadData...].sort((a, b) -> (tmp_time-a.time)/a.replies - (tmp_time-b.time)/b.replies ).map (post) -> post.no else liveThreadIDs if /-rev$/.test(Index.currentSort) Index.sortedThreadIDs = [Index.sortedThreadIDs...].reverse() diff --git a/src/General/Index/NavLinks.html b/src/General/Index/NavLinks.html index d93f07e16..ce35eee6c 100644 --- a/src/General/Index/NavLinks.html +++ b/src/General/Index/NavLinks.html @@ -20,6 +20,7 @@ +