aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 0c8fbf2..9d3e0df 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -62,6 +62,18 @@ RenderMsg.prototype.raw = function (cb) {
m.value.sequence = tok
}
+ // link to previous (raw)
+ if (m.value.previous) {
+ var tok = u.token()
+ tokens[tok] = h('a', {
+ href: this.toUrl(m.value.previous)
+ + '?raw'
+ + (this.serve && this.serve.query.ooo ? '&ooo=1' : '')
+ }, '"' + m.value.previous + '"')
+ isTokenNotString[tok] = true
+ m.value.previous = tok
+ }
+
if (typeof m.value.content === 'object' && m.value.content != null) {
var c = m.value.content = {}
for (k in this.c) c[k] = this.c[k]
@@ -176,6 +188,7 @@ RenderMsg.prototype.wrapMini = function (content, cb) {
RenderMsg.prototype.actions = function (mini) {
var lastMove
+ var ooo = this.serve && this.serve.query.ooo
return this.msg.key ?
h('form', {method: 'post', action: ''},
this.msg.rel ? [this.msg.rel, ' '] : '',
@@ -199,9 +212,9 @@ RenderMsg.prototype.actions = function (mini) {
h('a', {href: this.toUrl(this.msg.key) + '?full',
title: 'view full game board'}, 'full'), ' '] : '',
typeof this.c.text === 'string' ? [
- h('a', {href: this.toUrl(this.msg.key) + '?raw=md',
+ h('a', {href: this.toUrl(this.msg.key) + '?raw=md' + (ooo ? '&ooo=1' : ''),
title: 'view markdown source'}, 'md'), ' '] : '',
- h('a', {href: this.toUrl(this.msg.key) + '?raw',
+ h('a', {href: this.toUrl(this.msg.key) + '?raw' + (ooo ? '&ooo=1' : ''),
title: 'view raw message'}, 'raw'), ' ',
this.buttonsCommon(),
this.c.type === 'gathering' ? [this.attendButton(), ' '] : '',
@@ -481,7 +494,7 @@ RenderMsg.prototype.getMsgName = function (id, cb) {
})
function gotMsg(err, msg) {
if (err) return cb(err)
- new RenderMsg(self.render, self.app, msg, {wrap: false}).title(cb)
+ new RenderMsg(self.render, self.app, msg, {wrap: false, serve: self.serve}).title(cb)
}
}
@@ -1146,7 +1159,7 @@ RenderMsg.prototype.repost = function (cb) {
})
function gotMsg(err, msg) {
if (err) return cb(err)
- var renderMsg = new RenderMsg(self.render, self.app, msg, {wrap: false})
+ var renderMsg = new RenderMsg(self.render, self.app, msg, {wrap: false, serve: self.serve})
renderMsg.message(function (err, msgEl) {
self.wrapMini(['reposted ',
h('code.ssb-id',