git ssb

3+

ev / decent



Tree: cd6daeeaa3add9754505f6f331965f4de2e98a72

Files: cd6daeeaa3add9754505f6f331965f4de2e98a72 / index.js

1729 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 search = h('input.search', {placeholder: 'Search'})
14
15var nav = h('div.navbar',
16 h('div.internal',
17 h('li', h('a', {href: '#' + id}, h('span.avatar--small', avatar.image(id)))),
18 h('li', h('a', {href: '#' + id}, avatar.name(id))),
19 h('li', h('a', h('button', 'New Post', {
20 onclick: function () {
21 if (document.getElementById('composer')) { return }
22 else {
23 var currentScreen = document.getElementById('screen')
24 var opts = {}
25 opts.type = 'post'
26 var composer = h('div.content#composer', h('div.message', compose(opts)))
27 if (currentScreen.firstChild.firstChild) {
28 currentScreen.firstChild.insertBefore(composer, currentScreen.firstChild.firstChild)
29 } else {
30 currentScreen.firstChild.appendChild(composer)
31 }
32 }
33 }
34 }))),
35 //h('li', h('a', {href: '#friends/' + id }, 'Friends')),
36 h('li', h('a', {href: '#' }, 'All')),
37 h('li', h('a', {href: '#private' }, 'Private')),
38 h('li', h('a', {href: '#wall/' + id }, 'Wall')),
39 h('li', h('a', {href: '#key' }, 'Your Key')),
40 h('li.right', h('a', {href: 'http://github.com/evbogue/decent'}, '?')),
41 )
42)
43
44document.body.appendChild(nav)
45document.body.appendChild(screen)
46route()
47
48window.onhashchange = function () {
49 var oldscreen = document.getElementById('screen')
50 var newscreen = h('div#screen')
51 oldscreen.parentNode.replaceChild(newscreen, oldscreen)
52 route()
53}
54
55

Built with git-ssb-web