git ssb

0+

dangerousbeans / patchbay-bootstrap



Tree: a5f729cb625d55f9a6700f99041f3adc9c2e8ffc

Files: a5f729cb625d55f9a6700f99041f3adc9c2e8ffc / modules / app.js

1106 bytesRaw
1var plugs = require('../plugs')
2var h = require('hyperscript')
3
4var screen_view = plugs.first(exports.screen_view = [])
5var menu_items = plugs.map(exports.menu_items = [])
6
7var status = h('div.status.error') //start off disconnected
8var list = h('div.column', {style: 'display: none;'})
9
10var menu = h('div.menu.row', list, status, {
11 onmouseover: function (e) {
12 list.style.display = 'flex'
13 }, onmouseout: function () {
14 list.style.display = 'none'
15 }
16})
17
18exports.connection_status = function (err) {
19 if(err) status.classList.add('error')
20 else status.classList.remove('error')
21}
22
23exports.app = function () {
24 function hash() {
25 return window.location.hash.substring(1)
26 }
27
28 var view = screen_view(hash() || 'tabs')
29
30 var screen = h('div.screen.column', menu, view)
31
32 menu_items().forEach(function (el) {
33 list.appendChild(el)
34 })
35
36 window.onhashchange = function (ev) {
37 var _view = view
38 view = screen_view(hash() || 'tabs')
39
40 if(_view) screen.replaceChild(view, _view)
41 else document.body.appendChild(view)
42 }
43
44
45 return screen
46
47}
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

Built with git-ssb-web