aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/serve.js41
-rw-r--r--static/styles.css4
2 files changed, 26 insertions, 19 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 5f5a97e..8e563fb 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -530,58 +530,69 @@ function mergeOpts(a, b) {
}
Serve.prototype.renderThreadPaginated = function (opts, feedId, q) {
- function link(opts, name, cb) {
- cb(null, h('tr', h('td.paginate', {colspan: 2},
- h('a', {href: '?' + qs.stringify(mergeOpts(q, opts))}, name))))
+ var self = this
+ function linkA(opts, name) {
+ var q1 = mergeOpts(q, opts)
+ return h('a', {href: '?' + qs.stringify(q1)}, name || q1.limit)
+ }
+ function links(opts) {
+ var limit = opts.limit || q.limit || 10
+ return h('tr', h('td.paginate', {colspan: 2},
+ opts.forwards ? '↑ newer ' : '↓ older ',
+ linkA(mergeOpts(opts, {limit: 1})), ' ',
+ linkA(mergeOpts(opts, {limit: 10})), ' ',
+ linkA(mergeOpts(opts, {limit: 100}))
+ ))
}
+
return pull(
paginate(
function onFirst(msg, cb) {
var num = feedId ? msg.value.sequence : msg.timestamp || msg.ts
if (q.forwards) {
- link({
+ cb(null, links({
lt: num,
gt: null,
forwards: null,
- }, '↓ older', cb)
+ }))
} else {
- link({
+ cb(null, links({
lt: null,
gt: num,
forwards: 1,
- }, '↑ newer', cb)
+ }))
}
},
this.app.render.renderFeeds(),
function onLast(msg, cb) {
var num = feedId ? msg.value.sequence : msg.timestamp || msg.ts
if (q.forwards) {
- link({
+ cb(null, links({
lt: null,
gt: num,
forwards: 1,
- }, '↑ newer', cb)
+ }))
} else {
- link({
+ cb(null, links({
lt: num,
gt: null,
forwards: null,
- }, '↓ older', cb)
+ }))
}
},
function onEmpty(cb) {
if (q.forwards) {
- link({
+ cb(null, links({
gt: null,
lt: opts.gt + 1,
forwards: null,
- }, '↓ older', cb)
+ }))
} else {
- link({
+ cb(null, links({
gt: opts.lt - 1,
lt: null,
forwards: 1,
- }, '↑ newer', cb)
+ }))
}
}
),
diff --git a/static/styles.css b/static/styles.css
index d27ca0a..ccda4cb 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -36,10 +36,6 @@ img.ssb-emoji {
width: 24ex;
}
-.paginate {
- padding-left: 1ex;
-}
-
footer {
font-size: smaller;
text-align: center;