Files: 51bb7f2c4da0239b8114b4f425ca3da89741c261 / modules / message-confirm.js
922 bytesRaw
1 | var lightbox = require('hyperlightbox') |
2 | var h = require('hyperscript') |
3 | var u = require('../util') |
4 | //publish or add |
5 | |
6 | exports.publish = [] |
7 | exports.message_content = [] |
8 | |
9 | exports.message_confirm = function (content, sbot) { |
10 | |
11 | var lb = lightbox() |
12 | document.body.appendChild(lb) |
13 | |
14 | var okay = h('button', 'okay', {onclick: function () { |
15 | u.firstPlug(exports.publish, content, null, sbot) |
16 | lb.remove() |
17 | }}) |
18 | |
19 | var cancel = h('button', 'cancel', {onclick: function () { |
20 | lb.remove() |
21 | }}) |
22 | |
23 | var hidden = h('input', {style: {visible: 'hidden'}}) |
24 | |
25 | |
26 | okay.addEventListener('keydown', function (ev) { |
27 | if(ev.keyCode === 27) cancel.click() //escape |
28 | }) |
29 | |
30 | lb.show(h('div.column', |
31 | u.firstPlug(exports.message_content, |
32 | {key: "DRAFT", value: {content: content}}, sbot |
33 | ) || h('pre', JSON.stringify(content, null, 2)), |
34 | h('div.row', okay, cancel) |
35 | )) |
36 | |
37 | okay.focus() |
38 | |
39 | // hidden.focus() |
40 | |
41 | } |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 |
Built with git-ssb-web