aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2020-03-03 14:57:43 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2020-03-19 17:43:55 -0400
commite31abb560ad402ff7927d435b5fa395d255a8791 (patch)
treeb1cefb117461c74bdf394b07ccec1ba044def3d0
parent68ad23321910c19c2e0f1387536417177fc414e4 (diff)
downloadpatchfoo-e31abb560ad402ff7927d435b5fa395d255a8791.tar.gz
patchfoo-e31abb560ad402ff7927d435b5fa395d255a8791.zip
printView: show message date on right
-rw-r--r--lib/render-msg.js28
-rw-r--r--lib/serve.js1
-rw-r--r--static/styles.css4
3 files changed, 21 insertions, 12 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index cc85190..d056bc4 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -24,6 +24,8 @@ function RenderMsg(render, app, msg, opts) {
if (typeof opts === 'boolean') opts = {raw: opts}
this.opts = opts || {}
this.shouldWrap = this.opts.wrap !== false
+ var ts = this.value.timestamp
+ this.date = ts ? new Date(ts) : null
}
RenderMsg.prototype.getMsg = function (id, cb) {
@@ -121,8 +123,6 @@ RenderMsg.prototype.raw = function (cb) {
RenderMsg.prototype.wrap = function (content, cb) {
if (!this.shouldWrap) return cb(null, content)
- var ts = this.msg.value.timestamp
- var date = ts ? new Date(ts) : null
var self = this
var channel = this.c.channel ? '#' + u.toString(this.c.channel) : ''
var done = multicb({pluck: 1, spread: true})
@@ -135,10 +135,10 @@ RenderMsg.prototype.wrap = function (content, cb) {
),
h('td.msg-main',
h('div.msg-header',
- date && !this.serve.noMsgTime ? [h('a.ssb-timestamp', {
- title: date.toLocaleString(),
+ this.date && !this.serve.noMsgTime ? [h('a.ssb-timestamp', {
+ title: this.date.toLocaleString(),
href: this.msg.key ? this.toUrl(this.msg.key) : undefined
- }, htime(date)), ' '] : '',
+ }, htime(this.date)), ' '] : '',
h('code', h('a.ssb-id', {
href: this.toUrl(this.msg.key) +
(this.hasFullLink && this.opts.full ? '?full' : '')
@@ -163,8 +163,6 @@ RenderMsg.prototype.wrap = function (content, cb) {
RenderMsg.prototype.wrapMini = function (content, cb) {
if (!this.shouldWrap) return cb(null, content)
- var ts = this.value.timestamp
- var date = ts ? new Date(ts) : null
var self = this
var channel = this.c.channel ? '#' + this.c.channel : ''
var done = multicb({pluck: 1, spread: true})
@@ -174,10 +172,10 @@ RenderMsg.prototype.wrapMini = function (content, cb) {
this.recpsLine(done()),
channel ? [h('a', {href: this.toUrl(channel)}, channel), ' '] : ''),
h('td.msg-main',
- date ? [h('a.ssb-timestamp', {
- title: date.toLocaleString(),
+ this.date ? [h('a.ssb-timestamp', {
+ title: this.date.toLocaleString(),
href: this.msg.key ? this.toUrl(this.msg.key) : undefined
- }, htime(date)), ' '] : '',
+ }, htime(this.date)), ' '] : '',
this.issues(done()),
this.c.contentWarning ? [
h('details', [
@@ -193,7 +191,12 @@ RenderMsg.prototype.wrapMini = function (content, cb) {
RenderMsg.prototype.actions = function (mini) {
var lastMove
var ooo = this.serve && this.serve.query.ooo
- if (this.serve.noActions) return
+ var extra = [
+ this.serve.msgDate ? [
+ this.date.toISOString().substr(0, 10)
+ ] : ''
+ ]
+ if (this.serve.noActions) return extra
return this.msg.key ?
h('form', {method: 'post', action: ''},
this.msg.rel ? [this.msg.rel, ' '] : '',
@@ -223,7 +226,8 @@ RenderMsg.prototype.actions = function (mini) {
title: 'view raw message'}, 'raw'), ' ',
this.buttonsCommon(),
this.c.type === 'gathering' ? [this.attendButton(), ' '] : '',
- this.voteButton('dig')
+ this.voteButton('dig'),
+ extra
) : [
this.msg.rel ? [this.msg.rel, ' '] : ''
]
diff --git a/lib/serve.js b/lib/serve.js
index 0fef358..653a1e0 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -402,6 +402,7 @@ Serve.prototype.handle = function () {
this.noActions = true
this.noAvatar = true
this.noMsgTime = true
+ this.msgDate = true
}
if (this.query.noThread != null) {
this.noThread = true
diff --git a/static/styles.css b/static/styles.css
index 3ffdddc..d168d21 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -162,6 +162,10 @@ pre {
border-bottom: 0;
}
+.print-view .msg-main {
+ text-align: center;
+}
+
.msg-content {
padding: 0 .5ex .5ex .5ex;
}