git ssb

2+

ev / mvd



Tree: d3edb71981df71ff6644088ad6b9a4fac8579848

Files: d3edb71981df71ff6644088ad6b9a4fac8579848 / index.js

1621 bytesRaw
1var h = require('hyperscript')
2var route = require('./views')
3var avatar = require('./avatar')
4
5var compose = require('./compose')
6
7var id = require('./keys').id
8
9document.head.appendChild(h('style', require('./style.css.json')))
10
11var screen = h('div#screen')
12
13var nav = h('div.navbar',
14 h('div.internal',
15 h('li', h('a', {href: '#' + id}, h('span.avatar--small', avatar.image(id)))),
16 h('li', h('a', {href: '#' + id}, avatar.name(id))),
17 h('li', h('a', 'Compose', {
18 onclick: function () {
19 if (document.getElementById('composer')) { return }
20 else {
21 var currentScreen = document.getElementById('screen')
22 var opts = {}
23 opts.type = 'post'
24 var composer = h('div.content#composer', h('div.message', compose(opts)))
25 if (currentScreen.firstChild.firstChild) {
26 currentScreen.firstChild.insertBefore(composer, currentScreen.firstChild.firstChild)
27 } else {
28 currentScreen.firstChild.appendChild(composer)
29 }
30 }
31 }
32 })),
33 h('li', h('a', {href: '#' }, 'All')),
34 h('li', h('a', {href: '#private' }, 'Private')),
35 h('li', h('a', {href: '#mentions' }, 'Mentions')),
36 h('li', h('a', {href: '#key' }, 'Key')),
37 h('li', h('a', {href: '#backchannel' }, 'Chat')),
38 h('li.right', h('a', {href: '#about'}, '?'))
39 )
40)
41
42document.body.appendChild(nav)
43document.body.appendChild(screen)
44route()
45
46window.onhashchange = function () {
47 var oldscreen = document.getElementById('screen')
48 var newscreen = h('div#screen')
49 oldscreen.parentNode.replaceChild(newscreen, oldscreen)
50 route()
51}
52
53

Built with git-ssb-web