aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-11-26 22:48:24 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-11-26 22:59:37 -1000
commit21cb78e192601e115a9cf906b799d6696074a32f (patch)
treedd50214464b9ad3bd1e4b55bbdc39a015b3c015c /lib
parente9c6f0bb743548071f5999b210fa5a8496647fae (diff)
downloadpatchfoo-21cb78e192601e115a9cf906b799d6696074a32f.tar.gz
patchfoo-21cb78e192601e115a9cf906b799d6696074a32f.zip
chess: preserve "full" toggle state in navigation
Diffstat (limited to 'lib')
-rw-r--r--lib/render-msg.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 7d50ef8..474d3e9 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -15,6 +15,9 @@ function RenderMsg(render, app, msg, opts) {
var content = this.value.content
this.c = content || {}
this.isMissing = !content
+ this.hasFullLink =
+ this.c.type === 'chess_move' ||
+ this.c.type === 'ssb_chess_move'
if (typeof opts === 'boolean') opts = {raw: opts}
this.opts = opts || {}
@@ -120,8 +123,10 @@ RenderMsg.prototype.wrap = function (content, cb) {
title: date.toLocaleString(),
href: this.msg.key ? this.toUrl(this.msg.key) : undefined
}, htime(date)), ' ',
- h('code', h('a.ssb-id',
- {href: this.toUrl(this.msg.key)}, this.msg.key)),
+ h('code', h('a.ssb-id', {
+ href: this.toUrl(this.msg.key) +
+ (this.hasFullLink && this.opts.full ? '?full' : '')
+ }, this.msg.key)),
channel ? [' ', h('a', {href: this.toUrl(channel)}, channel)] : '')),
h('td.msg-right', this.actions())
), h('tr',
@@ -173,7 +178,7 @@ RenderMsg.prototype.actions = function (mini) {
h('a', {href: this.render.toUrl('/about/' + encodeURIComponent(this.msg.key))}, 'about'), ' '] : '',
this.c.type === 'ssb-igo' && (lastMove = this.c.values[0] && this.c.values[0].lastMove) ? [
h('a', {href: this.render.toUrl(lastMove)}, 'previous'), ' '] : '',
- /^(ssb_)?chess_/.test(this.c.type) ? [
+ this.hasFullLink ? [
h('a', {href: this.toUrl(this.msg.key) + '?full',
title: 'view full game board'}, 'full'), ' '] : '',
typeof this.c.text === 'string' ? [