diff options
Diffstat (limited to 'lib/serve.js')
-rw-r--r-- | lib/serve.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/serve.js b/lib/serve.js index 17f809c..034915c 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -394,6 +394,17 @@ Serve.prototype.handle = function () { this.query = m[5] ? qs.parse(m[5]) : {} this.useOoo = this.query.ooo != null ? Boolean(this.query.ooo) : this.app.useOoo + if (this.query.printView != null) { + this.noNav = true + this.noFooter = true + this.noComposer = true + this.noActions = true + this.noAvatar = true + } + if (this.query.noThread != null) { + this.noThread = true + } + switch (m[2]) { case '%25': m[2] = '%'; m[1] = decodeURIComponent(m[1]) case '%': return this.id(m[1], m[3]) @@ -1356,7 +1367,7 @@ Serve.prototype.streamThreadWithComposer = function (opts) { var channel = opts.channel pull( - self.app.getThread(rootMsg), + self.noThread ? pull.once(rootMsg) : self.app.getThread(rootMsg), pull.unique('key'), self.app.unboxMessages(), pull.through(function (msg) { @@ -1777,6 +1788,7 @@ function styles() { Serve.prototype.appendFooter = function () { var self = this return function (read) { + if (self.noFooter) return read return cat([read, u.readNext(function (cb) { var ms = new Date() - self.startDate cb(null, pull.once(h('footer', @@ -1805,6 +1817,7 @@ Serve.prototype.wrapPage = function (title, searchQ) { h('link', {rel: 'stylesheet', href: render.toUrl('/highlight/foundation.css')}) ), h('body', + self.noNav ? '' : h('nav.nav-bar', h('form', {action: render.toUrl('/search'), method: 'get'}, self.app.navLinks.map(function (link, i) { return [i == 0 ? '' : ' ', @@ -3397,6 +3410,7 @@ Serve.prototype.wrapThread = function (opts) { return u.hyperwrap(function (thread, cb) { self.app.render.prepareLinks(opts.recps, function (err, recps) { if (err) return cb(er) + if (self.noComposer) return cb(null, thread) self.composer({ placeholder: opts.placeholder || (recps ? 'private reply' : 'reply'), @@ -3693,7 +3707,8 @@ Serve.prototype.composer = function (opts, cb) { value: JSON.stringify(blobs)}), h('input', {type: 'hidden', name: 'url', value: self.req.url}), h('input', {type: 'hidden', name: 'composer_id', value: opts.id}), - opts.recps ? self.app.render.privateLine(opts.recps, true, done()) : + opts.recps ? self.app.render.privateLine({recps: opts.recps, + isAuthorRecp: true}, done()) : opts.private ? h('div', h('input.wide', {name: 'recps', size: 70, value: data.recps || '', placeholder: 'recipient ids'})) : '', channel != null ? |