git ssb

0+

ev / microbay



forked from Dominic / patchbay

Tree: 300a5135afd10610eb907dbdf31614142d3025ae

Files: 300a5135afd10610eb907dbdf31614142d3025ae / modules / raw.js

1104 bytesRaw
1var h = require('hyperscript')
2var u = require('../util')
3var pull = require('pull-stream')
4var Scroller = require('pull-scroll')
5
6var plugs = require('../plugs')
7var message_render = plugs.first(exports.message_render = [])
8var message_compose = plugs.first(exports.message_compose = [])
9
10exports.message_meta = function (msg) {
11 var tmp = h('div')
12 var el
13 var pre
14 return h('input', {
15 type: 'checkbox',
16 title: 'View Data',
17 onclick: function () {
18 var msgEl = this.parentNode.parentNode.parentNode
19 var msgContentEl = msgEl.querySelector('.message_content')
20 if (this.checked) {
21 // move away the content
22 while (el = msgContentEl.firstChild)
23 tmp.appendChild(el)
24 // show the raw stuff
25 var json = JSON.stringify({key: msg.key, value: msg.value}, 0, 2)
26 pre = h('pre', json)
27 msgContentEl.appendChild(pre)
28 } else {
29 // hide the raw stuff
30 msgContentEl.removeChild(pre)
31 // put back the content
32 while (el = tmp.firstChild)
33 msgContentEl.appendChild(el)
34 }
35 }
36 })
37}
38
39
40

Built with git-ssb-web