Files: bdc777360c48b4ead49e30a0a5932c35621c0c90 / index.js
1295 bytesRaw
1 | var h = require('hyperscript') |
2 | var route = require('./views') |
3 | var avatar = require('./avatar') |
4 | |
5 | var compose = require('./compose') |
6 | |
7 | var id = require('./keys').id |
8 | |
9 | document.head.appendChild(h('style', require('./style.css.json'))) |
10 | |
11 | var screen = h('div#screen') |
12 | |
13 | var 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 | document.getElementById('screen') |
20 | var opts = {} |
21 | opts.type = 'post' |
22 | var composer = h('div.content#composer', h('div.message', compose(opts))) |
23 | screen.firstChild.insertBefore(composer, screen.firstChild.firstChild) |
24 | } |
25 | })), |
26 | h('li', h('a', {href: '#'}, 'Public')), |
27 | h('li', h('a', {href: '#private' }, 'Private')), |
28 | h('li', h('a', {href: '#mentions' }, 'Mentions')), |
29 | h('li', h('a', {href: '#key' }, 'Key')), |
30 | h('li.right', h('a', {href: '#about'}, '?')) |
31 | ) |
32 | ) |
33 | |
34 | document.body.appendChild(nav) |
35 | document.body.appendChild(screen) |
36 | route() |
37 | |
38 | window.onhashchange = function () { |
39 | var oldscreen = document.getElementById('screen') |
40 | var newscreen = h('div#screen') |
41 | oldscreen.parentNode.replaceChild(newscreen, oldscreen) |
42 | route() |
43 | } |
44 | |
45 |
Built with git-ssb-web