git ssb

16+

Dominic / patchbay



Tree: 968dba2f62d9e537fe3cd9013e6faa8f753e38a2

Files: 968dba2f62d9e537fe3cd9013e6faa8f753e38a2 / modules_core / external-confirm.js

954 bytesRaw
1var lightbox = require('hyperlightbox')
2var h = require('hyperscript')
3var open = require('open-external')
4
5exports.gives = 'external_confirm'
6
7exports.create = function (api) {
8 return function (href) {
9 var lb = lightbox()
10 document.body.appendChild(lb)
11
12 var okay = h('button', 'open', {onclick: function () {
13 lb.remove()
14 open(href)
15 }})
16
17 var cancel = h('button', 'Cancel', {onclick: function () {
18 lb.remove()
19 }})
20
21 okay.addEventListener('keydown', function (ev) {
22 if (ev.keyCode === 27) cancel.click() // escape
23 })
24
25 lb.show(h('div.column.message-confirm',
26 h('div.message',
27 h('div.title.row',
28 h('div.message_meta.row', h('strong', 'warning: '), 'please confirm opening the following link in your OSes browser:')
29 ),
30 h('div.message_content', h('pre', href))
31 ),
32 h('div.row.message-confirm__controls', okay, cancel)
33 ))
34
35 okay.focus()
36 }
37}
38

Built with git-ssb-web