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